Skip to content

Commit

Permalink
test: minor
Browse files Browse the repository at this point in the history
  • Loading branch information
vschaffn committed Jan 9, 2025
1 parent 43b609a commit f0a24a7
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 14 deletions.
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

# Define a URL to the xdem-data repository's test data
_TESTDATA_REPO_URL = "https://github.com/vschaffn/xdem-data/tarball/2-richdem_gdal"
_COMMIT_HASH = "ca9d7e34294cf57c00cea4adbf4ee634a63e20d7"
_COMMIT_HASH = "31a7159c982cec4b352f0de82bd4e0be61db3afe"


def download_test_data(overwrite: bool = False) -> None:
Expand Down
13 changes: 0 additions & 13 deletions tests/test_terrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,26 +143,13 @@ def test_attribute_functions_against_richdem(self, attribute: str, get_test_data
"planform_curvature": lambda dem: xdem.terrain.planform_curvature(dem.data, resolution=dem.res),
}

# Functions for RichDEM wrapper methods
# functions_richdem = {
# "slope_Horn": lambda dem: get_terrain_attribute_richdem(dem, attribute="slope", degrees=True),
# "aspect_Horn": lambda dem: get_terrain_attribute_richdem(dem, attribute="aspect", degrees=True),
# "hillshade_Horn": lambda dem: get_terrain_attribute_richdem(dem, attribute="hillshade"),
# "curvature": lambda dem: get_terrain_attribute_richdem(dem, attribute="curvature"),
# "profile_curvature": lambda dem: get_terrain_attribute_richdem(dem, attribute="profile_curvature"),
# "planform_curvature": lambda dem: get_terrain_attribute_richdem(
# dem, attribute="planform_curvature", degrees=True
# ),
# }

# Copy the DEM to ensure that the inter-test state is unchanged, and because the mask will be modified.
dem = self.dem.copy()

# Derive the attribute using both RichDEM and xdem
attr_xdem = gu.raster.get_array_and_mask(functions_xdem[attribute](dem))[0].squeeze()
attr_richdem_rst = gu.Raster(get_test_data_path(os.path.join("richdem", f"{attribute}.tif")), load_data=True)
attr_richdem = gu.raster.get_array_and_mask(attr_richdem_rst)[0].squeeze()
# attr_richdem = gu.raster.get_array_and_mask(functions_richdem[attribute](dem))[0].squeeze()

# We compute the difference and keep only valid values
diff = attr_xdem - attr_richdem
Expand Down

0 comments on commit f0a24a7

Please sign in to comment.