Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: error with weights
Browse files Browse the repository at this point in the history
ameliefroessl committed Jun 6, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 3c8e185 commit 1ead52b
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
@@ -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)}.")

0 comments on commit 1ead52b

Please sign in to comment.