Skip to content

Commit

Permalink
fix: error with weights
Browse files Browse the repository at this point in the history
  • Loading branch information
ameliefroessl committed Jun 7, 2024
1 parent 110c6cb commit b46d20c
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions xdem/coreg/biascorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,12 @@ def _fit_biascorr( # type: ignore
if isinstance(diff, np.ndarray):
ydata = diff[subsample_mask].flatten()
xdata = np.array([var[subsample_mask].flatten() for var in bias_vars.values()]).squeeze()
# TODO - there is a bug here still
# sigma = (weights[subsample_mask].flatten() if weights is not None else None,)
sigma = None
sigma = weights[subsample_mask].flatten() if weights is not None else None
elif isinstance(diff, da.Array):
ydata = diff.vindex[subsample_mask].flatten().compute() # type:ignore [assignment]
xdata = np.array([var.vindex[subsample_mask].flatten().compute() for var in bias_vars.values()])
# TODO - there is a bug here still
# sigma = (weights[subsample_mask].flatten() if weights is not None else None,)
sigma = None
# TODO - where do the weights come from? Are they also dask arrays?
sigma = weights.vindex[subsample_mask].flatten() if weights is not None else None
else:
raise TypeError(f"Incompatible input type for arrays {type(diff)}.")

Expand Down

0 comments on commit b46d20c

Please sign in to comment.