Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

new Copernicus DEM download option #239

Open
johntruckenbrodt opened this issue Feb 1, 2023 · 2 comments
Open

new Copernicus DEM download option #239

johntruckenbrodt opened this issue Feb 1, 2023 · 2 comments

Comments

@johntruckenbrodt
Copy link
Owner

The data can now be downloaded from Copernicus without authentication:
https://sentinel.esa.int/web/sentinel/-/copernicus-dem-new-direct-data-download-access

This option should be added to function pyroSAR.auxdata.dem_autoload.

@MarkusZehner
Copy link
Contributor

Maybe of interest: cubo can get Cop GLO 30 from Planetary Computer, but I don't know if that requires an access token.
The export is in UTM coordinates by default.

import os
import cubo
from rasterio.enums import Resampling


def load_dem_data(dem_path, lat, lon, edge_size, resolution):
    if not os.path.exists(dem_path):
        print('Downloading DEM')
        dem = cubo.create(
            lat=lat,  # Central latitude of the cube
            lon=lon,  # Central longitude of the cube
            collection="cop-dem-glo-30",  # Name of the STAC collection
            # bands=["B02","B03","B04"],
            bands=["data"],  # Bands to retrieve
            start_date="2000-01-01",  # Start date of the cube
            end_date="2024-01-06",  # End date of the cube
            edge_size=edge_size,  # Edge size of the cube (px)
            resolution=resolution,  # Pixel size of the cube (m)
            stackstac_kw={'resampling': Resampling.cubic},  # kwargs passed to stackstac
        )
        if "time" in dem.dims:
            dem = dem.mean(dim='time')
        dem.rio.write_crs(dem.epsg.values, inplace=True)
        dem.isel(band=0).rio.to_raster(dem_path)
    else:
        print('DEM exists')

@johntruckenbrodt
Copy link
Owner Author

Thanks @MarkusZehner. Using cubo for this would be overkill in pyroSAR but it is good to know how others do it and what other sources exist. As long as there are authentication-free sources I prefer sticking to them though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants