Skip to content

Commit

Permalink
self multiplication issue with dask array
Browse files Browse the repository at this point in the history
  • Loading branch information
bnb32 committed Nov 20, 2024
1 parent 420c229 commit 8027b19
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
5 changes: 3 additions & 2 deletions sup3r/bias/bias_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,8 +1094,9 @@ def local_presrat_bc(
# If no trend, it doesn't make sense to correct for zero rate or
# apply the k-factor, but limit to QDM only.
if not no_trend:
subset = np.where(subset < bias_tau_fut, 0, subset)
subset *= k_factor[:, :, nt : nt + 1]
subset = np.where(
subset < bias_tau_fut, 0, subset * k_factor[:, :, nt : nt + 1]
)

data_unbiased[:, :, subset_idx] = subset

Expand Down
12 changes: 11 additions & 1 deletion sup3r/utilities/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,17 @@ def _lin_interp(cls, lev_samps, var_samps, level):
0,
da.map_blocks(lambda x, y: x / y, (level - lev_samps[0]), diff),
)
return (1 - alpha) * var_samps[0] + alpha * var_samps[1]
indices = 'ijk'[:lev_samps[0].ndim]
return da.blockwise(
lambda x, y, a: x * (1 - a) + y * a,
indices,
var_samps[0],
indices,
var_samps[1],
indices,
alpha,
indices,
)

@classmethod
def _log_interp(cls, lev_samps, var_samps, level):
Expand Down

0 comments on commit 8027b19

Please sign in to comment.