Skip to content

Commit

Permalink
Merge pull request #400 from yunjunz/wbd
Browse files Browse the repository at this point in the history
stripmapStack.createWaterMask: skip re-dload if wbd file exists
  • Loading branch information
rtburns-jpl authored Nov 29, 2021
2 parents 7130076 + 3b67950 commit cfe35f0
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 cfe35f0

Please sign in to comment.