veriflow.scores.base#

An abstract implementation of a calculation.

Classes

BaseScore(config)

An abstract calculation class.

BaseScoreConfig(*, score_adapter, general[, ...])

Base config for a score config.

class veriflow.scores.base.BaseScore(config)[source]#

An abstract calculation class.

Parameters:

config (BaseScoreConfig)

kind: str = ''#
config_class#

alias of BaseScoreConfig

supported_data_specs: ClassVar[set[tuple[DataType, SpatialType]]] = {}#
abstractmethod compute(obs, sim)[source]#

Abstract calculation.

Parameters:
Return type:

DataArray | Dataset

validate_and_compute(obs, sim)[source]#

Validate and compute.

Parameters:
Return type:

DataArray | Dataset

classmethod from_config(raw_config)#

Initialize class from config dict.

Parameters:

raw_config (dict[str, Any])

Return type:

Self

class veriflow.scores.base.BaseScoreConfig(*, score_adapter, general, crs=None, verification_pair_ids=[], **extra_data)[source]#

Base config for a score config.

Specific config definitions should inherit from this base class.

Parameters:
  • score_adapter (str)

  • general (Annotated[GeneralInfoConfig, SkipJsonSchema()])

  • crs (Annotated[str, FieldInfo(annotation=NoneType, required=True, description="A coordinate reference system as a string compatible with pyproj.CRS.from_string, i.e. a PROJ string, a CRS WKT string, or an authority string such as 'EPSG:4326'. The string is not parsed at configuration time so that pyproj remains an optional dependency; it is only parsed when an actual coordinate transformation is required.", metadata=[MinLen(min_length=1)])] | None)

  • verification_pair_ids (list[str])

  • extra_data (Any)

score_adapter: str#
general: Annotated[GeneralInfoConfig, SkipJsonSchema()]#
crs: Annotated[Annotated[str, FieldInfo(annotation=NoneType, required=True, description="A coordinate reference system as a string compatible with pyproj.CRS.from_string, i.e. a PROJ string, a CRS WKT string, or an authority string such as 'EPSG:4326'. The string is not parsed at configuration time so that pyproj remains an optional dependency; it is only parsed when an actual coordinate transformation is required.", metadata=[MinLen(min_length=1)])] | None, FieldInfo(annotation=NoneType, required=False, default=None, description='Optional coordinate reference system for score computation. When set, obs and sim coordinates are reprojected to this CRS before computing the score and the results are expressed in it. When omitted, observations and simulations must share the same CRS.')]#
verification_pair_ids: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, description='Optional field to select verification_pairs from the general configuration, by providing a list of verification pair ids from the general config. Only these pair ids will be used in the computation of this score.')]#
property verification_pairs: list[VerificationPair]#

The configured variable pairs.

If the verification_pairs element is configured for the score, filter only these ids from the verification_pairs defined in general config.

property lead_times: LeadTimes | None#
verification_pair_ids_valid()[source]#

Check provided filter for verification pairs contains valid ids.

Return type:

Self