Skip to content

Commit

Permalink
test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bnb32 committed Jan 8, 2025
1 parent ab75b77 commit c14708f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions sup3r/utilities/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ def get_level_masks(cls, lev_array, level):
Parameters
----------
var_array : Union[np.ndarray, da.core.Array]
Array of variable data, for example u-wind in a 4D array of shape
(lat, lon, time, level)
lev_array : Union[np.ndarray, da.core.Array]
Height or pressure values for the corresponding entries in
var_array, in the same shape as var_array. If this is height and
Expand Down Expand Up @@ -61,7 +58,7 @@ def _lin_interp(cls, lev_samps, var_samps, level):
"""Linearly interpolate between levels."""
diff = da.map_blocks(lambda x, y: x - y, lev_samps[1], lev_samps[0])
alpha = da.where(
diff < 1e-3,
diff == 0,
0,
da.map_blocks(lambda x, y: x / y, (level - lev_samps[0]), diff),
)
Expand Down Expand Up @@ -109,16 +106,16 @@ def interp_to_level(
Parameters
----------
var_array : xr.DataArray
Array of variable data, for example u-wind in a 4D array of shape
(lat, lon, time, level)
lev_array : xr.DataArray
Height or pressure values for the corresponding entries in
var_array, in the same shape as var_array. If this is height and
the requested levels are hub heights above surface, lev_array
should be the geopotential height corresponding to every var_array
index relative to the surface elevation (subtract the elevation at
the surface from the geopotential height)
var_array : xr.DataArray
Array of variable data, for example u-wind in a 4D array of shape
(lat, lon, time, level)
level : float
level or levels to interpolate to (e.g. final desired hub height
above surface elevation)
Expand Down

0 comments on commit c14708f

Please sign in to comment.