From f474e5cbbdc9be9e9d99ed8b63666437520c3602 Mon Sep 17 00:00:00 2001 From: Deepak Cherian Date: Sat, 14 Sep 2024 21:13:26 -0600 Subject: [PATCH] Avoid one deepcopy in geometry encoding (#537) --- cf_xarray/geometry.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf_xarray/geometry.py b/cf_xarray/geometry.py index 396d9eff..6286b301 100644 --- a/cf_xarray/geometry.py +++ b/cf_xarray/geometry.py @@ -324,7 +324,7 @@ def encode_geometries(ds: xr.Dataset): # TODO: this is incomplete. It works for vector data cubes where one of the geometry vars # is a dimension coordinate. if name in var.dims: - var = var.copy() + var = var.copy(deep=False) var._attrs = copy.deepcopy(var._attrs) var.attrs["geometry"] = container_name # The grid_mapping and coordinates attributes can be carried by the geometry container