def get_lulc_source(ds):
"""For a given input dataset extent, select the appropriate mask source (NLCD vs. global bareground)
"""
ds_geom = geolib.ds_geom(ds)
lulc_fn = get_nlcd_fn()
lulc_ds = gdal.Open(lulc_fn)
lulc_geom = geolib.ds_geom(lulc_ds)
#If the dem geom is within CONUS (nlcd extent), use it
geolib.geom_transform(ds_geom, t_srs=lulc_geom.GetSpatialReference())
if lulc_geom.Contains(ds_geom):
print("Using NLCD 30m data for rockmask")
lulc_source = 'nlcd'
else:
print("Using global 30m bare ground data for rockmask")
#Otherwise for Global, use 30 m Bare Earth percentage
lulc_source = 'bareground'
#lulc_fn = get_bareground_fn()
#lulc_ds = gdal.Open(lulc_fn)
return lulc_source
评论列表
文章目录