dubfi.fluxes.dataprovider¶
Abstract data provider interface.
Added in version 0.1.1.
Classes¶
Abstract base class for data providers for inversion. |
|
Abstract base class for data providers for inversion. |
Functions¶
|
Reduce dataset to given keys, read additional data if necessary. |
|
Read additional data for given dataset. |
Module Contents¶
- class dubfi.fluxes.dataprovider.AbstractDataProvider¶
Bases:
abc.ABCAbstract base class for data providers for inversion.
- property config: dict[str, Any]¶
- Abstractmethod:
- Return type:
dict[str, Any]
Inversion configuration.
- property coords: dict[str, Any]¶
- Abstractmethod:
- Return type:
dict[str, Any]
Data coordinates, see
dubfi.fluxes.readobs.coordinates_from_config().
- abstractmethod get_R()¶
Get R parametrized operator (error covariance matrix).
For the ensemble flux inversion, this operator is constructed as described in R-matrix and uncertainties.
- Return type:
- abstractmethod get_H()¶
Get H parametrized vector (observation operator).
For the flux inversion, this is just a linear operator (i.e., a matrix). A possible offset or background concentration in the model prediction should be directly subtracted from the vector returned by
get_Y().- Return type:
- abstractmethod get_Y()¶
Get Y vector (observation minus model prior).
This is usually the vector of observations minus the model prior, or the observations minus the model background.
- Return type:
- get_mdm_eigenbasis_size()¶
Get size of self.get_R().validate_uncertainty_statistics(mdm) output.
- Return type:
int
- class dubfi.fluxes.dataprovider.InsituDataProvider¶
Bases:
AbstractDataProviderAbstract base class for data providers for inversion.
- get_mdm_eigenbasis_size()¶
Get size of self.get_R().validate_uncertainty_statistics(mdm) output.
- Return type:
int
- weight_outliers()¶
Inflate uncertainty for outliers.
- Raises:
RuntimeError – if called a second time
- Return type:
None
- apply_global_inflation()¶
Apply global uncertainty inflation in-place.
- Raises:
RuntimeError – if called a second time
- Return type:
None
- abstractmethod read_data()¶
Read data from files.
- _read_ens(fname, times, obsidcs, **netcdf_kw)¶
Read ensemble data, helper for
read_data().- Parameters:
fname (str)
times (numpy.ndarray)
obsidcs (numpy.ndarray | slice)
- Return type:
None
- _read_det(fname, times, obsidcs, ssh, same_site_count, **netcdf_kw)¶
Read deterministic data, helper for
read_data().- Parameters:
fname (str)
times (numpy.ndarray)
obsidcs (numpy.ndarray | slice)
ssh (str)
same_site_count (numpy.ndarray)
- Return type:
None
- dubfi.fluxes.dataprovider.reduce_ds_read_aux(ds, keys)¶
Reduce dataset to given keys, read additional data if necessary.
- Parameters:
ds (xarray.Dataset)
keys (list[str])
- Return type:
xarray.Dataset
- dubfi.fluxes.dataprovider.read_aux(ds, keys=None)¶
Read additional data for given dataset.
If dataset has attribute “is_auxiliary_to_data_in”, read additional data from that location. If keys are given, read only the given keys from additional data. Otherwise, read all additional data.
- Parameters:
ds (xarray.Dataset)
keys (list[str] | None)
- Return type:
xarray.Dataset