Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
67fac69
Bump actions/setup-python from 5 to 6
dependabot[bot] Sep 8, 2025
98b5920
Bump ASFHyP3/actions/.github/workflows/reusable-ruff.yml
dependabot[bot] Nov 10, 2025
17aca0a
Bump ASFHyP3/actions/.github/workflows/reusable-release-checklist-com…
dependabot[bot] Nov 10, 2025
b7616ef
Bump ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml
dependabot[bot] Nov 10, 2025
d44b722
Bump ASFHyP3/actions/.github/workflows/reusable-bump-version.yml
dependabot[bot] Nov 10, 2025
ec62897
update NISAR DEM endpoints and add informative error handling to fetc…
Alex-Lewandowski Jan 22, 2026
bd536d7
Merge pull request #50 from forrestfwilliams/dependabot/github_action…
forrestfwilliams Feb 9, 2026
15d4de1
Merge pull request #52 from forrestfwilliams/dependabot/github_action…
forrestfwilliams Feb 9, 2026
a28f787
Merge pull request #53 from forrestfwilliams/dependabot/github_action…
forrestfwilliams Feb 9, 2026
b90f379
Merge pull request #54 from forrestfwilliams/dependabot/github_action…
forrestfwilliams Feb 9, 2026
e9d97b6
Merge pull request #55 from forrestfwilliams/dependabot/github_action…
forrestfwilliams Feb 9, 2026
37f22a2
Bump ASFHyP3/actions/.github/workflows/reusable-pytest.yml
dependabot[bot] Feb 9, 2026
eba711c
Bump actions/checkout from 5 to 6
dependabot[bot] Feb 9, 2026
71e7d09
Bump ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml
dependabot[bot] Feb 9, 2026
26aa5f9
Bump ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml
dependabot[bot] Feb 9, 2026
b21b1df
Bump ASFHyP3/actions/.github/workflows/reusable-release.yml
dependabot[bot] Feb 9, 2026
12f55db
Merge pull request #62 from forrestfwilliams/dependabot/github_action…
forrestfwilliams Feb 10, 2026
a306e3f
Merge pull request #61 from forrestfwilliams/dependabot/github_action…
forrestfwilliams Feb 10, 2026
69663ef
Merge pull request #59 from forrestfwilliams/dependabot/github_action…
forrestfwilliams Feb 10, 2026
99d997d
Merge pull request #60 from forrestfwilliams/dependabot/github_action…
forrestfwilliams Feb 10, 2026
4325eff
Merge pull request #58 from forrestfwilliams/dependabot/github_action…
forrestfwilliams Feb 10, 2026
5af5b0e
update CHANGELOG, OPERA DEM -> Copernicus DEM for NISAR, raise except…
Alex-Lewandowski Feb 11, 2026
3c5ea80
remove now unused bytes_written from download_file()
Alex-Lewandowski Feb 11, 2026
afc4701
Copernicus DEM for NISAR -> Modified Copernicus DEM for NISAR
Alex-Lewandowski Feb 11, 2026
dffbeb9
Merge pull request #56 from Alex-Lewandowski/develop
forrestfwilliams Feb 21, 2026
20f7e2d
fix changelog
forrestfwilliams Feb 21, 2026
9aadd2b
Merge pull request #63 from forrestfwilliams/changelog
forrestfwilliams Feb 21, 2026
2dc9295
fix ruff
forrestfwilliams Feb 21, 2026
340da90
fix ruff
forrestfwilliams Feb 21, 2026
fb0ff3a
fix ruff
forrestfwilliams Feb 21, 2026
7fb18ee
Merge pull request #65 from forrestfwilliams/realease-prep
forrestfwilliams Feb 21, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ 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
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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ 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
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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/labeled-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .github/workflows/release-checklist-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ 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
uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.20.0
uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.21.0
2 changes: 1 addition & 1 deletion .github/workflows/tag-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: >-
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ 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]

### 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

## [0.5.2]

### Fixed
Expand Down
10 changes: 5 additions & 5 deletions src/multirtc/dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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 Modified Copernicus DEM for NISAR granule based on latitude and longitude.

Args:
lat: Latitude in degrees.
Expand All @@ -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

Expand All @@ -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 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.
Expand Down
25 changes: 17 additions & 8 deletions src/multirtc/fetch.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,22 @@ 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()
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)
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)
logging.info(f'Download successful: {url}')
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
raise
finally:
session.close()

return str(download_path)
4 changes: 3 additions & 1 deletion tests/test_dem.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@


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

Expand Down