veriflow.datasources.netcdf#

Read and write NetCDF files in a fews compatible format.

Classes

NetCDF(config)

A datasource for reading NetCDF files compatible with the internal datamodel.

NetCDFConfig(*, directory, filename_glob, ...)

A NetCDF config element.

class veriflow.datasources.netcdf.NetCDF(config)[source]#

A datasource for reading NetCDF files compatible with the internal datamodel.

You can validate that the NetCDF file satisfies the internal datamodel using the following example:

import xarray as xr
from veriflow.datasources import validate_input_data

dataset = xr.open_dataset("path/to/netcdf/file/example.nc")
validated_data = validate_input_data(dataset)

Note

The data variables in the NetCDF file represent the physical variables to be verified. Each data variable should carry a units attribute. The dataset must carry a data_type attribute that matches one of the supported data types (it will be set from the configuration if missing).

Parameters:

config (NetCDFConfig)

kind: str = 'netcdf'#
config_class#

alias of NetCDFConfig

supported_data_types: ClassVar[set[DataType]] = {DataType.observed_historical, DataType.simulated_forecast_ensemble, DataType.simulated_forecast_probabilistic, DataType.simulated_forecast_single, DataType.threshold}#
fetch_data()[source]#

Retrieve NetCDF file content as an xarray Dataset.

Return type:

Self

class veriflow.datasources.netcdf.NetCDFConfig(*, directory, filename_glob, import_adapter, source, data_type, general, id_mapping=None, **extra_data)[source]#

A NetCDF config element.

Parameters:
import_adapter: Literal[DataSourceKind.NETCDF]#