xarray.Dataset.pr.fill_na_gas_basket_from_contents#
- Dataset.pr.fill_na_gas_basket_from_contents(*, basket: str, basket_contents: Sequence[str], sel: Mapping[Hashable, Sequence] | None = None, skipna: bool | None = None, skipna_evaluation_dims: DimOrDimsT | None = None, min_count: int | None = None) DataArray #
Fill NA values in a gas basket using the sum of its contents.
To calculate the sum of the gas basket contents, the global warming potential context defined on the gas basket will be used.
- Parameters:
- basket: str
The name of the gas basket. 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()
.- sel: Selection dict, optional
If the filling should only be done on a subset of the Dataset while retaining all other values unchanged, give a selection dictionary. The filling will be done on
ds.loc[sel]
.- skipna: bool, optional
If
True
(default), skip missing values (as marked by NaN). By default, only skips missing values for float dtypes; other dtypes either do not have a sentinel missing value (int) orskipna=True
has not been implemented (object
,datetime64
ortimedelta64
).- skipna_evaluation_dims: str or list of str, optional
Dimension(s) to evaluate along to determine if values should be skipped. Only one of
skipna
andskipna_evaluation_dims
can be supplied. If all values along the specified dimensions are NA, the values are skipped, other NA values are not skipped and will lead to NA in the corresponding result.- min_count: int (default None, but set to 1 if skipna=True)
The minimal number of non-NA values in a sum that is necessary for a non-NA result. This only has an effect if
skipna=True
. As an example: you sum data for a region for a certain sector, gas and year. Ifskipna=False
, all countries in the region need to have non-NA data for that sector, gas, year combination. Ifskipna=True
andmin_count=1
then one country with non-NA data is enough for a non-NA result. All NA values will be treated as zero. Ifmin_count=0
all NA values will be treated as zero also if there is no single non-NA value in the data that is to be summed.
- Returns:
- filledxr.DataArray