File tree 1 file changed +23
-1
lines changed 1 file changed +23
-1
lines changed Original file line number Diff line number Diff line change @@ -1259,7 +1259,19 @@ def extract_points(
1259
1259
return result
1260
1260
1261
1261
def encode_cf (self ) -> xr .Dataset :
1262
- """Encode geometry variables and associated CRS with CF conventions"""
1262
+ """
1263
+ Encode all geometry variables and associated CRS with CF conventions.
1264
+
1265
+ Use this method prior to writing an Xarray dataset to any array format
1266
+ (e.g. netCDF or Zarr).
1267
+
1268
+ The following invariant is satisfied:
1269
+ `assert ds.xvec.encode_cf().xvec.decode_cf().identical(ds) is True`
1270
+
1271
+ Returns
1272
+ -------
1273
+ Dataset
1274
+ """
1263
1275
import cf_xarray as cfxr
1264
1276
1265
1277
ds = self ._obj .copy ()
@@ -1308,6 +1320,16 @@ def encode_cf(self) -> xr.Dataset:
1308
1320
return encoded
1309
1321
1310
1322
def decode_cf (self ) -> xr .Dataset :
1323
+ """
1324
+ Decode geometries stored as CF-compliant arrays to shapely geometries.
1325
+
1326
+ The following invariant is satisfied:
1327
+ `assert ds.xvec.encode_cf().xvec.decode_cf().identical(ds) is True`
1328
+
1329
+ Returns
1330
+ -------
1331
+ Dataset
1332
+ """
1311
1333
import cf_xarray as cfxr
1312
1334
1313
1335
decoded = cfxr .geometry .decode_geometries (self ._obj .copy ())
You can’t perform that action at this time.
0 commit comments