From e33451b03170e9046852788bc20e22ab62a31f77 Mon Sep 17 00:00:00 2001 From: Jake Herrmann Date: Fri, 17 Jan 2025 16:59:07 -0900 Subject: [PATCH 1/6] upgrade to mypy action v0.15.0 --- .github/workflows/static-analysis.yml | 2 +- pyproject.toml | 4 ++++ src/hyp3_isce2/burst.py | 4 ++-- src/hyp3_isce2/insar_tops.py | 2 +- src/hyp3_isce2/insar_tops_burst.py | 4 ++-- src/hyp3_isce2/merge_tops_bursts.py | 26 +++++++++++++------------- src/hyp3_isce2/utils.py | 6 +++--- tests/test_merge_tops_bursts.py | 2 +- tests/test_utils.py | 2 +- 9 files changed, 28 insertions(+), 24 deletions(-) diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 88f867bf..615a4f4f 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -13,4 +13,4 @@ jobs: call-mypy-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-mypy.yml@v0.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-mypy.yml@v0.15.0 diff --git a/pyproject.toml b/pyproject.toml index 466ef95b..d06fd005 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -111,3 +111,7 @@ warn_redundant_casts = true warn_unreachable = true strict_equality = true check_untyped_defs = true +install_types = true +non_interactive = true +pretty = true +disable_error_code = ["import-untyped"] diff --git a/src/hyp3_isce2/burst.py b/src/hyp3_isce2/burst.py index be3c1937..cb91901e 100644 --- a/src/hyp3_isce2/burst.py +++ b/src/hyp3_isce2/burst.py @@ -12,8 +12,8 @@ import asf_search import numpy as np import requests -from isceobj.Sensor.TOPS.Sentinel1 import Sentinel1 -from isceobj.TopsProc.runMergeBursts import multilook +from isceobj.Sensor.TOPS.Sentinel1 import Sentinel1 # type: ignore[import-not-found] +from isceobj.TopsProc.runMergeBursts import multilook # type: ignore[import-not-found] from lxml import etree from shapely import geometry diff --git a/src/hyp3_isce2/insar_tops.py b/src/hyp3_isce2/insar_tops.py index f3acd2e6..f9c67711 100644 --- a/src/hyp3_isce2/insar_tops.py +++ b/src/hyp3_isce2/insar_tops.py @@ -7,7 +7,7 @@ from shutil import copyfile, make_archive from hyp3lib.util import string_is_true -from isceobj.TopsProc.runMergeBursts import multilook +from isceobj.TopsProc.runMergeBursts import multilook # type: ignore[import-not-found] from s1_orbits import fetch_for_scene from hyp3_isce2 import packaging, slc, topsapp diff --git a/src/hyp3_isce2/insar_tops_burst.py b/src/hyp3_isce2/insar_tops_burst.py index 978cbd24..38806a99 100644 --- a/src/hyp3_isce2/insar_tops_burst.py +++ b/src/hyp3_isce2/insar_tops_burst.py @@ -8,10 +8,10 @@ from shutil import copyfile, make_archive from typing import Optional -import isce # noqa +import isce # noqa: F401 from burst2safe.burst2safe import burst2safe from hyp3lib.util import string_is_true -from isceobj.TopsProc.runMergeBursts import multilook +from isceobj.TopsProc.runMergeBursts import multilook # type: ignore[import-not-found] from osgeo import gdal from s1_orbits import fetch_for_scene diff --git a/src/hyp3_isce2/merge_tops_bursts.py b/src/hyp3_isce2/merge_tops_bursts.py index cd003e3d..224337a9 100644 --- a/src/hyp3_isce2/merge_tops_bursts.py +++ b/src/hyp3_isce2/merge_tops_bursts.py @@ -19,24 +19,24 @@ import asf_search import isce -import isceobj +import isceobj # type: ignore[import-not-found] import lxml.etree as ET import numpy as np -from contrib.Snaphu.Snaphu import Snaphu +from contrib.Snaphu.Snaphu import Snaphu # type: ignore[import-not-found] from hyp3lib.util import string_is_true -from isceobj.Orbit.Orbit import Orbit -from isceobj.Planet.Planet import Planet -from isceobj.Sensor.TOPS.Sentinel1 import Sentinel1 -from isceobj.TopsProc.runIon import maskUnwrap -from isceobj.TopsProc.runMergeBursts import mergeBox, mergeBursts2 -from iscesys.Component import createTraitSeq -from iscesys.Component.ProductManager import ProductManager -from mroipac.filter.Filter import Filter -from mroipac.icu.Icu import Icu +from isceobj.Orbit.Orbit import Orbit # type: ignore[import-not-found] +from isceobj.Planet.Planet import Planet # type: ignore[import-not-found] +from isceobj.Sensor.TOPS.Sentinel1 import Sentinel1 # type: ignore[import-not-found] +from isceobj.TopsProc.runIon import maskUnwrap # type: ignore[import-not-found] +from isceobj.TopsProc.runMergeBursts import mergeBox, mergeBursts2 # type: ignore[import-not-found] +from iscesys.Component import createTraitSeq # type: ignore[import-not-found] +from iscesys.Component.ProductManager import ProductManager # type: ignore[import-not-found] +from mroipac.filter.Filter import Filter # type: ignore[import-not-found] +from mroipac.icu.Icu import Icu # type: ignore[import-not-found] from osgeo import gdal from shapely import geometry -from stdproc.rectify.geocode.Geocodable import Geocodable -from zerodop.geozero import createGeozero +from stdproc.rectify.geocode.Geocodable import Geocodable # type: ignore[import-not-found] +from zerodop.geozero import createGeozero # type: ignore[import-not-found] import hyp3_isce2 import hyp3_isce2.burst as burst_utils diff --git a/src/hyp3_isce2/utils.py b/src/hyp3_isce2/utils.py index c24945f3..4d04b5a9 100644 --- a/src/hyp3_isce2/utils.py +++ b/src/hyp3_isce2/utils.py @@ -5,10 +5,10 @@ from pathlib import Path from typing import Optional -import isceobj +import isceobj # type: ignore[import-not-found] import numpy as np -from isceobj.Util.ImageUtil.ImageLib import loadImage -from iscesys.Component.ProductManager import ProductManager +from isceobj.Util.ImageUtil.ImageLib import loadImage # type: ignore[import-not-found] +from iscesys.Component.ProductManager import ProductManager # type: ignore[import-not-found] from osgeo import gdal, osr diff --git a/tests/test_merge_tops_bursts.py b/tests/test_merge_tops_bursts.py index d99a688e..a03fc58b 100644 --- a/tests/test_merge_tops_bursts.py +++ b/tests/test_merge_tops_bursts.py @@ -7,7 +7,7 @@ from unittest.mock import patch import asf_search -import isceobj # noqa: I100 +import isceobj # type: ignore[import-not-found] import lxml.etree as ET import numpy as np import pytest diff --git a/tests/test_utils.py b/tests/test_utils.py index 5b559dda..ff3af61a 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -4,7 +4,7 @@ from pathlib import Path from unittest.mock import patch -import isceobj # noqa +import isceobj # type: ignore[import-not-found] import numpy as np from osgeo import gdal From a651d19821e59e108541e8f4196943d491816725 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Jan 2025 20:32:41 +0000 Subject: [PATCH 2/6] Bump ASFHyP3/actions from 0.14.0 to 0.15.0 Bumps [ASFHyP3/actions](https://github.com/asfhyp3/actions) from 0.14.0 to 0.15.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.14.0...v0.15.0) --- updated-dependencies: - dependency-name: ASFHyP3/actions dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/changelog.yml | 2 +- .github/workflows/create-jira-issue.yml | 2 +- .github/workflows/labeled-pr.yml | 2 +- .github/workflows/release-checklist-comment.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/static-analysis.yml | 6 +++--- .github/workflows/tag-version.yml | 2 +- .github/workflows/test-and-build.yml | 6 +++--- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/changelog.yml b/.github/workflows/changelog.yml index 215afb8e..f7fe7148 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.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.15.0 diff --git a/.github/workflows/create-jira-issue.yml b/.github/workflows/create-jira-issue.yml index c4e970a8..b7ffba87 100644 --- a/.github/workflows/create-jira-issue.yml +++ b/.github/workflows/create-jira-issue.yml @@ -6,7 +6,7 @@ on: jobs: call-create-jira-issue-workflow: - uses: ASFHyP3/actions/.github/workflows/reusable-create-jira-issue.yml@v0.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-create-jira-issue.yml@v0.15.0 secrets: JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }} JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }} diff --git a/.github/workflows/labeled-pr.yml b/.github/workflows/labeled-pr.yml index c536d3ba..4f9abdd7 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.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.15.0 diff --git a/.github/workflows/release-checklist-comment.yml b/.github/workflows/release-checklist-comment.yml index 26a80d25..0860dd7a 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.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.15.0 permissions: pull-requests: write secrets: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 68eb5fcc..4094e093 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.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.15.0 with: release_prefix: HyP3 ISCE2 secrets: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 88f867bf..f4a0ddee 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -5,12 +5,12 @@ on: push jobs: call-secrets-analysis-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.15.0 call-ruff-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-ruff.yml@v0.15.0 call-mypy-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-mypy.yml@v0.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-mypy.yml@v0.15.0 diff --git a/.github/workflows/tag-version.yml b/.github/workflows/tag-version.yml index 5f8122c0..4b9a79f4 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.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.15.0 with: user: tools-bot email: UAF-asf-apd@alaska.edu diff --git a/.github/workflows/test-and-build.yml b/.github/workflows/test-and-build.yml index 4ab87c1f..64531228 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.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.15.0 with: local_package_name: hyp3_isce2 python_versions: >- @@ -21,14 +21,14 @@ jobs: call-version-info-workflow: # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.15.0 with: python_version: "3.10" call-docker-ghcr-workflow: needs: call-version-info-workflow # Docs: https://github.com/ASFHyP3/actions - uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@v0.14.0 + uses: ASFHyP3/actions/.github/workflows/reusable-docker-ghcr.yml@v0.15.0 with: version_tag: ${{ needs.call-version-info-workflow.outputs.version_tag }} release_branch: main From 44b70873c6260b483cac9460c9cbec2be961544e Mon Sep 17 00:00:00 2001 From: Jake Herrmann Date: Mon, 20 Jan 2025 12:59:31 -0900 Subject: [PATCH 3/6] ruff format --- src/hyp3_isce2/packaging.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hyp3_isce2/packaging.py b/src/hyp3_isce2/packaging.py index d7ce2e3f..8b2c967d 100644 --- a/src/hyp3_isce2/packaging.py +++ b/src/hyp3_isce2/packaging.py @@ -87,10 +87,10 @@ def get_product_name( lons, lats = footprint.exterior.coords.xy def lat_string(lat): - return ('N' if lat >= 0 else 'S') + f"{('%.1f' % np.abs(lat)).zfill(4)}".replace('.', '_') + return ('N' if lat >= 0 else 'S') + f'{("%.1f" % np.abs(lat)).zfill(4)}'.replace('.', '_') def lon_string(lon): - return ('E' if lon >= 0 else 'W') + f"{('%.1f' % np.abs(lon)).zfill(5)}".replace('.', '_') + return ('E' if lon >= 0 else 'W') + f'{("%.1f" % np.abs(lon)).zfill(5)}'.replace('.', '_') lat_lims = [lat_string(lat) for lat in [np.min(lats), np.max(lats)]] lon_lims = [lon_string(lon) for lon in [np.min(lons), np.max(lons)]] From 6070a7271c1da596292687f3a11e61d7aeb84876 Mon Sep 17 00:00:00 2001 From: Jake Herrmann Date: Wed, 22 Jan 2025 19:45:41 +0000 Subject: [PATCH 4/6] update code of conduct per guidance from NASA --- CODE_OF_CONDUCT.md | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 154bd0ac..091d0be4 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,17 +1,12 @@ - # Contributor Covenant Code of Conduct ## Our Pledge We as members, contributors, and leaders pledge to make participation in our -community a harassment-free experience for everyone, regardless of age, body -size, visible or invisible disability, ethnicity, sex characteristics, gender -identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, religion, or sexual identity -and orientation. +community a harassment-free experience for everyone. We pledge to act and interact in ways that contribute to an open, welcoming, -diverse, inclusive, and healthy community. +and healthy community. ## Our Standards @@ -61,7 +56,7 @@ representative at an online or offline event. Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement by emailing the -development team at [UAF-asf-apd@alaska.edu](mailto:UAF-asf-apd@alaska.edu). +ASF APD/Tools team at [UAF-asf-apd@alaska.edu](mailto:UAF-asf-apd@alaska.edu). All complaints will be reviewed and investigated promptly and fairly. All community leaders are obligated to respect the privacy and security of the From 0bede289b6d9622c54704e6056fc8d5353c484ff Mon Sep 17 00:00:00 2001 From: Andrew Johnston Date: Fri, 31 Jan 2025 10:32:02 -0900 Subject: [PATCH 5/6] update download URLs for Sentinel-1 AUX_CAL files --- CHANGELOG.md | 4 ++++ src/hyp3_isce2/s1_auxcal.py | 10 +++++++--- tests/test_s1_auxcal.py | 12 ++++++++++-- 3 files changed, 21 insertions(+), 5 deletions(-) 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() From cd3749edd0ad486f929b653e7c996268f9c753c6 Mon Sep 17 00:00:00 2001 From: Andrew Johnston Date: Fri, 31 Jan 2025 10:32:57 -0900 Subject: [PATCH 6/6] Update CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index e15e7069..dde83f36 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,2 +1,2 @@ # These owners will be requested for review when someone opens a pull request. -* @ASFHyP3/plugins +* @ASFHyP3/Tools