xdggs.decode#
- xdggs.decode(obj, grid_info=None, *, name=None, convention='xdggs', index_options=None, **index_kwargs)#
decode grid parameters and create a DGGS index
- Parameters:
ds (
xarray.Dataset) – The input dataset. Must contain a coordinate for the cell ids with at least the attributes grid_name and level.grid_info (
dictorDGGSInfo, optional) – Override the grid parameters on the dataset. Useful to set attributes on the dataset.name (
str, default:"cell_ids") – The name of the coordinate containing the cell ids.convention (
str, default:"xdggs") – The name of the metadata convention. Built-in conventions are:“xdggs”: the existing xdggs convention.
namepoints to the coordinate containing cell ids, and which has all the grid metadata. Thenameparameter defaults to"cell_ids".“cf”: the upcoming CF convention standardization. While the convention extension is specialized on
healpixfor now, the decoder can work with other DGGS as well. For this, all metadata lives on a variable with agrid_mapping_nameattribute, and the cell ids coordinate is indicated by thecoordinatesattribute on data variables / other coordinates (this can be overridden by thenameparameter).
index_options, **index_kwargs (
dict, optional) – Additional options to forward to the index.
- Returns:
decoded (
xarray.DataArrayorxarray.Dataset) – The input dataset with a DGGS index on the cell id coordinate.