From 67fac697f1c822a9a30aad79eec9310ebe53a065 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Sep 2025 19:46:03 +0000 Subject: [PATCH 01/18] Bump actions/setup-python from 5 to 6 Bumps [actions/setup-python](https://github.com/actions/setup-python) from 5 to 6. - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/setup-python dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build-and-deploy-test.yml | 2 +- .github/workflows/build-and-deploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy-test.yml b/.github/workflows/build-and-deploy-test.yml index 4954161..3c716ef 100644 --- a/.github/workflows/build-and-deploy-test.yml +++ b/.github/workflows/build-and-deploy-test.yml @@ -14,7 +14,7 @@ jobs: - name: Checkout lastest tagged version run: git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.x" - name: Install pypa/build diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 6b2ceef..1413418 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -14,7 +14,7 @@ jobs: - name: Checkout lastest tagged version run: git checkout $(git describe --tags $(git rev-list --tags --max-count=1)) - name: Set up Python - uses: actions/setup-python@v5 + uses: actions/setup-python@v6 with: python-version: "3.x" - name: Install pypa/build From 98b5920fcd156d3a3b2b6a2f1adb68d367875795 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 19:15:06 +0000 Subject: [PATCH 02/18] Bump ASFHyP3/actions/.github/workflows/reusable-ruff.yml Bumps [ASFHyP3/actions/.github/workflows/reusable-ruff.yml](https://github.com/asfhyp3/actions) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/asfhyp3/actions/releases) - [Changelog](https://github.com/ASFHyP3/actions/blob/develop/CHANGELOG.md) - [Commits](https://github.com/asfhyp3/actions/compare/v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: ASFHyP3/actions/.github/workflows/reusable-ruff.yml dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/static-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index e72b3ae..11459d7 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -9,4 +9,4 @@ jobs: call-ruff-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.20.0 + uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.21.0 From 17aca0a2f6cffeb00ddca122612d2aa2fe35b19a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 19:15:08 +0000 Subject: [PATCH 03/18] Bump ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml Bumps [ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml](https://github.com/asfhyp3/actions) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/asfhyp3/actions/releases) - [Changelog](https://github.com/ASFHyP3/actions/blob/develop/CHANGELOG.md) - [Commits](https://github.com/asfhyp3/actions/compare/v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/release-checklist-comment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-checklist-comment.yml b/.github/workflows/release-checklist-comment.yml index a2bb05d..f2f91db 100644 --- a/.github/workflows/release-checklist-comment.yml +++ b/.github/workflows/release-checklist-comment.yml @@ -10,7 +10,7 @@ on: jobs: call-release-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.20.0 + uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.21.0 permissions: pull-requests: write secrets: From b7616ef604d0b4dea8c8029e92ddf72a210ea9ec Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 19:15:10 +0000 Subject: [PATCH 04/18] Bump ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml Bumps [ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml](https://github.com/asfhyp3/actions) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/asfhyp3/actions/releases) - [Changelog](https://github.com/ASFHyP3/actions/blob/develop/CHANGELOG.md) - [Commits](https://github.com/asfhyp3/actions/compare/v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/labeled-pr.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labeled-pr.yml b/.github/workflows/labeled-pr.yml index d729153..2ac151a 100644 --- a/.github/workflows/labeled-pr.yml +++ b/.github/workflows/labeled-pr.yml @@ -13,4 +13,4 @@ on: jobs: call-labeled-pr-check-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.20.0 + uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.21.0 From d44b722b694d581b048351471959840c6e59832f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 19:15:11 +0000 Subject: [PATCH 05/18] Bump ASFHyP3/actions/.github/workflows/reusable-bump-version.yml Bumps [ASFHyP3/actions/.github/workflows/reusable-bump-version.yml](https://github.com/asfhyp3/actions) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/asfhyp3/actions/releases) - [Changelog](https://github.com/ASFHyP3/actions/blob/develop/CHANGELOG.md) - [Commits](https://github.com/asfhyp3/actions/compare/v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/tag-version.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 1bfc245..a016f41 100644 --- a/.github/workflows/tag-version.yml +++ b/.github/workflows/tag-version.yml @@ -8,7 +8,7 @@ on: jobs: call-bump-version-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.20.0 + uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.21.0 with: user: forrest-bot email: ffwilliams2@alaska.edu From ec62897be337fbcba6c30b944560a414e24b7d5e Mon Sep 17 00:00:00 2001 From: Alex-Lewandowski Date: Thu, 22 Jan 2026 14:55:15 -0900 Subject: [PATCH 06/18] update NISAR DEM endpoints and add informative error handling to fetch.download_file() --- src/multirtc/dem.py | 6 +++--- src/multirtc/fetch.py | 28 ++++++++++++++++++++-------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/src/multirtc/dem.py b/src/multirtc/dem.py index f071570..73fa7ca 100644 --- a/src/multirtc/dem.py +++ b/src/multirtc/dem.py @@ -15,7 +15,7 @@ gdal.UseExceptions() -URL = 'https://nisar.asf.earthdatacloud.nasa.gov/STATIC/DEM/v1.1/EPSG4326' +URL = 'https://nisar.asf.earthdatacloud.nasa.gov/NISAR/DEM/v1.2/EPSG4326' EGM2008_GEOID = { 'WORLD': [ '/vsicurl/https://asf-dem-west.s3.amazonaws.com/GEOID/us_nga_egm2008_1.tif', @@ -133,8 +133,8 @@ def get_dem_granule_url(lat: int, lon: int) -> str: lon_tens = np.floor_divide(lon, 20) * 20 lon_cardinal = 'W' if lon_tens < 0 else 'E' - prefix = f'{lat_cardinal}{np.abs(lat_tens):02d}_{lon_cardinal}{np.abs(lon_tens):03d}' - filename = f'DEM_{lat_cardinal}{np.abs(lat):02d}_00_{lon_cardinal}{np.abs(lon):03d}_00.tif' + prefix = f'{lat_cardinal}{np.abs(lat_tens):02d}/{lat_cardinal}{np.abs(lat_tens):02d}_{lon_cardinal}{np.abs(lon_tens):03d}' + filename = f'DEM_{lat_cardinal}{np.abs(lat):02d}_00_{lon_cardinal}{np.abs(lon):03d}_00_C01.tif' file_url = f'{URL}/{prefix}/{filename}' return file_url diff --git a/src/multirtc/fetch.py b/src/multirtc/fetch.py index 2f50081..2a5ed43 100644 --- a/src/multirtc/fetch.py +++ b/src/multirtc/fetch.py @@ -63,13 +63,25 @@ def download_file( session.mount('https://', HTTPAdapter(max_retries=retry_strategy)) session.mount('http://', HTTPAdapter(max_retries=retry_strategy)) - with session.get(url, stream=True) as s: - download_path = _get_download_path(s.url, s.headers.get('content-disposition'), directory) - s.raise_for_status() - with open(download_path, 'wb') as f: - for chunk in s.iter_content(chunk_size=chunk_size): - if chunk: - f.write(chunk) - session.close() + try: + with session.get(url, stream=True) as s: + download_path = _get_download_path(s.url, s.headers.get('content-disposition'), directory) + s.raise_for_status() + bytes_written = 0 + with open(download_path, 'wb') as f: + for chunk in s.iter_content(chunk_size=chunk_size): + if chunk: + f.write(chunk) + bytes_written += len(chunk) + if bytes_written == 0: + msg = f'Downloaded 0 bytes from {url}' + logging.error(msg) + return '' + logging.info(f'Download successful: {url}') + except requests.exceptions.RequestException as e: + logging.exception('Download failed: {url}, {e}') + return '' + finally: + session.close() return str(download_path) From 37f22a2b16c6bf93046f0853f8dea97588990a9f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 22:51:59 +0000 Subject: [PATCH 07/18] Bump ASFHyP3/actions/.github/workflows/reusable-pytest.yml Bumps [ASFHyP3/actions/.github/workflows/reusable-pytest.yml](https://github.com/asfhyp3/actions) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/asfhyp3/actions/releases) - [Changelog](https://github.com/ASFHyP3/actions/blob/develop/CHANGELOG.md) - [Commits](https://github.com/asfhyp3/actions/compare/v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: ASFHyP3/actions/.github/workflows/reusable-pytest.yml dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/test-and-build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index 8a8e216..9b68a6e 100644 --- a/.github/workflows/test-and-build.yml +++ b/.github/workflows/test-and-build.yml @@ -13,7 +13,7 @@ on: jobs: call-pytest-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.20.0 + uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.21.0 with: local_package_name: mulitrtc python_versions: >- From eba711c193e9a22e5c994147cc0adb5728dfbfcb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 22:52:04 +0000 Subject: [PATCH 08/18] Bump actions/checkout from 5 to 6 Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/build-and-deploy-test.yml | 2 +- .github/workflows/build-and-deploy.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-deploy-test.yml b/.github/workflows/build-and-deploy-test.yml index 3c716ef..7b4efe9 100644 --- a/.github/workflows/build-and-deploy-test.yml +++ b/.github/workflows/build-and-deploy-test.yml @@ -8,7 +8,7 @@ jobs: name: Build and publish Python distributions TestPyPI runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Checkout lastest tagged version diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index 1413418..36087cc 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -8,7 +8,7 @@ jobs: name: Build and publish Python distributions to PyPI runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 with: fetch-depth: 0 - name: Checkout lastest tagged version From 71e7d09232ee685c21a5a2f3dd027846306965fc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 22:52:06 +0000 Subject: [PATCH 09/18] Bump ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml Bumps [ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml](https://github.com/asfhyp3/actions) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/asfhyp3/actions/releases) - [Changelog](https://github.com/ASFHyP3/actions/blob/develop/CHANGELOG.md) - [Commits](https://github.com/asfhyp3/actions/compare/v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/changelog.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 5360e08..4c8adbf 100644 --- a/.github/workflows/changelog.yml +++ b/.github/workflows/changelog.yml @@ -14,4 +14,4 @@ on: jobs: call-changelog-check-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.20.0 + uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.21.0 From 26aa5f9816e6483da3fb0524a5c64ea2f0f5a1bc Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 22:52:09 +0000 Subject: [PATCH 10/18] Bump ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml Bumps [ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml](https://github.com/asfhyp3/actions) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/asfhyp3/actions/releases) - [Changelog](https://github.com/ASFHyP3/actions/blob/develop/CHANGELOG.md) - [Commits](https://github.com/asfhyp3/actions/compare/v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/static-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 11459d7..109e826 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -5,7 +5,7 @@ on: push jobs: call-secrets-analysis-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.20.0 + uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.21.0 call-ruff-workflow: # Docs: https://github.com/ASFHyP3/actions From b21b1dfb8973e1fa292dd8d9fe975a9f2a5a11f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Feb 2026 22:52:11 +0000 Subject: [PATCH 11/18] Bump ASFHyP3/actions/.github/workflows/reusable-release.yml Bumps [ASFHyP3/actions/.github/workflows/reusable-release.yml](https://github.com/asfhyp3/actions) from 0.20.0 to 0.21.0. - [Release notes](https://github.com/asfhyp3/actions/releases) - [Changelog](https://github.com/ASFHyP3/actions/blob/develop/CHANGELOG.md) - [Commits](https://github.com/asfhyp3/actions/compare/v0.20.0...v0.21.0) --- updated-dependencies: - dependency-name: ASFHyP3/actions/.github/workflows/reusable-release.yml dependency-version: 0.21.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f49fd13..455b638 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ on: jobs: call-release-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.20.0 + uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.21.0 with: release_prefix: MultiRTC release_branch: main From 5af5b0eb006b98ea08e308af5000125d08c40d82 Mon Sep 17 00:00:00 2001 From: Alex-Lewandowski Date: Tue, 10 Feb 2026 18:13:21 -0900 Subject: [PATCH 12/18] update CHANGELOG, OPERA DEM -> Copernicus DEM for NISAR, raise exceptions and delete partial downloads in fetch.py --- CHANGELOG.md | 5 +++++ src/multirtc/dem.py | 6 +++--- src/multirtc/fetch.py | 11 +++++------ tests/test_dem.py | 2 +- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1aa7a59..7d02093 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.5.3] +* Change "OPERA DEM" references to "Copernicus DEM for NISAR" +* Update Copernicus DEM for NISAR endpoints for v1.2 +* Add `fetch.download_file()` exception handling and delete partial downloads + ## [0.5.2] ### Fixed diff --git a/src/multirtc/dem.py b/src/multirtc/dem.py index 73fa7ca..a880b07 100644 --- a/src/multirtc/dem.py +++ b/src/multirtc/dem.py @@ -118,7 +118,7 @@ def check_antimeridean(poly: Polygon) -> list[Polygon]: def get_dem_granule_url(lat: int, lon: int) -> str: - """Generate the URL for the OPERA DEM granule based on latitude and longitude. + """Generate the URL for the Copernicus DEM for NISAR granule based on latitude and longitude. Args: lat: Latitude in degrees. @@ -134,7 +134,7 @@ def get_dem_granule_url(lat: int, lon: int) -> str: lon_cardinal = 'W' if lon_tens < 0 else 'E' prefix = f'{lat_cardinal}{np.abs(lat_tens):02d}/{lat_cardinal}{np.abs(lat_tens):02d}_{lon_cardinal}{np.abs(lon_tens):03d}' - filename = f'DEM_{lat_cardinal}{np.abs(lat):02d}_00_{lon_cardinal}{np.abs(lon):03d}_00_C01.tif' + filename = f'DEM{lat_cardinal}{np.abs(lat):02d}_00_{lon_cardinal}{np.abs(lon):03d}_00_C01.tif' file_url = f'{URL}/{prefix}/{filename}' return file_url @@ -156,7 +156,7 @@ def get_latlon_pairs(polygon: Polygon) -> list[tuple[float, float]]: def download_opera_dem_for_footprint(output_path: Path, footprint: Polygon, buffer: float = 0.2) -> None: """ - Download the OPERA DEM for a given footprint and save it to the specified output path. + Download the Copernicus DEM for NISAR for a given footprint and save it to the specified output path. Args: output_path: Path where the DEM will be saved. diff --git a/src/multirtc/fetch.py b/src/multirtc/fetch.py index 2a5ed43..99040da 100644 --- a/src/multirtc/fetch.py +++ b/src/multirtc/fetch.py @@ -63,6 +63,7 @@ def download_file( session.mount('https://', HTTPAdapter(max_retries=retry_strategy)) session.mount('http://', HTTPAdapter(max_retries=retry_strategy)) + download_path = None try: with session.get(url, stream=True) as s: download_path = _get_download_path(s.url, s.headers.get('content-disposition'), directory) @@ -73,14 +74,12 @@ def download_file( if chunk: f.write(chunk) bytes_written += len(chunk) - if bytes_written == 0: - msg = f'Downloaded 0 bytes from {url}' - logging.error(msg) - return '' logging.info(f'Download successful: {url}') except requests.exceptions.RequestException as e: - logging.exception('Download failed: {url}, {e}') - return '' + logging.exception(f'Download failed: {url}') + if download_path is not None: + download_path.unlink(missing_ok=True) # delete any partial downloads + raise finally: session.close() diff --git a/tests/test_dem.py b/tests/test_dem.py index f0c3576..3a782b8 100644 --- a/tests/test_dem.py +++ b/tests/test_dem.py @@ -4,7 +4,7 @@ def test_get_granule_url(): - test_url = 'https://nisar.asf.earthdatacloud.nasa.gov/STATIC/DEM/v1.1/EPSG4326/S10_W020/DEM_S01_00_W001_00.tif' + test_url = 'https://nisar.asf.earthdatacloud.nasa.gov/NISAR/DEM/v1.2/EPSG4326/S10/S10_W020/DEMS01_00_W001_00_C01.tif' url = dem.get_dem_granule_url(-1, -1) assert url == test_url From 3c5ea80a7de6af51ff6adfe64ac78813f5455ca4 Mon Sep 17 00:00:00 2001 From: Alex-Lewandowski Date: Tue, 10 Feb 2026 18:16:17 -0900 Subject: [PATCH 13/18] remove now unused bytes_written from download_file() --- src/multirtc/fetch.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/multirtc/fetch.py b/src/multirtc/fetch.py index 99040da..1719f56 100644 --- a/src/multirtc/fetch.py +++ b/src/multirtc/fetch.py @@ -68,12 +68,10 @@ def download_file( with session.get(url, stream=True) as s: download_path = _get_download_path(s.url, s.headers.get('content-disposition'), directory) s.raise_for_status() - bytes_written = 0 with open(download_path, 'wb') as f: for chunk in s.iter_content(chunk_size=chunk_size): if chunk: f.write(chunk) - bytes_written += len(chunk) logging.info(f'Download successful: {url}') except requests.exceptions.RequestException as e: logging.exception(f'Download failed: {url}') From afc47013bc71ef59ceccb8f7a44e408f5969f18d Mon Sep 17 00:00:00 2001 From: Alex-Lewandowski Date: Tue, 10 Feb 2026 18:22:58 -0900 Subject: [PATCH 14/18] Copernicus DEM for NISAR -> Modified Copernicus DEM for NISAR --- CHANGELOG.md | 4 ++-- src/multirtc/dem.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d02093..89781fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,8 +7,8 @@ and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.5.3] -* Change "OPERA DEM" references to "Copernicus DEM for NISAR" -* Update Copernicus DEM for NISAR endpoints for v1.2 +* Change "OPERA DEM" references to "Modified Copernicus DEM for NISAR" +* Update Modified Copernicus DEM for NISAR endpoints for v1.2 * Add `fetch.download_file()` exception handling and delete partial downloads ## [0.5.2] diff --git a/src/multirtc/dem.py b/src/multirtc/dem.py index a880b07..c7e818f 100644 --- a/src/multirtc/dem.py +++ b/src/multirtc/dem.py @@ -118,7 +118,7 @@ def check_antimeridean(poly: Polygon) -> list[Polygon]: def get_dem_granule_url(lat: int, lon: int) -> str: - """Generate the URL for the Copernicus DEM for NISAR granule based on latitude and longitude. + """Generate the URL for the Modified Copernicus DEM for NISAR granule based on latitude and longitude. Args: lat: Latitude in degrees. @@ -156,7 +156,7 @@ def get_latlon_pairs(polygon: Polygon) -> list[tuple[float, float]]: def download_opera_dem_for_footprint(output_path: Path, footprint: Polygon, buffer: float = 0.2) -> None: """ - Download the Copernicus DEM for NISAR for a given footprint and save it to the specified output path. + Download the Modified Copernicus DEM for NISAR for a given footprint and save it to the specified output path. Args: output_path: Path where the DEM will be saved. From 20f7e2df0908b5168ae4abf516514de7b75b340f Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Sat, 21 Feb 2026 15:08:11 -0600 Subject: [PATCH 15/18] fix changelog --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89781fc..e4f1b9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [PEP 440](https://www.python.org/dev/peps/pep-0440/) and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [0.5.3] + +### Changed * Change "OPERA DEM" references to "Modified Copernicus DEM for NISAR" * Update Modified Copernicus DEM for NISAR endpoints for v1.2 * Add `fetch.download_file()` exception handling and delete partial downloads From 2dc9295cb44af7f8d1bca93ab7e718584f5d5cb9 Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Sat, 21 Feb 2026 15:18:09 -0600 Subject: [PATCH 16/18] fix ruff --- src/multirtc/fetch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/multirtc/fetch.py b/src/multirtc/fetch.py index 1719f56..11b5cfd 100644 --- a/src/multirtc/fetch.py +++ b/src/multirtc/fetch.py @@ -73,7 +73,7 @@ def download_file( if chunk: f.write(chunk) logging.info(f'Download successful: {url}') - except requests.exceptions.RequestException as e: + except requests.exceptions.RequestException: logging.exception(f'Download failed: {url}') if download_path is not None: download_path.unlink(missing_ok=True) # delete any partial downloads From 340da90f04f9cba4089c856a4cd100561f893918 Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Sat, 21 Feb 2026 15:23:16 -0600 Subject: [PATCH 17/18] fix ruff --- src/multirtc/fetch.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/multirtc/fetch.py b/src/multirtc/fetch.py index 11b5cfd..ba3516a 100644 --- a/src/multirtc/fetch.py +++ b/src/multirtc/fetch.py @@ -76,7 +76,7 @@ def download_file( except requests.exceptions.RequestException: logging.exception(f'Download failed: {url}') if download_path is not None: - download_path.unlink(missing_ok=True) # delete any partial downloads + download_path.unlink(missing_ok=True) # delete any partial downloads raise finally: session.close() From fb0ff3a63dddfafe9d60dd11a899cd0dbdd9bb23 Mon Sep 17 00:00:00 2001 From: Forrest Williams Date: Sat, 21 Feb 2026 15:31:41 -0600 Subject: [PATCH 18/18] fix ruff --- tests/test_dem.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/test_dem.py b/tests/test_dem.py index 3a782b8..c6735dc 100644 --- a/tests/test_dem.py +++ b/tests/test_dem.py @@ -4,7 +4,9 @@ def test_get_granule_url(): - test_url = 'https://nisar.asf.earthdatacloud.nasa.gov/NISAR/DEM/v1.2/EPSG4326/S10/S10_W020/DEMS01_00_W001_00_C01.tif' + test_url = ( + 'https://nisar.asf.earthdatacloud.nasa.gov/NISAR/DEM/v1.2/EPSG4326/S10/S10_W020/DEMS01_00_W001_00_C01.tif' + ) url = dem.get_dem_granule_url(-1, -1) assert url == test_url