veriflow.datasources.csv#

Datasources to fetch thresholds.

Classes

Csv(config)

Datasource for reading CSV files.

CsvConfig(*, import_adapter, source, ...[, ...])

A CSV input config element.

class veriflow.datasources.csv.Csv(config)[source]#

Datasource for reading CSV files.

Parameters:

config (CsvConfig)

kind: str = 'csv'#
config_class#

alias of CsvConfig

supported_data_types: ClassVar[set[DataType]] = {DataType.threshold}#
config: CsvConfig#
dataset: Dataset#
property configured_stations: set[str]#

Return the internal station identifiers configured for this datasource.

This is needed for standardization of station identifiers across sources.

property cache: ZarrCache | None#

Return the cache instance if caching is enabled, otherwise None.

property configured_variables: set[str]#

Return the internal variable identifiers configured for this datasource.

This is needed for standardization of variable identifiers across sources.

property configured_variables_internal: set[str] | None#

Return the standardized internal variable identifiers configured for this datasource.

This standardized format is needed for caching across different datasources. If your datasource implementation does not have any configurable variables, return None.

create_cache_request(cached_dataset)#

Get the cache request based on the cached dataset and the config.

Parameters:

cached_dataset (Dataset)

Return type:

CacheRequest

property data_type: DataType#

Whether the instance represents sim or obs data.

fetch_validate_filter_cache(*, clear_cache=False)#

High-level wrapper to fetch, validate, filter and apply id mapping to the dataset.

Parameters:

clear_cache (bool)

Return type:

Self

filter_dataset(dataset)#

Filter the dataset on lead times and times outside the verification period.

Parameters:

dataset (Dataset)

Return type:

Dataset

classmethod from_config(raw_config)#

Initialize class from config dict.

Parameters:

raw_config (dict[str, Any])

Return type:

Self

static get_cached_data(cached_dataset, datasource)#

Get the dataset from the cache based on the datasource configuration.

Parameters:
Return type:

Dataset

get_data()#

Get data and make use of cache if configured.

Return type:

Self

validate_fetched_data()#

Validate that the dataset is consistent with the config.

Return type:

None

fetch_data()[source]#

Parse thresholds from csv file.

Return type:

Self

class veriflow.datasources.csv.CsvConfig(*, import_adapter, source, data_type, general, id_mapping=None, directory, filename, stations, variables, thresholds, **extra_data)[source]#

A CSV input config element.

Parameters:
import_adapter: Literal[DataSourceKind.CSV]#
data_type: Literal[DataType.threshold]#
stations: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]#
variables: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]#
thresholds: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]#
property lead_times: LeadTimes | None#
property verification_period: TimePeriod#
property verification_period_on_frt: TimePeriod#
property verification_period_on_time: TimePeriod#
directory#
filename#
source#
general#
id_mapping#