Skip to content

Commit

Permalink
Merge pull request #64 from ASFHyP3/develop
Browse files Browse the repository at this point in the history
Release v0.9.1
  • Loading branch information
AndrewPlayer3 authored Dec 17, 2024
2 parents 28ff6ac + 1efc155 commit 20b4b55
Show file tree
Hide file tree
Showing 19 changed files with 155 additions and 87 deletions.
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.11.2
uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.12.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.11.2
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.12.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.11.2
uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.12.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.11.2
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.12.0
with:
release_prefix: HyP3 SRG
release_branch: main
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +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.11.2
uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.12.0

call-flake8-workflow:
call-ruff-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/[email protected]
with:
local_package_names: hyp3_srg
uses: ASFHyP3/actions/.github/workflows/[email protected]
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.11.2
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.12.0
with:
user: tools-bot
email: [email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ on:
jobs:
call-pytest-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.11.2
uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.12.0
with:
local_package_name: hyp3_srg
python_versions: >-
["3.10", "3.11", "3.12", "3.13"]
call-version-info-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.11.2
uses: ASFHyP3/actions/.github/workflows/reusable-version-info.yml@v0.12.0
with:
python_version: "3.10"

Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.9.1]

### Changed
* The [`static-analysis`](.github/workflows/static-analysis.yml) Github Actions workflow now uses `ruff` rather than `flake8` for linting.

## [0.9.0]

### Added
Expand Down
5 changes: 1 addition & 4 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@ dependencies:
- python>=3.10
- pip
# For packaging, and testing
- flake8
- flake8-import-order
- flake8-blind-except
- flake8-builtins
- ruff
- setuptools
- setuptools_scm
- wheel
Expand Down
31 changes: 27 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ dynamic = ["version", "readme"]

[project.optional-dependencies]
develop = [
"flake8",
"flake8-import-order",
"flake8-blind-except",
"flake8-builtins",
"ruff",
"pytest",
"pytest-cov",
"pytest-console-scripts",
Expand Down Expand Up @@ -62,3 +59,29 @@ readme = {file = ["README.md"], content-type = "text/markdown"}
where = ["src"]

[tool.setuptools_scm]

[tool.ruff]
line-length = 120
src = ["src", "tests"]

[tool.ruff.format]
indent-style = "space"
quote-style = "single"

[tool.ruff.lint]
extend-select = [
"I", # isort: https://docs.astral.sh/ruff/rules/#isort-i

# TODO: uncomment the following extensions and address their warnings:
#"UP", # pyupgrade: https://docs.astral.sh/ruff/rules/#pyupgrade-up
#"D", # pydocstyle: https://docs.astral.sh/ruff/rules/#pydocstyle-d
#"ANN", # annotations: https://docs.astral.sh/ruff/rules/#flake8-annotations-ann
#"PTH", # use-pathlib-pth: https://docs.astral.sh/ruff/rules/#flake8-use-pathlib-pth
]

[tool.ruff.lint.pydocstyle]
convention = "google"

[tool.ruff.lint.isort]
case-sensitive = true
lines-after-imports = 2
1 change: 1 addition & 0 deletions src/hyp3_srg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

from importlib.metadata import version


__version__ = version(__name__)

__all__ = [
Expand Down
5 changes: 2 additions & 3 deletions src/hyp3_srg/__main__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
"""
HyP3 plugin for Stanford Radar Group (SRG) SAR Processor
"""
"""HyP3 plugin for Stanford Radar Group (SRG) SAR Processor"""

import argparse
import sys
from importlib.metadata import entry_points
Expand Down
26 changes: 17 additions & 9 deletions src/hyp3_srg/back_projection.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
"""
GSLC back-projection processing
"""
"""GSLC back-projection processing"""

import argparse
import logging
import os
import zipfile
from collections.abc import Iterable
from pathlib import Path
from typing import Iterable, Optional

from hyp3lib.aws import upload_file_to_s3
from shapely import unary_union
Expand Down Expand Up @@ -93,7 +91,7 @@ def back_project(
bucket: str = None,
bucket_prefix: str = '',
use_gslc_prefix: bool = False,
work_dir: Optional[Path] = None,
work_dir: Path | None = None,
gpu: bool = False,
):
"""Back-project a set of Sentinel-1 level-0 granules.
Expand Down Expand Up @@ -162,17 +160,27 @@ def main():
help=(
'Upload GSLC granules to a subprefix located within the bucket and prefix given by the'
' --bucket and --bucket-prefix options'
)
),
)
parser.add_argument(
'--gpu',
default=False,
action='store_true',
help='Use the GPU-based version of the workflow.',
)
parser.add_argument('--gpu', default=False, action='store_true', help='Use the GPU-based version of the workflow.')
parser.add_argument(
'--bounds',
default=None,
type=str.split,
nargs='+',
help='DEM extent bbox in EPSG:4326: [min_lon, min_lat, max_lon, max_lat].'
help='DEM extent bbox in EPSG:4326: [min_lon, min_lat, max_lon, max_lat].',
)
parser.add_argument(
'granules',
type=str.split,
nargs='+',
help='Level-0 S1 granule(s) to back-project.',
)
parser.add_argument('granules', type=str.split, nargs='+', help='Level-0 S1 granule(s) to back-project.')
args = parser.parse_args()

args.granules = [item for sublist in args.granules for item in sublist]
Expand Down
8 changes: 4 additions & 4 deletions src/hyp3_srg/dem.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Prepare a Copernicus GLO-30 DEM virtual raster (VRT) covering a given geometry"""

import logging
from pathlib import Path
from typing import Optional

import requests

Expand All @@ -27,7 +27,7 @@ def ensure_egm_model_available():
f.write(chunk)


def download_dem_for_srg(bounds: list[float], work_dir: Optional[Path]):
def download_dem_for_srg(bounds: list[float], work_dir: Path | None):
"""Download the DEM for the given bounds - [min_lon, min_lat, max_lon, max_lat].
Args:
Expand All @@ -37,9 +37,9 @@ def download_dem_for_srg(bounds: list[float], work_dir: Optional[Path]):
Returns:
The path to the downloaded DEM
"""
if (bounds[0] >= bounds[2] or bounds[1] >= bounds[3]):
if bounds[0] >= bounds[2] or bounds[1] >= bounds[3]:
raise ValueError(
"Improper bounding box formatting, should be [max latitude, min latitude, min longitude, max longitude]."
'Improper bounding box formatting, should be [max latitude, min latitude, min longitude, max longitude].'
)

dem_path = work_dir / 'elevation.dem'
Expand Down
Loading

0 comments on commit 20b4b55

Please sign in to comment.