From 7ef34c236d16060bcefb4b10125187819223e59f Mon Sep 17 00:00:00 2001 From: Timothy Smith Date: Tue, 17 Dec 2024 15:53:37 -0700 Subject: [PATCH] Reset Coords in Layers2Pressure.calc_geopotential (#26) * reset coords to make sure concat operation works * bump version --- pyproject.toml | 2 +- ufs2arco/__init__.py | 2 +- ufs2arco/layers2pressure.py | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 62e1189..64b3610 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "ufs2arco" -version = "0.2.0" +version = "0.2.1" description = "Tools for converting Unified Forecast System (UFS) output to Analysis Ready, Cloud Optimized (ARCO) format" authors = [ {name="Timothy Smith", email="tim.smith@noaa.gov"}, diff --git a/ufs2arco/__init__.py b/ufs2arco/__init__.py index b8700e9..a23d7ce 100644 --- a/ufs2arco/__init__.py +++ b/ufs2arco/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.2.0" +__version__ = "0.2.1" from .cice6dataset import CICE6Dataset from .fv3dataset import FV3Dataset diff --git a/ufs2arco/layers2pressure.py b/ufs2arco/layers2pressure.py index f3e9646..66af2b5 100644 --- a/ufs2arco/layers2pressure.py +++ b/ufs2arco/layers2pressure.py @@ -243,11 +243,13 @@ def calc_geopotential(self, hgtsfc: xr.DataArray, delz: xr.DataArray) -> xr.Data # Geopotential at the surface phi0 = self.g * hgtsfc phi0 = phi0.expand_dims({"kp1": [len(self.pfull)]}) + phi0 = phi0.reset_coords(drop=True) # Concatenate, cumulative sum from the ground to TOA dz = self.g*np.abs(delz) dz["kp1"] = kp1_left.sel({self.level_name: delz[self.level_name]}) dz = dz.swap_dims({self.level_name: "kp1"}).drop_vars(self.level_name) + dz = dz.reset_coords(drop=True) phii = xr.concat([dz,phi0], dim="kp1")