|
4 | 4 | import pystac_client as _pystac_client |
5 | 5 | import planetary_computer as _planetary_computer |
6 | 6 | from .. import xr_raster_vector as _xrv # noqa |
| 7 | + from ..utils import drop_coords_without_dim |
7 | 8 | except ImportError as e: |
8 | 9 | missing_package = str(e).split("'")[1] |
9 | 10 | raise ImportError( |
@@ -85,7 +86,6 @@ def get_dem_copernicus( |
85 | 86 | xarray.DataArray |
86 | 87 | The DEM data as an xarray DataArray with attributes. |
87 | 88 | """ |
88 | | - from ..utils import drop_coords_without_dim |
89 | 89 | from .utils import check_epsg, smooth_data |
90 | 90 |
|
91 | 91 | check_epsg(epsg) |
@@ -134,7 +134,7 @@ def get_esa_land_cover(bbox_WSEN: tuple, res: int = 30, epsg=32643) -> _xr.DataA |
134 | 134 | A DataArray with the land cover data on the target grid. Contains |
135 | 135 | attributes 'class_values', 'class_descriptions', 'class_colors' for plotting. |
136 | 136 | """ |
137 | | - from .utils import _long_string_processor, check_epsg, get_res_in_proj_units |
| 137 | + from .utils import _long_string_processor, check_epsg |
138 | 138 |
|
139 | 139 | def get_land_cover_classes(item): |
140 | 140 | """ |
@@ -170,9 +170,6 @@ def get_land_cover_classes(item): |
170 | 170 | # make sure epsg is supported |
171 | 171 | check_epsg(epsg) |
172 | 172 |
|
173 | | - # get the units in the projection |
174 | | - res = get_res_in_proj_units(res, epsg, min_res=10) |
175 | | - |
176 | 173 | _logger.info( |
177 | 174 | f"Fetching ESA World Cover (v2.0) data from Planetary Computer (esa-worldcover @ {res}m)" |
178 | 175 | ) |
@@ -209,6 +206,8 @@ def get_land_cover_classes(item): |
209 | 206 | ) |
210 | 207 | ) |
211 | 208 |
|
| 209 | + da = da.pipe(drop_coords_without_dim).rio.write_crs(f"EPSG:{epsg}") |
| 210 | + |
212 | 211 | return da |
213 | 212 |
|
214 | 213 |
|
@@ -268,6 +267,7 @@ def get_esri_land_cover(bbox_WSEN: tuple, res: int = 30, epsg: int = 32643): |
268 | 267 | ), |
269 | 268 | ) |
270 | 269 |
|
| 270 | + da = da.pipe(drop_coords_without_dim).rio.write_crs(f"EPSG:{epsg}") |
271 | 271 | return da |
272 | 272 |
|
273 | 273 |
|
@@ -303,10 +303,7 @@ def get_sentinel2_data( |
303 | 303 | xr.DataArray |
304 | 304 | DataArray containing the fetched Sentinel-2 data. |
305 | 305 | """ |
306 | | - from ..utils import drop_coords_without_dim |
307 | | - from .utils import ( |
308 | | - check_epsg, |
309 | | - ) |
| 306 | + from .utils import check_epsg |
310 | 307 |
|
311 | 308 | check_epsg(epsg) |
312 | 309 |
|
|
0 commit comments