@@ -278,11 +278,6 @@ def _run_diag_annual_cycle(parameter: ARMDiagsParameter) -> ARMDiagsParameter:
278278 vars_funcs = _get_vars_funcs_for_derived_var (ds_ref , var )
279279 target_var = list (vars_funcs .keys ())[0 ][0 ]
280280
281- # NOTE: The bounds dimension can be "nv", which is not
282- # currently recognized as a valid bounds dimension
283- # by xcdat. We rename it to "bnds" to make it compatible.
284- ds_ref = _rename_bounds_dim (ds_ref )
285-
286281 ds_ref_climo = ds_ref .temporal .climatology (target_var , "month" )
287282 da_ref = vars_funcs [(target_var ,)](ds_ref_climo [target_var ]).rename (
288283 var
@@ -535,33 +530,3 @@ def _save_metrics_to_json(parameter: ARMDiagsParameter, metrics_dict: Dict[str,
535530 json .dump (metrics_dict , outfile )
536531
537532 logger .info (f"Metrics saved in: { abs_path } " )
538-
539-
540- def _rename_bounds_dim (ds : xr .Dataset ) -> xr .Dataset :
541- """
542- Renames the bounds dimension "nv" to "bnds" in the given xarray.Dataset for
543- xCDAT compatibility.
544-
545- This is a temporary workaround to ensure compatibility with xCDAT's bounds
546- handling. The bounds dimension "nv" is commonly used in datasets to
547- represent the number of vertices in a polygon, but xCDAT expects the
548- bounds dimension to be in `xcdat.bounds.VALID_BOUNDS_DIMS`. This function
549- renames "nv" to "bnds" to align with xCDAT's expectations.
550-
551- Parameters
552- ----------
553- ds : xr.Dataset
554- The input xarray.Dataset which may contain a bounds dimension named "nv".
555-
556- Returns
557- -------
558- xr.Dataset
559- A new xarray.Dataset with the "nv" dimension renamed to "bnds" if it
560- existed; otherwise, the original dataset copy.
561- """
562- ds_new = ds .copy ()
563-
564- if "nv" in ds_new .dims :
565- ds_new = ds_new .rename ({"nv" : "bnds" })
566-
567- return ds_new
0 commit comments