Merge pull request #400 from yunjunz/wbd

stripmapStack.createWaterMask: skip re-dload if wbd file exists
LT1AB
Ryan Burns 2021-11-29 14:49:56 -08:00 committed by GitHub
commit cfe35f07e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 3 deletions

View File

@ -86,19 +86,25 @@ def download_waterMask(bbox, dem_file, fill_value=-1):
out_dir = os.path.dirname(dem_file)
if not bbox:
bbox = dem2bbox(dem_file)
print('bounding box in (S, N, W, E): {}'.format(bbox))
sw = createManager('wbd')
sw.configure()
#inps.waterBodyGeo = sw.defaultName(inps.bbox)
sw.outputFile = os.path.join(out_dir, sw.defaultName(bbox))
sw._noFilling = False
sw._fillingValue = fill_value
sw.stitch(bbox[0:2], bbox[2:])
if os.path.isfile(sw.outputFile):
print('wbd file already exists at: {}'.format(sw.outputFile))
print('skip re-downloading and continue')
else:
sw._noFilling = False
sw._fillingValue = fill_value
sw.stitch(bbox[0:2], bbox[2:])
return sw.outputFile
def geo2radar(geo_file, rdr_file, lat_file, lon_file):
#inps.waterBodyRadar = inps.waterBodyGeo + '.rdr'
print('converting water mask file to radar coordinates ...')
sw = SWBDStitcher()
sw.toRadar(geo_file, lat_file, lon_file, rdr_file)
return rdr_file