Skip to content

Commit

Permalink
Merge pull request #265 from ASFHyP3/aux-cal
Browse files Browse the repository at this point in the history
update download URLs for Sentinel-1 AUX_CAL files
  • Loading branch information
asjohnston-asf authored Jan 31, 2025
2 parents fecf739 + 0bede28 commit f2663ab
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ 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).

## [2.1.3]
### Changed
- Updated download URLs for Sentinel-1 AUX_CAL files.

## [2.1.2]
### Added
- Added `mypy` type checker to the [`static-analysis`](https://github.com/ASFHyP3/hyp3-isce2/blob/develop/.github/workflows/static-analysis.yml) workflow.
Expand Down
10 changes: 7 additions & 3 deletions src/hyp3_isce2/s1_auxcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
import requests


S1A_AUX_URL = 'https://sar-mpc.eu/download/55282da1-679d-4ecf-aeef-d06b024451cf'
S1B_AUX_URL = 'https://sar-mpc.eu/download/3c8b7c8d-d3de-4381-a19d-7611fb8734b9'
S1A_AUX_URL = 'https://sar-mpc.eu/files/S1A_AUX_CAL_20241128.zip'
S1B_AUX_URL = 'https://sar-mpc.eu/files/S1B_AUX_CAL_20241128.zip'


def _download_platform(url: str, aux_cal_dir: Path):
Expand All @@ -38,7 +38,11 @@ def _download_platform(url: str, aux_cal_dir: Path):

content = BytesIO(response.content)
with zipfile.ZipFile(content) as zip_file:
zip_file.extractall(aux_cal_dir)
for zip_info in zip_file.infolist():
# remove leading directories, i.e. extract S1A/AUX_CAL/2019/02/28/foo.SAFE/* to foo.SAFE/*
if not zip_info.is_dir() and '.SAFE/' in zip_info.filename:
zip_info.filename = '/'.join(zip_info.filename.split('/')[5:])
zip_file.extract(zip_info, aux_cal_dir)


def download_aux_cal(aux_cal_dir: Union[str, Path] = 'aux_cal'):
Expand Down
12 changes: 10 additions & 2 deletions tests/test_s1_auxcal.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,13 @@ def test_download_aux_cal(tmp_path):
"""
aux_cal_dir = tmp_path / 'aux_cal'
s1_auxcal.download_aux_cal(aux_cal_dir)
assert (aux_cal_dir / 'S1A_AUX_CAL_V20190228T092500_G20210104T141310.SAFE').exists()
assert (aux_cal_dir / 'S1B_AUX_CAL_V20190514T090000_G20210104T140612.SAFE').exists()

assert (aux_cal_dir / 'S1A_AUX_CAL_V20150722T120000_G20151125T104733.SAFE/data/s1a-aux-cal.xml').exists()
assert (aux_cal_dir / 'S1A_AUX_CAL_V20150722T120000_G20151125T104733.SAFE/manifest.safe').exists()
assert (aux_cal_dir / 'S1A_AUX_CAL_V20150722T120000_G20151125T104733.SAFE/support/s1-object-types.xsd').exists()
assert (aux_cal_dir / 'S1A_AUX_CAL_V20150722T120000_G20151125T104733.SAFE/support/s1-aux-cal.xsd').exists()

assert (aux_cal_dir / 'S1B_AUX_CAL_V20160422T000000_G20160701T144618.SAFE/data/s1b-aux-cal.xml').exists()
assert (aux_cal_dir / 'S1B_AUX_CAL_V20160422T000000_G20160701T144618.SAFE/manifest.safe').exists()
assert (aux_cal_dir / 'S1B_AUX_CAL_V20160422T000000_G20160701T144618.SAFE/support/s1-object-types.xsd').exists()
assert (aux_cal_dir / 'S1B_AUX_CAL_V20160422T000000_G20160701T144618.SAFE/support/s1-aux-cal.xsd').exists()

0 comments on commit f2663ab

Please sign in to comment.