@@ -52,7 +52,7 @@ def search_stac_items_planetary_computer(collection, bbox, **kwargs) -> list:
5252
5353@utils ._decorator_dataarray_to_bbox
5454def get_dem_copernicus30 (
55- bbox_WSEN : list , res_m : int = 30 , epsg = 32643 , smoothing_iters = 2 , smoothing_size = 3
55+ bbox_WSEN : list , res : int = 30 , epsg = 32643 , smoothing_iters = 2 , smoothing_size = 3
5656) -> _xr .DataArray :
5757 """
5858 Download DEM data from the STAC catalog (default is COP DEM Global 30m).
@@ -61,8 +61,8 @@ def get_dem_copernicus30(
6161 ----------
6262 bbox_WSEN : list
6363 The bounding box of the area of interest in WSEN format.
64- res_m : int
65- The resolution of the DEM data in meters .
64+ res : int
65+ The resolution of the DEM data in EPSG units .
6666 epsg : int, optional
6767 The EPSG code of the projection of the DEM data. Default is
6868 EPSG:32643 (UTM 43N) for the Pamir region.
@@ -82,13 +82,8 @@ def get_dem_copernicus30(
8282
8383 check_epsg (epsg )
8484
85- assert res_m >= 30 , (
86- "The resolution must be greater than 30m for the COP DEM Global 30m dataset."
87- )
88- res = res_m / 111_111 if epsg == 4326 else res_m
89-
9085 _logger .info (
91- f"Fetching COP DEM Global data from Planetary Computer (cop-dem-glo-30 @ { res_m } m )"
86+ f"Fetching COP DEM Global data from Planetary Computer (cop-dem-glo-30 @ { res :.2g } )"
9287 )
9388 items = search_stac_items_planetary_computer ("cop-dem-glo-30" , bbox_WSEN )
9489 da_dem = _stackstac .stack (
@@ -112,16 +107,16 @@ def get_dem_copernicus30(
112107
113108
114109@utils ._decorator_dataarray_to_bbox
115- def get_esa_land_cover (bbox_WSEN : tuple , res_m : int = 30 , epsg = 32643 ) -> _xr .DataArray :
110+ def get_esa_land_cover (bbox_WSEN : tuple , res : int = 30 , epsg = 32643 ) -> _xr .DataArray :
116111 """
117112 Get the ESA World Cover dataset on the target grid and resolution.
118113
119114 Parameters
120115 ----------
121116 bbox_WSEN : tuple
122117 Bounding box in the format (West, South, East, North).
123- res_m : int, optional
124- Resolution in meters . Defaults to 30.
118+ res : int, optional
119+ Resolution in EPSG units . Defaults to 30 (meters for UTM) .
125120 epsg : int, optional
126121 EPSG code for the coordinate reference system. Defaults to 32643.
127122
@@ -168,10 +163,10 @@ def get_land_cover_classes(item):
168163 check_epsg (epsg )
169164
170165 # get the units in the projection
171- res = get_res_in_proj_units (res_m , epsg , min_res = 10 )
166+ res = get_res_in_proj_units (res , epsg , min_res = 10 )
172167
173168 _logger .info (
174- f"Fetching ESA World Cover (v2.0) data from Planetary Computer (esa-worldcover @ { res_m } m)"
169+ f"Fetching ESA World Cover (v2.0) data from Planetary Computer (esa-worldcover @ { res } m)"
175170 )
176171 items = search_stac_items_planetary_computer (
177172 collection = "esa-worldcover" ,
@@ -210,7 +205,7 @@ def get_land_cover_classes(item):
210205
211206
212207@utils ._decorator_dataarray_to_bbox
213- def get_esri_land_cover (bbox_WSEN : tuple , res_m : int = 30 , epsg : int = 32643 ):
208+ def get_esri_land_cover (bbox_WSEN : tuple , res : int = 30 , epsg : int = 32643 ):
214209 from .utils import _long_string_processor
215210
216211 items = search_stac_items_planetary_computer (
@@ -222,7 +217,7 @@ def get_esri_land_cover(bbox_WSEN: tuple, res_m: int = 30, epsg: int = 32643):
222217 da = _stackstac .stack (
223218 items ,
224219 epsg = epsg ,
225- resolution = res_m ,
220+ resolution = res ,
226221 bounds_latlon = bbox_WSEN ,
227222 ).isel (time = 0 , band = 0 )
228223
@@ -269,7 +264,7 @@ def get_sentinel2_data(
269264 bbox_WSEN : tuple ,
270265 years = range (2018 , 2025 ),
271266 assets = ["SCL" ],
272- res_m : int = 30 ,
267+ res : int = 30 ,
273268 epsg = 32643 ,
274269 max_cloud_cover = 5 ,
275270) -> _xr .DataArray :
@@ -284,8 +279,8 @@ def get_sentinel2_data(
284279 Range of years to fetch data for. Defaults to range(2018, 2025).
285280 assets : list, optional
286281 List of assets to fetch. Defaults to ['SCL'].
287- res_m : int, optional
288- Resolution in meters . Defaults to 30.
282+ res : int, optional
283+ Resolution in EPSG units . Defaults to 30 (meters for UTM) .
289284 epsg : int, optional
290285 EPSG code for the coordinate reference system. Defaults to 32643.
291286 max_cloud_cover : int, optional
@@ -299,11 +294,9 @@ def get_sentinel2_data(
299294 from ..utils import drop_coords_without_dim
300295 from .utils import (
301296 check_epsg ,
302- get_res_in_proj_units ,
303297 )
304298
305299 check_epsg (epsg )
306- res = get_res_in_proj_units (res_m , epsg , min_res = 10 )
307300
308301 da_list = []
309302 for year in years :
@@ -348,7 +341,7 @@ def get_sentinel2_data(
348341
349342@utils ._decorator_dataarray_to_bbox
350343def get_snow_melt_doy (
351- bbox_WSEN : tuple , years = range (2018 , 2025 ), res_m : int = 30 , epsg = 32643
344+ bbox_WSEN : tuple , years = range (2018 , 2025 ), res : int = 30 , epsg = 32643
352345) -> _xr .DataArray :
353346 """
354347 Calculate the snow melt day of year (DOY) from Sentinel-2 SCL data for a given bounding box and years.
@@ -359,7 +352,7 @@ def get_snow_melt_doy(
359352 Bounding box coordinates in the format (West, South, East, North).
360353 years : range, optional
361354 Range of years to consider. Defaults to range(2018, 2025).
362- res_m : int, optional
355+ res : int, optional
363356 Spatial resolution in meters. Defaults to 30.
364357 epsg : int, optional
365358 EPSG code for the coordinate reference system. Defaults to 32643.
@@ -371,7 +364,7 @@ def get_snow_melt_doy(
371364 """
372365
373366 da = get_sentinel2_data (
374- bbox_WSEN , years = years , res_m = res_m , epsg = epsg , max_cloud_cover = 10
367+ bbox_WSEN , years = years , res = res , epsg = epsg , max_cloud_cover = 10
375368 )
376369
377370 _logger .info ("Calculating snow melt day of year (DOY) from Sentinel-2 SCL data" )
0 commit comments