diff --git a/CHANGELOG.md b/CHANGELOG.md index e84639d7..076e9e9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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. diff --git a/src/hyp3_isce2/s1_auxcal.py b/src/hyp3_isce2/s1_auxcal.py index 0f5fbbcb..eddc989b 100644 --- a/src/hyp3_isce2/s1_auxcal.py +++ b/src/hyp3_isce2/s1_auxcal.py @@ -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): @@ -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'): diff --git a/tests/test_s1_auxcal.py b/tests/test_s1_auxcal.py index b28e0b69..f879f45f 100644 --- a/tests/test_s1_auxcal.py +++ b/tests/test_s1_auxcal.py @@ -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()