Skip to content

Commit 207f696

Browse files
committed
fix: precommit
1 parent 331dca7 commit 207f696

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

xdem/coreg/base.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ def _preprocess_coreg_fit(
644644
return ref_elev, tba_elev, inlier_mask, transform, crs
645645

646646

647-
def mask_array(arr: NDArrayf, nodata: int | float):
647+
def mask_array(arr: NDArrayf, nodata: int | float) -> NDArrayf:
648648
"""Convert invalid data to nan."""
649649
return np.where(np.logical_or(~da.isfinite(arr), arr == nodata), np.nan, arr)
650650

@@ -717,7 +717,9 @@ def _postprocess_coreg_apply_pts(
717717
return applied_elev
718718

719719

720-
def _postprocess_coreg_apply_xarray_xarray(applied_elev: da.Array, out_transform: affine.Affine):
720+
def _postprocess_coreg_apply_xarray_xarray(
721+
applied_elev: da.Array, out_transform: affine.Affine
722+
) -> tuple[da.Array, affine.Affine]:
721723
"""Post-processing and checks of apply for dask inputs."""
722724

723725
# TODO mimic what is happening in the postprocess_coreg_apply_rst.
@@ -1321,9 +1323,12 @@ def _get_subsample_on_valid_mask(self, valid_mask: NDArrayb, verbose: bool = Fal
13211323
def _get_subsample_indices_dask(self, data: NDArrayb) -> tuple[NDArrayf, NDArrayf]:
13221324
"""Get subsampled indices from a dask array."""
13231325

1324-
# subsample value is handled in delyyed_subsample
1326+
# subsample value is handled in delayed_subsample
13251327
indices = delayed_subsample(
1326-
darr=data, subsample=self._meta["subsample"], return_indices=True, silence_max_subsample=True
1328+
darr=data,
1329+
subsample=self._meta["subsample"],
1330+
return_indices=True,
1331+
silence_max_subsample=True,
13271332
)
13281333

13291334
# Write final subsample to class
@@ -1761,7 +1766,7 @@ def _apply_func(self, **kwargs: Any) -> tuple[NDArrayf | gpd.GeoDataFrame, affin
17611766
"""Distribute to _apply_rst and _apply_pts based on input and method availability."""
17621767

17631768
# If input is a raster
1764-
if isinstance(kwargs["elev"], np.ndarray):
1769+
if isinstance(kwargs["elev"], (np.ndarray, da.Array)):
17651770

17661771
# See if a _apply_rst exists
17671772
try:

xdem/coreg/biascorr.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1050,7 +1050,11 @@ def _apply_rst(
10501050

10511051

10521052
# TODO move this function somewhere sensible
1053-
def meshgrid(_, axis="x", block_info=None):
1053+
def meshgrid(
1054+
_: NDArrayf | NDArrayb,
1055+
block_info: dict[Any, Any],
1056+
axis: Literal["x", "y"] = "x",
1057+
) -> NDArrayf:
10541058
"""A bit of a hack to create a meshgrid for a dask array."""
10551059
loc = block_info[0]["array-location"]
10561060
mesh = np.meshgrid(np.arange(*loc[1]), np.arange(*loc[0]))

0 commit comments

Comments
 (0)