Skip to content

Commit

Permalink
Reset Coords in Layers2Pressure.calc_geopotential (#26)
Browse files Browse the repository at this point in the history
* reset coords to make sure concat operation works

* bump version
  • Loading branch information
timothyas authored Dec 17, 2024
1 parent c5582bf commit 7ef34c2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -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="[email protected]"},
Expand Down
2 changes: 1 addition & 1 deletion ufs2arco/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "0.2.0"
__version__ = "0.2.1"

from .cice6dataset import CICE6Dataset
from .fv3dataset import FV3Dataset
Expand Down
2 changes: 2 additions & 0 deletions ufs2arco/layers2pressure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit 7ef34c2

Please sign in to comment.