xarray.Dataset.pr.downscale_gas_timeseries

xarray.Dataset.pr.downscale_gas_timeseries#

Dataset.pr.downscale_gas_timeseries(*, basket: Hashable, basket_contents: Sequence[Hashable], check_consistency: bool = True, sel: dict[Hashable, Sequence] | None = None, skipna_evaluation_dims: Sequence[Hashable] | None = None, skipna: bool = True, tolerance: float = 0.01) Dataset#

Downscale a gas basket defined on a broader timeseries to its contents known on fewer time points.

This is useful if you have data for many points in time for a gas basket, for example KYOTOGHG, and higher-resolution data (e.g. the individual green house gases included in KYOTOGHG) for only a few points in time. From any time points where all the basket contents are known, the relative shares of the basket contents are determined, and then interpolated linearly and extrapolated constantly to the full timeseries. The shares are then used to downscale the basket to its contents, which is used to fill gaps in the timeseries of the basket contents. Basket contents are converted to the units of the basket for downscaling, and converted back afterwards; for both conversions the gwp conversions of the basket are used.

Parameters:
basket: str

The name of the gas basket for which values are known at higher temporal resolution and/or for a wider range. A value from ds.keys().

basket_contents: list of str

The name of the gases in the gas basket. The sum of all basket_contents equals the basket. Values from ds.keys().

check_consistency: bool, default True

If for all points where the basket and all basket_contents are defined, it should be checked if the sum of the basket_contents actually equals the basket. A ValueError is raised if the consistency check fails.

sel: Selection dict, optional

If the downscaling should only be done on a subset of the Dataset while retaining all other values unchanged, give a selection dictionary. The downscaling will be done on ds.loc[sel].

skipna_evaluation_dims: list of str, optional

Dimensions which should be evaluated to determine if NA values should be skipped entirely if missing fully. By default, no NA values are skipped.

skipna: bool, optional

If true it will be passed on to xarray’s ds.sum function with min_count=1 for the calculation of the basket. The effect is that NA values in a sum will be ignored and treated as zero in the sum unless all values are NA which results in NA.

tolerance: float

If given it overrides the default tolerance for deviations of sums of individual timeseries to given aggregate timeseries. Default is 0.01 (1%)

Returns:
downscaled: xr.Dataset