veriflow.datasources.fewsnetcdf#
Read and write NetCDF files in a fews compatible format.
Classes
|
For reading data from a NetCDF file produced by Delft-FEWS. |
|
A FEWS NetCDF config element. |
- class veriflow.datasources.fewsnetcdf.FewsNetCDF(config)[source]#
For reading data from a NetCDF file produced by Delft-FEWS.
- Parameters:
config (FewsNetCDFConfig)
- config_class#
alias of
FewsNetCDFConfig
- supported_data_types: ClassVar[set[DataType]] = {DataType.observed_historical, DataType.simulated_forecast_ensemble}#
- config: FewsNetCDFConfig#
- property configured_stations: set[str] | None#
Return the internal station identifiers configured for this datasource.
This is needed for standardization of station identifiers across sources.
- property configured_variables: set[str] | None#
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:
- fetch_validate_filter_cache(*, clear_cache=False)#
High-level wrapper to fetch, validate, filter and apply id mapping to the dataset.
- filter_dataset(dataset)#
Filter the dataset on lead times and times outside the verification period.
- classmethod from_config(raw_config)#
Initialize class from config dict.
- static get_cached_data(cached_dataset, datasource)#
Get the dataset from the cache based on the datasource configuration.
- Parameters:
cached_dataset (Dataset)
datasource (BaseDatasource)
- Return type:
- standardize_dataset(dataset, data_type)[source]#
Standardize a fetched dataset to the internal datamodel.
Ensures the station dim is indexed by the station id, sets standard dim ordering on each data variable, and ensures each data variable carries a
unitsattribute (filling in"unknown"when missing).
- validate_fetched_data()#
Validate that the dataset is consistent with the config.
- Return type:
None
- class veriflow.datasources.fewsnetcdf.FewsNetCDFConfig(*, directory, filename_glob, import_adapter, source, data_type, general, id_mapping=None, netcdf_kind, station_ids=None, parameter_ids=None, **extra_data)[source]#
A FEWS NetCDF config element.
- Parameters:
directory (str)
filename_glob (str)
import_adapter (Literal[DataSourceKind.FEWSNETCDF])
source (Annotated[str, StringConstraints(strip_whitespace=None, to_upper=None, to_lower=None, strict=None, min_length=1, max_length=None, pattern=^[A-Za-z][A-Za-z0-9_]*$, ascii_only=None), MinLen(min_length=1)])
data_type (DataType)
general (Annotated[GeneralInfoConfig, SkipJsonSchema()])
id_mapping (Annotated[IdMappingConfig, SkipJsonSchema()] | None)
netcdf_kind (FewsNetCDFKind)
station_ids (Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None)
parameter_ids (Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None)
extra_data (Any)
- netcdf_kind: FewsNetCDFKind#
- station_ids: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None#
- parameter_ids: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None#
- property paths: Iterator[Path]#
Return all filepaths as Path objects in a deterministic sorted order.
- property verification_period: TimePeriod#
- property verification_period_on_frt: TimePeriod#
- property verification_period_on_time: TimePeriod#
- source#
- data_type#
- general#
- id_mapping#
- directory#
- filename_glob#