spymicmac.data

spymicmac.data is a collection of tools for handling external datasets

spymicmac.data.download_cop30_vrt(imlist=None, footprints=None, imgsource='DECLASSII', globstr='OIS*.tif')[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) – a list of image filenames. If None, uses globstr to search for images in the current directory.

  • footprints (GeoDataFrame|Polygon) – a GeoDataFrame of image footprints, or a Polygon of an image footprint in WGS84 lat/lon. If None, uses spymicmac.usgs.get_usgs_footprints to download footprints based on imlist.

  • imgsource (str) – the EE Dataset name for the images (default: DECLASSII)

  • globstr (str) – the search string to use to find images in the current directory.

spymicmac.data.download_pgc_mosaic(flavor, imlist=None, footprints=None, imgsource='DECLASSII', globstr='OIS*.tif', res='2m', 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) – a list of image filenames. If None, uses globstr to search for images in the current directory.

  • footprints (GeoDataFrame) – a GeoDataFrame of image footprints. If None, uses spymicmac.usgs.get_usgs_footprints to download footprints based on imlist.

  • imgsource (str) – the EE 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)

  • 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)

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) – a list of image names.

  • dataset (str) – the USGS dataset name to search (default: DECLASSII).

Returns:

footprints (GeoDataFrame) – a GeoDataFrame of image footprints.

spymicmac.data.landsat_to_gdf(results)[source]

Convert USGS Landsat search results to a GeoDataFrame

Parameters:

results (list) – a list of results (i.e., the ‘data’ value returned by api.scene_metadata)

Returns:

meta_gdf (geopandas.GeoDataFrame) - a GeoDataFrame of search results

spymicmac.data.to_wgs84_ellipsoid(fn_dem)[source]

Convert a DEM to WGS84 ellipsoid heights, using the EGM08 Geoid.

Parameters:

fn_dem (str) – the filename of the DEM to convert.