Skip to content

Commit b46d20c

Browse files
committed
fix: error with weights
1 parent 110c6cb commit b46d20c

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

xdem/coreg/biascorr.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,12 @@ def _fit_biascorr( # type: ignore
248248
if isinstance(diff, np.ndarray):
249249
ydata = diff[subsample_mask].flatten()
250250
xdata = np.array([var[subsample_mask].flatten() for var in bias_vars.values()]).squeeze()
251-
# TODO - there is a bug here still
252-
# sigma = (weights[subsample_mask].flatten() if weights is not None else None,)
253-
sigma = None
251+
sigma = weights[subsample_mask].flatten() if weights is not None else None
254252
elif isinstance(diff, da.Array):
255253
ydata = diff.vindex[subsample_mask].flatten().compute() # type:ignore [assignment]
256254
xdata = np.array([var.vindex[subsample_mask].flatten().compute() for var in bias_vars.values()])
257-
# TODO - there is a bug here still
258-
# sigma = (weights[subsample_mask].flatten() if weights is not None else None,)
259-
sigma = None
255+
# TODO - where do the weights come from? Are they also dask arrays?
256+
sigma = weights.vindex[subsample_mask].flatten() if weights is not None else None
260257
else:
261258
raise TypeError(f"Incompatible input type for arrays {type(diff)}.")
262259

0 commit comments

Comments
 (0)