Skip to content

Commit

Permalink
stripmapStack.createWaterMask: skip re-dload if wbd file exists
Browse files Browse the repository at this point in the history
  • Loading branch information
yunjunz authored and yuankailiu committed Feb 17, 2022
1 parent 42b2773 commit 530eb04
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions contrib/stack/stripmapStack/createWaterMask.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 530eb04

Please sign in to comment.