You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Path to the existing ellipsoid file, by default "egm_08_geoid.tif"
78
83
download_geoid : bool, optional
79
84
Flag to download the ellipsoid file, by default False
85
+
check_geoid_crosses_antimeridian : bool, optional
86
+
Check if the geoid crosses the antimeridian. Set to False if it is known
87
+
The requested bounds do not cross the antimeridian to stop false positives.
80
88
num_cpus : int, optional
81
89
Number of cpus to be used for parallel download, by default 1.
82
90
Setting to -1 will use all available cpus
@@ -125,6 +133,26 @@ def get_rema_dem_for_bounds(
125
133
# Log the requested bounds
126
134
logging.info(f"Getting REMA DEM for bounds: {bounds.bounds}")
127
135
136
+
# Check if bounds cross the antimeridian
137
+
ifbounds.left>bounds.right:
138
+
logging.warning(
139
+
f"left longitude value ({bounds[0]}) is greater than the right longitude value {({bounds[2]})} "
140
+
f"for the bounds provided. Assuming the bounds cross the antimeridian : {bounds}"
141
+
)
142
+
dem_crosses_antimeridian=True
143
+
else:
144
+
dem_crosses_antimeridian=False
145
+
# run a basic to check if the bounds likely cross the antimeridian but
146
+
# are just formatted wrong. If so, warn the user.
147
+
ifbounds_src_crs==4326:
148
+
ifcheck_bounds_likely_cross_antimeridian(bounds):
149
+
logging.warning(
150
+
"Provided bounds have very large longitude extent. If the shape crosses the "
151
+
f"antimeridian, reformat the bounds as : ({bounds[2]}, {bounds[1]}, {bounds[0]}, {bounds[3]}). "
152
+
"For large areas, provide the inputs bounds in 3031 to avoid transform errors between "
153
+
"coordinate systems."
154
+
)
155
+
128
156
ifbounds_src_crs!=REMA_CRS:
129
157
logging.warning(
130
158
f"Transforming bounds from {bounds_src_crs} to {REMA_CRS}. This may return data beyond the requested bounds. If this is not desired, provide the bounds in EPSG:{REMA_CRS}."
f"Skipping geoid download. The existing geoid file covers the DEM bounds. Existing geoid file: {geoid_tif_path}."
256
-
)
257
-
else:
258
-
logging.info(
259
-
f"The existing geoid file does not cover the DEM bounds. A new geoid file covering the bounds will be downloaded, overwriting the existing geiod file: {geoid_tif_path}."
f"Skipping geoid download. The existing geoid file covers the DEM bounds. Existing geoid file: {geoid_path}."
335
+
)
336
+
else:
337
+
logging.info(
338
+
f"The existing geoid file does not cover the DEM bounds. A new geoid file covering the bounds will be downloaded, overwriting the existing geiod file: {geoid_tif_path}."
0 commit comments