spymicmac.data#
spymicmac.data is a collection of tools for handling external datasets
Note
Make sure that you have followed the setup instructions to be able to use the USGS M2M API,
otherwise methods such as spymicmac.data.get_usgs_footprints() will not work.
usgs footprints and metadata#
- spymicmac.data.get_usgs_footprints(imlist, dataset='DECLASSII')[source]#
Search for a list of images on USGS Earth Explorer.
Note that the image names should be the USGS Entity ID (e.g., AR5840034159994 rather than AR5840034159994.tif).
- Parameters:
imlist (list | str) – a list of USGS Entity IDs.
dataset (str) – the USGS dataset name to search (default: DECLASSII).
- Returns:
a GeoDataFrame of image footprints.
- Return type:
GeoDataFrame
reference DEMs#
- spymicmac.data.download_cop30_vrt(imlist=None, footprints=None, imgsource='DECLASSII', globstr='OIS*.tif', crs=None, to_ellipsoid=True)[source]#
Create a VRT using Copernicus 30m DSM tiles that intersect image footprints. Creates Copernicus_DSM.vrt using files downloaded to cop30_dem/ within the current directory.
- Parameters:
imlist (list | None) – a list of image filenames. If None, uses globstr to search for images in the current directory.
footprints (str | Path | GeoDataFrame | Polygon | None) – a filename for a vector dataset of image footprints, a GeoDataFrame of image footprints, or a Polygon of an image footprint in WGS84 lat/lon. If None, uses spymicmac.data.get_usgs_footprints to download footprints based on imlist.
imgsource (str) – the EarthExplorer Dataset name for the images
globstr (str) – the search string to use to find images in the current directory.
crs (CRS | str | int | None) – a CRS representation recognized by geoutils.Raster.reproject to re-project the raster to. If None, CRS remains WGS84 Lat/Lon (EPSG:4326).
to_ellipsoid (bool) – convert the elevations from height above EGM2008 Geoid to height above WGS84 Ellipsoid.
- Return type:
None
- spymicmac.data.download_pgc_mosaic(flavor, imlist=None, footprints=None, imgsource='DECLASSII', globstr='OIS*.tif', res='2m', crs=None, write_urls=False)[source]#
Download either the latest ArcticDEM or REMA mosaic tiles that intersect image footprints. Downloads .tar.gz files to a corresponding folder and creates a VRT file in the current directory.
- Parameters:
flavor (str) – Which PGC product to download. Must be one of [adem, rema].
imlist (list | None) – a list of image filenames. If None, uses globstr to search for images in the current directory.
footprints (str | Path | GeoDataFrame | None) – a filename for a vector dataset of image footprints, a GeoDataFrame of image footprints, or a Polygon of an image footprint in WGS84 lat/lon. If None, uses spymicmac.data.get_usgs_footprints to download footprints based on imlist.
imgsource (str) – the EarthExplorer Dataset name for the images (default: DECLASSII)
globstr (str) – the search string to use to find images in the current directory.
res (str) – the DEM resolution to download. Options are 2m, 10m, or 32m (default: 2m)
crs (CRS | str | int | None) – an optional CRS representation recognized by geoutils.Raster.reproject to re-project the raster to.
write_urls (bool) – write a text file with the urls for each tile, for downloading using curl, wget, etc., instead of via python (default: False)