Skip to content

Commit e36b732

Browse files
committed
fix: precommit
1 parent 65f62d0 commit e36b732

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
@@ -645,7 +645,7 @@ def _preprocess_coreg_fit(
645645
return ref_elev, tba_elev, inlier_mask, transform, crs
646646

647647

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

@@ -718,7 +718,9 @@ def _postprocess_coreg_apply_pts(
718718
return applied_elev
719719

720720

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

724726
# TODO mimic what is happening in the postprocess_coreg_apply_rst.
@@ -1332,9 +1334,12 @@ def _get_subsample_on_valid_mask(self, valid_mask: NDArrayb, verbose: bool = Fal
13321334
def _get_subsample_indices_dask(self, data: NDArrayb) -> tuple[NDArrayf, NDArrayf]:
13331335
"""Get subsampled indices from a dask array."""
13341336

1335-
# subsample value is handled in delyyed_subsample
1337+
# subsample value is handled in delayed_subsample
13361338
indices = delayed_subsample(
1337-
darr=data, subsample=self._meta["subsample"], return_indices=True, silence_max_subsample=True
1339+
darr=data,
1340+
subsample=self._meta["subsample"],
1341+
return_indices=True,
1342+
silence_max_subsample=True,
13381343
)
13391344

13401345
# Write final subsample to class
@@ -1906,7 +1911,7 @@ def _apply_func(self, **kwargs: Any) -> tuple[NDArrayf | gpd.GeoDataFrame, affin
19061911
"""Distribute to _apply_rst and _apply_pts based on input and method availability."""
19071912

19081913
# If input is a raster
1909-
if isinstance(kwargs["elev"], np.ndarray):
1914+
if isinstance(kwargs["elev"], (np.ndarray, da.Array)):
19101915

19111916
# See if a _apply_rst exists
19121917
try:

xdem/coreg/biascorr.py

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

831831

832832
# TODO move this function somewhere sensible
833-
def meshgrid(_, axis="x", block_info=None):
833+
def meshgrid(
834+
_: NDArrayf | NDArrayb,
835+
block_info: dict[Any, Any],
836+
axis: Literal["x", "y"] = "x",
837+
) -> NDArrayf:
834838
"""A bit of a hack to create a meshgrid for a dask array."""
835839
loc = block_info[0]["array-location"]
836840
mesh = np.meshgrid(np.arange(*loc[1]), np.arange(*loc[0]))

0 commit comments

Comments
 (0)