From b31c2321a41925c0a7ba6341f5ead4509327a17f Mon Sep 17 00:00:00 2001 From: Erik Holmlund Date: Mon, 19 Apr 2021 16:06:40 +0200 Subject: [PATCH] Removed duplicated function. --- xdem/coreg.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/xdem/coreg.py b/xdem/coreg.py index e9242073..f9a7f6ac 100644 --- a/xdem/coreg.py +++ b/xdem/coreg.py @@ -1737,14 +1737,6 @@ def invert_matrix(matrix: np.ndarray) -> np.ndarray: return pytransform3d.transformations.invert_transform(matrix) -def _create_nan_mask(array: Union[np.ndarray, np.ma.masked_array]) -> np.ndarray: - """Will be replaced by Amaury's version once that is merged.""" - nans = ~np.isfinite(np.asarray(array)) - - if isinstance(array, np.ma.masked_array): - nans = nans | array.mask - - return nans def apply_matrix(dem: np.ndarray, transform: rio.transform.Affine, matrix: np.ndarray, invert: bool = False, @@ -1787,7 +1779,7 @@ def apply_matrix(dem: np.ndarray, transform: rio.transform.Affine, matrix: np.nd # Temporary. Should probably be removed. demc[demc == -9999] = np.nan - nan_mask = _create_nan_mask(dem) + nan_mask = xdem.spatial_tools.get_mask(dem) assert np.count_nonzero(~nan_mask) > 0, "Given DEM had all nans." # Create a filled version of the DEM. (skimage doesn't like nans) filled_dem = np.where(~nan_mask, demc, -9999)