Skip to content

Commit

Permalink
Merge pull request #50 from forrestfwilliams/develop
Browse files Browse the repository at this point in the history
Release v0.2.1
  • Loading branch information
forrestfwilliams authored Jan 12, 2024
2 parents 769443c + 288e3bc commit c674fbb
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Build and publish Python distributions to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout lastest tagged version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
name: Build and publish Python distributions to PyPI and TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Checkout lastest tagged version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
call-bump-version-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.8.1
uses: ASFHyP3/actions/.github/workflows/reusable-bump-version.yml@v0.9.0
with:
user: forrest-bot
email: [email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/changelog-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ on:

jobs:
call-changelog-check-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.8.1
uses: ASFHyP3/actions/.github/workflows/reusable-changelog-check.yml@v0.9.0
secrets:
USER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/labeled-pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ on:

jobs:
call-labeled-pr-check-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.8.1
uses: ASFHyP3/actions/.github/workflows/reusable-labeled-pr-check.yml@v0.9.0
2 changes: 1 addition & 1 deletion .github/workflows/pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ on:
jobs:
call-pytest-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.8.1
uses: ASFHyP3/actions/.github/workflows/reusable-pytest.yml@v0.9.0
with:
local_package_name: index_safe
2 changes: 1 addition & 1 deletion .github/workflows/release-checklist-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

jobs:
call-release-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.8.1
uses: ASFHyP3/actions/.github/workflows/reusable-release-checklist-comment.yml@v0.9.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 @@ -7,7 +7,7 @@ on:

jobs:
call-release-workflow:
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.8.1
uses: ASFHyP3/actions/.github/workflows/reusable-release.yml@v0.9.0
with:
release_prefix: INDEX_SAFE
release_branch: main # Optional; default shown
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ on: [pull_request]
jobs:
call-secrets-analysis-workflow:
# Docs: https://github.com/ASFHyP3/actions
uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.8.1
uses: ASFHyP3/actions/.github/workflows/reusable-secrets-analysis.yml@v0.9.0

check-with-black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check --diff --color"
Expand All @@ -19,7 +19,7 @@ jobs:
check-with-ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v4
with:
Expand All @@ -29,4 +29,4 @@ jobs:
python -m pip install --upgrade pip
pip install ruff
- name: Run Ruff
run: ruff check --format=github . src/index_safe/*.py
run: ruff check --output-format github . src/index_safe/*.py
11 changes: 9 additions & 2 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.2.1]

### Added
* `xml_metadata_as_json` function that returns XML metadata JSON string.

### Changed
* `save_xml_metadata_as_json` function so that it calls the new `xml_metadata_as_json` function.

## [0.2.0]

Expand All @@ -16,7 +23,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* Tests for extract_burst.py
* Integration tests that use a downloaded S1 SLC

### Modified
### Changed
* Standardize all xml operations so that they use lxml
* `extract_metadata` polarization option is now required

Expand All @@ -32,7 +39,7 @@ and uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* Add check for deflate compression before indexing
* Workflows for PyPI publishing

### Modified
### Changed
* `create_index` and `extract_burst` so that valid window and GCP calculations happen during `extract_burst`
* `utils.BurstMetadata` so that it contains annotation and manifest offsets, but not valid window or GCP data
* Created centralized range get request functionality in `utils`
Expand Down
22 changes: 17 additions & 5 deletions src/index_safe/create_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,24 +174,36 @@ def create_index(
return bursts


def save_xml_metadata_as_json(entries: Iterable[utils.XmlMetadata], out_name: str) -> str:
"""Save a list of XmlMetadata objects as a json.
def xml_metadata_as_json(entries: Iterable[utils.XmlMetadata]) -> str:
"""Creates a list of XmlMetadata objects as json.
Args:
entries: List of metadata objects to be included
out_name: Path/name to save json at
Returns:
Path/name where json was saved
JSON string of metadata
"""
slc = entries[0].slc
metadata_dicts = [entry.to_dict()[slc] for entry in entries]
combined_dict = {}
for metadata_dict in metadata_dicts:
combined_dict.update(metadata_dict)

return json.dumps({slc: combined_dict})


def save_xml_metadata_as_json(entries: Iterable[utils.XmlMetadata], out_name: str) -> str:
"""Create and save a list of XmlMetadata objects as a json.
Args:
entries: List of metadata objects to be included
out_name: Path/name to save json at
Returns:
Path/name where json was saved
"""
with open(out_name, 'w') as json_file:
json.dump({slc: combined_dict}, json_file)
json_file.write(xml_metadata_as_json(entries))
return out_name


Expand Down

0 comments on commit c674fbb

Please sign in to comment.