dem_mask¶
Identify control surfaces for DEM co-registration
usage: dem_mask [-h] [--toa] [--toa_thresh TOA_THRESH] [--snodas]
[--snodas_thresh SNODAS_THRESH] [--modscag]
[--modscag_thresh MODSCAG_THRESH]
[--bareground_thresh BAREGROUND_THRESH] [--no_icemask]
[--filter {rock,rock+ice,rock+ice+water,not_forest}]
[--dilate DILATE]
dem_fn
- Required Arguments
dem_fn DEM filename - Optional Arguments
--toa=False Use top-of-atmosphere reflectance values (requires pregenerated “dem_fn_toa.tif”) --toa_thresh=0.4 Top-of-atmosphere reflectance threshold (default: 0.4, valid range 0.0-1.0), mask values greater than this value --snodas=False Use SNODAS snow depth products --snodas_thresh=0.2 SNODAS snow depth threshold (default: 0.2 m), mask values greater than this value --modscag=False Use MODSCAG fractional snow cover products --modscag_thresh=50 MODSCAG fractional snow cover percent threshold (default: 50%, valid range 0-100), mask greater than this value --bareground_thresh=80 Percent bareground threshold (default: 80%, valid range 0-100), mask greater than this value (only relevant for global bareground data) --no_icemask=False Don’t mask glacier polygons --filter="rock+ice+water" Preserve these LULC pixels (default: “rock+ice+water”)
Possible choices: rock, rock+ice, rock+ice+water, not_forest
--dilate Dilate mask with this many iterations (default: None)
Utility to automate reference surface identification for raster co-registration
Note: Initial run may take a long time to download and process required data (NLCD, global bareground, glacier polygons)
Can control location of these data files with DATADIR environmental variable
export DATADIR=dir
Dependencies: gdal, wget, requests, bs4
-
demcoreg.dem_mask.
get_bareground
(datadir=None)[source]¶ Calls external shell script get_bareground.sh to fetch:
~2010 global bare ground, 30 m
Note: unzipped file size is 64 GB! Original products are uncompressed, and tiles are available globally (including empty data over ocean)
The shell script will compress all downloaded tiles using lossless LZW compression.
http://landcover.usgs.gov/glc/BareGroundDescriptionAndDownloads.php
-
demcoreg.dem_mask.
get_glacier_poly
(datadir=None)[source]¶ Calls external shell script get_glacier_poly.sh to fetch:
Randolph Glacier Inventory (RGI) glacier outline shapefiles
Full RGI database: rgi50.zip is 410 MB
The shell script will unzip and merge regional shp into single global shp
-
demcoreg.dem_mask.
get_icemask
(ds, datadir=None, glac_shp_fn=None)[source]¶ Generate glacier polygon raster mask for input Dataset res/extent
-
demcoreg.dem_mask.
get_modis_tile_list
(geom)[source]¶ Helper function to identify MODIS tiles that intersect input geometry
modis_gird.py contains dictionary of tile boundaries (tile name and WKT polygon ring from bbox)
-
demcoreg.dem_mask.
get_modscag
(dem_dt, outdir=None, tile_list=('h08v04', 'h09v04', 'h10v04', 'h08v05', 'h09v05'), pad_days=7)[source]¶ Function to fetch and process MODSCAG fractional snow cover products for input datetime
Products are tiled in MODIS sinusoidal projection
example url: https://snow-data.jpl.nasa.gov/modscag-historic/2015/001/MOD09GA.A2015001.h07v03.005.2015006001833.snow_fraction.tif
-
demcoreg.dem_mask.
get_nlcd
(datadir=None)[source]¶ Calls external shell script get_nlcd.sh to fetch:
2011 Land Use Land Cover (nlcd) grids, 30 m
-
demcoreg.dem_mask.
get_snodas
(dem_dt, outdir=None)[source]¶ Function to fetch and process SNODAS snow depth products for input datetime
http://nsidc.org/data/docs/noaa/g02158_snodas_snow_cover_model/index.html
1036 is snow depth
filename format: us_ssmv11036tS__T0001TTNATS2015042205HP001.Hdr
-
demcoreg.dem_mask.
mask_bareground
(ds, minperc=80, mask_glaciers=True)[source]¶ Generate raster mask for exposed bare ground from global bareground data