@@ -644,7 +644,7 @@ def _preprocess_coreg_fit(
644
644
return ref_elev , tba_elev , inlier_mask , transform , crs
645
645
646
646
647
- def mask_array (arr : NDArrayf , nodata : int | float ):
647
+ def mask_array (arr : NDArrayf , nodata : int | float ) -> NDArrayf :
648
648
"""Convert invalid data to nan."""
649
649
return np .where (np .logical_or (~ da .isfinite (arr ), arr == nodata ), np .nan , arr )
650
650
@@ -717,7 +717,9 @@ def _postprocess_coreg_apply_pts(
717
717
return applied_elev
718
718
719
719
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 ]:
721
723
"""Post-processing and checks of apply for dask inputs."""
722
724
723
725
# 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
1321
1323
def _get_subsample_indices_dask (self , data : NDArrayb ) -> tuple [NDArrayf , NDArrayf ]:
1322
1324
"""Get subsampled indices from a dask array."""
1323
1325
1324
- # subsample value is handled in delyyed_subsample
1326
+ # subsample value is handled in delayed_subsample
1325
1327
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 ,
1327
1332
)
1328
1333
1329
1334
# Write final subsample to class
@@ -1761,7 +1766,7 @@ def _apply_func(self, **kwargs: Any) -> tuple[NDArrayf | gpd.GeoDataFrame, affin
1761
1766
"""Distribute to _apply_rst and _apply_pts based on input and method availability."""
1762
1767
1763
1768
# If input is a raster
1764
- if isinstance (kwargs ["elev" ], np .ndarray ):
1769
+ if isinstance (kwargs ["elev" ], ( np .ndarray , da . Array ) ):
1765
1770
1766
1771
# See if a _apply_rst exists
1767
1772
try :
0 commit comments