From cf3da605dd19942a9a4cb56246ca7919a203d934 Mon Sep 17 00:00:00 2001 From: Romain Hugonnet Date: Sun, 17 Nov 2024 16:17:29 -0900 Subject: [PATCH] Adjust tests --- tests/test_dem.py | 15 +++------------ xdem/dem.py | 9 +-------- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/tests/test_dem.py b/tests/test_dem.py index c6baa303..42fdcd7b 100644 --- a/tests/test_dem.py +++ b/tests/test_dem.py @@ -39,18 +39,11 @@ def test_init(self) -> None: dem3 = DEM(r) assert isinstance(dem3, DEM) - # From SatelliteImage - with warnings.catch_warnings(): - warnings.filterwarnings("ignore", "Parse metadata from file not implemented") - img = gu.SatelliteImage(fn_img) - dem4 = DEM(img) - assert isinstance(dem4, DEM) - - list_dem = [dem, dem2, dem3, dem4] + list_dem = [dem, dem2, dem3] # Check all attributes attrs = [at for at in _default_rio_attrs if at not in ["name", "dataset_mask", "driver"]] - all_attrs = attrs + gu.raster.satimg.satimg_attrs + xdem.dem.dem_attrs + all_attrs = attrs + xdem.dem.dem_attrs for attr in all_attrs: attrs_per_dem = [idem.__getattribute__(attr) for idem in list_dem] assert all(at == attrs_per_dem[0] for at in attrs_per_dem) @@ -59,7 +52,6 @@ def test_init(self) -> None: ( np.array_equal(dem.data, dem2.data, equal_nan=True), np.array_equal(dem2.data, dem3.data, equal_nan=True), - np.array_equal(dem3.data, dem4.data, equal_nan=True), ) ) @@ -67,7 +59,6 @@ def test_init(self) -> None: ( np.all(dem.data.mask == dem2.data.mask), np.all(dem2.data.mask == dem3.data.mask), - np.all(dem3.data.mask == dem4.data.mask), ) ) @@ -192,7 +183,7 @@ def test_copy(self) -> None: # using list directly available in Class attrs = [at for at in _default_rio_attrs if at not in ["name", "dataset_mask", "driver"]] - all_attrs = attrs + gu.raster.satimg.satimg_attrs + xdem.dem.dem_attrs + all_attrs = attrs + xdem.dem.dem_attrs for attr in all_attrs: assert r.__getattribute__(attr) == r2.__getattribute__(attr) diff --git a/xdem/dem.py b/xdem/dem.py index 9cbe0987..168bb6e8 100644 --- a/xdem/dem.py +++ b/xdem/dem.py @@ -68,14 +68,7 @@ class DEM(Raster): # type: ignore def __init__( self, filename_or_dataset: str | RasterType | rio.io.DatasetReader | rio.io.MemoryFile, - vcrs: Literal["Ellipsoid"] - | Literal["EGM08"] - | Literal["EGM96"] - | VerticalCRS - | str - | pathlib.Path - | int - | None = None, + vcrs: Literal["Ellipsoid", "EGM08", "EGM96"] | VerticalCRS | str | pathlib.Path | int | None = None, load_data: bool = False, parse_sensor_metadata: bool = False, silent: bool = True,