From 8c4eb1af818f37fe4d1cd68484831d422e53cc7e Mon Sep 17 00:00:00 2001 From: Ag Stephens Date: Wed, 22 Dec 2021 12:02:56 +0000 Subject: [PATCH] Updated fix: remove_fill_values() Added import of `cf_xarray` and detection of bounds for each coordinate. And then sets _FillValue to None to avoid writing bounds with _FillValue to netcdf. --- daops/data_utils/attr_utils.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/daops/data_utils/attr_utils.py b/daops/data_utils/attr_utils.py index 874eb8d..6abb476 100644 --- a/daops/data_utils/attr_utils.py +++ b/daops/data_utils/attr_utils.py @@ -1,3 +1,5 @@ +import cf_xarray + from roocs_utils.xarray_utils import xarray_utils as xu from .common_utils import handle_derive_str @@ -67,6 +69,10 @@ def remove_fill_values(ds_id, ds): if ds.coords[coord_id].dims == (coord_id,): ds[coord_id].encoding["_FillValue"] = None + bounds = ds.cf.get_bounds(coord_id) + if bounds is not None: + bounds.encoding["_FillValue"] = None + return ds