Skip to content

Commit

Permalink
Simplify syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
dnerini committed Jun 12, 2021
1 parent a13cbe0 commit 81f5dd5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions topo_descriptors/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def scale_to_pixel(scales, dem_da):
"""
check_dem(dem_da)
x_coords, y_coords = dem_da["x"].values, dem_da["y"].values
epsg_code = f"epsg:{int(dem_da.attrs['crs'].lower().split('epsg:')[1])}"
epsg_code = dem_da.attrs["crs"].lower()
if epsg_code == "epsg:4326":
logger.warning(
f"Reprojecting coordinates from WGS84 to UTM to obtain units of meters"
Expand Down Expand Up @@ -185,4 +185,6 @@ def check_dem(dem):
if not "crs" in dem.attrs:
raise KeyError("missing 'crs' (case sensitive) attribute in dem")
if not "epsg:" in dem.attrs["crs"].lower():
raise ValueError("missing 'epsg:' (case insensitive) key in the 'crs' attribute")
raise ValueError(
"missing 'epsg:' (case insensitive) key in the 'crs' attribute"
)

0 comments on commit 81f5dd5

Please sign in to comment.