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
GeometryIndexis encoded using CF’sgrid_mappingconvention.This function uses
cf_xarray.geometry.encode_geometriesunder the hood and will only work on Datasets.- Returns:
- Dataset