Skip to content

Commit

Permalink
Partial fix for _vertical_remap_extrap bug (#360)
Browse files Browse the repository at this point in the history
* Change conda badge to conda-forge channel

* Remove unneeded variable
  • Loading branch information
Heather Craker authored Mar 2, 2023
1 parent d3eb499 commit 3f56f83
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/geocat/comp/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,8 @@ def _vertical_remap_extrap(new_levels, lev_dim, data, output, pressure, ps,
output: :class:`xarray.DataArray`
A DataArray containing the data after extrapolation.
"""
plev_name = pressure.cf['vertical'].name
sfc_index = pressure[plev_name].argmax().data # index of the model surface
p_sfc = pressure.isel(**dict({plev_name: sfc_index
sfc_index = pressure[lev_dim].argmax().data # index of the model surface
p_sfc = pressure.isel(**dict({lev_dim: sfc_index
})) # extract pressure at lowest level

if variable == 'temperature':
Expand All @@ -305,7 +304,7 @@ def _vertical_remap_extrap(new_levels, lev_dim, data, output, pressure, ps,
for lev in new_levels:
output.loc[dict(plev=lev)] = xr.where(
lev <= p_sfc, output.sel(plev=lev),
data.isel(**dict({plev_name: sfc_index})))
data.isel(**dict({lev_dim: sfc_index})))
return output


Expand Down

0 comments on commit 3f56f83

Please sign in to comment.