Miscellaneous utilities for working with OPERA data products
Project description
opera-utils
Install
The opera_utils
package is available on PyPI and conda-forge:
# if mamba is not already installed: conda install -n base mamba
mamba install -c conda-forge opera-utils
(Note: using mamba
is recommended for conda-forge packages, but miniconda can also be used.)
pip install opera-utils
The pip
dependency list for the base package is smaller; the optional depencies may be added with
pip install opera-utils[geopandas] # for just geopandas data frame support
pip install opera-utils[disp] # For remote access to DISP files
pip install opera-utils[all] # all optional dependencies
DISP-S1 Usage examples
Try it out!
We have set up Github Actions so that users can download and format subsets of DISP-S1 data with no coding required!
- Fork this repository
- Set up your EARTHDATA_USERNAME and EARTHDATA_PASSWORD in the Github Actions secrets settings (e.g. for my fork, I use https://github.com/scottstanie/opera-utils/settings/secrets/actions )
- Under the Actions tab, click on the
disp_download_reformat
workflow. - Select the Run workflow dropdown and supply the required information, then click the green Run workflow button
- The resulting reformatted Zarr will be preserved as Github Artifacts, which can be downloaded.
Usage examples
Parsing Sentinel-1 Burst IDs
import opera_utils
print(opera_utils.get_burst_id("OPERA_L2_CSLC-S1_T087-185683-IW2_20230322T161649Z_20240504T185235Z_S1A_VV_v1.1.h5"))
't087_185683_iw2'
Get DISP-S1 Frame metadata
In [4]: opera_utils.get_frame_to_burst_mapping(11114)
Out[4]:
{'epsg': 32610,
'is_land': True,
'is_north_america': True,
'xmin': 546450,
'ymin': 4204110,
'xmax': 833790,
'ymax': 4409070,
'burst_ids': ['t042_088905_iw1',
...
]
To just get the burst IDs for a Frame:
In [3]: opera_utils.get_burst_ids_for_frame(11114)
Out[3]:
['t042_088905_iw1',
't042_088905_iw2',
...
't042_088913_iw2',
't042_088913_iw3']
DISP-S1 access
Download a subset from the command lind
opera-utils disp-s1-download \
--bbox -102.71 31.35 -102.6 31.45 \
--frame-id 20697 \
--output-dir subsets-west-texas \
--end-datetime 2018-01-01 \\
--num-workers 4
Search for products and create a stack
from opera_utils.disp import search, reader, DispProductStack
# Search for DISP-S1 products on CMR
products = search.get_products(frame_id=9154)
# Create the product stack for parsing frame metadata
stack = DispProductStack(products)
Setup for Developers
To contribute to the development of opera-utils
, you can fork the repository and install the package in development mode.
We encourage new features to be developed on a new branch of your fork, and then submitted as a pull request to the main repository.
To install locally,
- Download source code:
git clone https://github.com/opera-adt/opera-utils.git && cd opera-utils
- Install dependencies:
mamba env create --name my-opera-env --file environment.yml
- Install the source in editable mode:
mamba activate my-opera-env
python -m pip install -e ".[all]"
We use pre-commit
to automatically run linting and formatting:
# Get pre-commit hooks so that linting/formatting is done automatically
pre-commit install
This will set up the linters and formatters to run on any staged files before you commit them.
After making functional changes, you can rerun the existing tests and any new ones you have added using:
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file opera_utils-0.23.3.tar.gz
.
File metadata
- Download URL: opera_utils-0.23.3.tar.gz
- Upload date:
- Size: 370.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
a8ba391ee49d5a00105348856b4fc739cfdb55be33f3b96e55b0e116240d8822
|
|
MD5 |
7ead4a285117c28353c8067457c16170
|
|
BLAKE2b-256 |
1b7ad1fe427bb954f5816de9072bae7fa2daf8e0879b0f729e667c184f195ac2
|
Provenance
The following attestation bundles were made for opera_utils-0.23.3.tar.gz
:
Publisher:
cd.yml
on opera-adt/opera-utils
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
opera_utils-0.23.3.tar.gz
-
Subject digest:
a8ba391ee49d5a00105348856b4fc739cfdb55be33f3b96e55b0e116240d8822
- Sigstore transparency entry: 252102109
- Sigstore integration time:
-
Permalink:
opera-adt/opera-utils@2730fe57a6e8c6f695fd9a0279fdeb42ae7f1266
-
Branch / Tag:
refs/tags/v0.23.3
- Owner: https://github.com/opera-adt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
cd.yml@2730fe57a6e8c6f695fd9a0279fdeb42ae7f1266
-
Trigger Event:
release
-
Statement type:
File details
Details for the file opera_utils-0.23.3-py3-none-any.whl
.
File metadata
- Download URL: opera_utils-0.23.3-py3-none-any.whl
- Upload date:
- Size: 86.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
46e9d1a0e43d046d14af167de935e462fc9952a4a219ac6307956610abd4af53
|
|
MD5 |
27c748f2a0bba0bd735f40b616cdbf7c
|
|
BLAKE2b-256 |
5f58874c241742ede2840571cb0d14344c1aeed574f1db75767ee6e12d2940d2
|
Provenance
The following attestation bundles were made for opera_utils-0.23.3-py3-none-any.whl
:
Publisher:
cd.yml
on opera-adt/opera-utils
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1
-
Predicate type:
https://docs.pypi.org/attestations/publish/v1
-
Subject name:
opera_utils-0.23.3-py3-none-any.whl
-
Subject digest:
46e9d1a0e43d046d14af167de935e462fc9952a4a219ac6307956610abd4af53
- Sigstore transparency entry: 252102112
- Sigstore integration time:
-
Permalink:
opera-adt/opera-utils@2730fe57a6e8c6f695fd9a0279fdeb42ae7f1266
-
Branch / Tag:
refs/tags/v0.23.3
- Owner: https://github.com/opera-adt
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com
-
Runner Environment:
github-hosted
-
Publication workflow:
cd.yml@2730fe57a6e8c6f695fd9a0279fdeb42ae7f1266
-
Trigger Event:
release
-
Statement type: