dpyverification.datasources.fewswebservice#
Module for reading from and writing to a fews webservice.
Classes
|
For downloading data using the Delft-FEWS PI Webservice. |
|
A fews webservice input config element. |
- class dpyverification.datasources.fewswebservice.FewsWebservice(config)[source]#
For downloading data using the Delft-FEWS PI Webservice.
- Parameters:
config (FewsWebserviceConfig)
- config_class#
alias of
FewsWebserviceConfig
- supported_data_types: ClassVar[set[DataType]] = {DataType.observed_historical, DataType.simulated_forecast_ensemble, DataType.simulated_forecast_probabilistic, DataType.simulated_forecast_single}#
- datetime_format = '%Y-%m-%dT%H:%M:%SZ'#
- timeout = 30#
- config: FewsWebserviceConfig#
- static write_netcdf_response_to_dir(response, write_dir, unique_prefix=None)[source]#
Unzip a file and write the NetCDF file(s) to a directory.
Optional parameter unique_prefix is used only when using the leadTime parameter in the request. In this case, the Delft-FEWS webservice response does not contain any meta data on the exact leadTime that was used. That’s why we need to store it in the filename, so that we can internally assign it later as a proper coordinate on the internal xr.DataArray.
- class dpyverification.datasources.fewswebservice.FewsWebserviceConfig(*, import_adapter, source, data_type, general, id_mapping=None, auth_config=<factory>, location_ids, parameter_ids, module_instance_id, ensemble_id=None, qualifier_ids=None, export_id_map=None, webservice_version, archive_kind=ArchiveKind.open_archive, forecast_retrieval_method=ForecastRetrievalMethod.retrieve_all_forecast_data, max_workers_in_thread_pool=2, **extra_data)[source]#
A fews webservice input config element.
- Parameters:
import_adapter (Literal[DataSourceKind.FEWSWEBSERVICE])
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_]*$), MinLen(min_length=1)])
data_type (DataType)
general (Annotated[GeneralInfoConfig, SkipJsonSchema()])
id_mapping (Annotated[IdMappingConfig, SkipJsonSchema()] | None)
auth_config (FewsWebserviceAuthConfig)
ensemble_id (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None)
qualifier_ids (Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None)
export_id_map (Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None)
webservice_version (Annotated[str, StringConstraints(strip_whitespace=None, to_upper=None, to_lower=None, strict=None, min_length=None, max_length=None, pattern=^\d{4}\.(0[1-2])$)])
archive_kind (ArchiveKind)
forecast_retrieval_method (ForecastRetrievalMethod)
max_workers_in_thread_pool (int)
extra_data (Any)
- auth_config: FewsWebserviceAuthConfig#
- location_ids: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]#
- parameter_ids: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]#
- module_instance_id: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])]#
- ensemble_id: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None#
- qualifier_ids: Annotated[list[str], FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None#
- export_id_map: Annotated[str, FieldInfo(annotation=NoneType, required=True, metadata=[MinLen(min_length=1)])] | None#
- webservice_version: 02")]#
- archive_kind: Annotated[ArchiveKind, FieldInfo(annotation=NoneType, required=True, description='Archive kind. Defaults to a Delft-FEWS Open Archive, which is the Delft-FEWS standard.')]#
- forecast_retrieval_method: Annotated[ForecastRetrievalMethod, FieldInfo(annotation=NoneType, required=True, description='Since Delft-FEWS 2025.01, the Delft-FEWS Webservice canretrieve forecasts for specific forecast periods (lead times). This avoid having to retrieve all forecast data outside of the configured forecast periods (lead times) for the verification pipeline. If not provided, the method will be automatically determined based on the configured webservice version.')]#
- max_workers_in_thread_pool: Annotated[int, FieldInfo(annotation=NoneType, required=True, description='This datasource asynchronously retrieves data from the Delft-FEWS webservice. Define here the maximum workers it can use. Use 5-10 for gentle load on the server-side and keep below 30 to avoid instability and minimize the risk of internal server errors.')]#
- property webservice_supports_lead_time_in_get_timeseries: bool#
Wether or not the leadTime parameter is supported.
This determines the forecast retrieval method.