Skip to content

Commit

Permalink
Merge pull request #8 from scottstanie/gdal-fixes
Browse files Browse the repository at this point in the history
Gdal fixes
  • Loading branch information
scottstanie authored Aug 13, 2022
2 parents f75df52 + ec9dfd5 commit f31d9b3
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
14 changes: 10 additions & 4 deletions sardem/cop_dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,17 @@ def download_and_stitch(
# Used the __RETURN_OPTION_LIST__ to get the list of options for debugging
logger.info("Creating {}".format(output_name))
logger.info("Fetching remote tiles...")
cmd = _gdal_cmd_from_options(vrt_filename, output_name, option_dict)
logger.info("Running GDAL command:")
try:
cmd = _gdal_cmd_from_options(vrt_filename, output_name, option_dict)
logger.info("Running GDAL command:")
logger.info(cmd)
except Exception:
# Can't form the cli version due to `deepcopy` Pickle error, just skip
logger.info("Running gdal Warp with options:")
logger.info(option_dict)
pass
# Now convert to something GDAL can actually use
option_dict["callback"] = gdal.TermProgress
logger.info(cmd)
# Now convert to something GDAL can actuall use
gdal.Warp(output_name, vrt_filename, options=gdal.WarpOptions(**option_dict))
return

Expand Down
4 changes: 3 additions & 1 deletion sardem/dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,9 @@ def main(

if make_isce_xml:
logger.info("Creating ISCE2 XML file")
utils.gdal2isce_xml(output_name, keep_egm=keep_egm, shift_rsc=using_gdal_bounds)
utils.gdal2isce_xml(
output_name, keep_egm=keep_egm, using_gdal_bounds=using_gdal_bounds
)

if keep_egm or data_source == "NASA_WATER":
logger.info("Keeping DEM as EGM96 geoid heights")
Expand Down
4 changes: 2 additions & 2 deletions sardem/tests/test_dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class TestDownload(unittest.TestCase):
def setUp(self):
self.bounds = utils.bounding_box(-155.4, 19.75, 0.001, 0.001)
self.test_tile = "N19W156"
self.hgt_url = "http://e4ftl01.cr.usgs.gov/MEASURES/\
self.hgt_url = "https://e4ftl01.cr.usgs.gov/MEASURES/\
SRTMGL1.003/2000.02.11/N19W156.SRTMGL1.hgt.zip"

sample_hgt_path = join(DATAPATH, self.test_tile + ".hgt.zip")
Expand All @@ -52,7 +52,7 @@ def tearDown(self):
def test_init(self):
d = download.Downloader([self.test_tile], netrc_file=NETRC_PATH)
self.assertEqual(
d.data_url, "http://e4ftl01.cr.usgs.gov/MEASURES/SRTMGL1.003/2000.02.11"
d.data_url, "https://e4ftl01.cr.usgs.gov/MEASURES/SRTMGL1.003/2000.02.11"
)

@responses.activate
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="sardem",
version="0.10.5",
version="0.10.6",
author="Scott Staniewicz",
author_email="scott.stanie@gmail.com",
description="Create upsampled DEMs for InSAR processing",
Expand Down

0 comments on commit f31d9b3

Please sign in to comment.