xcmor.cmorize

Contents

xcmor.cmorize#

xcmor.cmorize(ds, mip_table=None, coords_table=None, dataset_table=None, cv_table=None, grids_table=None, mapping_table=None, guess=True, time_units=None, transpose=True, decode=True)[source]#

Lazy cmorization.

Cmorizes an xarray Dataset or DataArray object. The cmorizations tries to follow the approach of the original cmor library in adding, manipulating and interpreting dataseta attributes and cmor table vocabulary. All input table arguments (*_table) can either be a dictionary or a path to a cmor table in json or yaml format.

Parameters:
dsDataArray, Dataset

Dataset that should be cmorized.

mip_tabledict, str

MIP table

coords_tabledict, str

The cmor coordinates table.

dataset_tabledict, str

The input dataset cmor table.

cv_table: dict, str

The controlled vocabulary table.

grids_table: dict, str

The grids table.

mapping_table: dict

The mapping table maps input variable names to mip table variable keys.

time_units: str

Time units for NetCDF encoding. Default is days since the beginning of the time interval.

transpose: logical

Transpose dataset to COARDS conventions if neccessary.

decode: logical

Decode output dataset, e.g., to interpret coordinates attributes. If decode=True, xr.decode_cf will be applied on the output dataset.

Returns:
Cmorized Dataset.