xarray.Dataset.xvec.encode_cf#
- Dataset.xvec.encode_cf()#
Encode all geometry variables and associated CRS with CF conventions.
Use this method prior to writing an Xarray dataset to any array format (e.g. netCDF or Zarr).
- The following invariant is satisfied:
assert ds.xvec.encode_cf().xvec.decode_cf().identical(ds) is True
CRS information on the
GeometryIndex
is encoded using CF’sgrid_mapping
convention.This function uses
cf_xarray.geometry.encode_geometries
under the hood and will only work on Datasets.- Returns:
- Dataset