Skip to content

opera-adt/opera-utils

Repository files navigation

opera-utils

Actions Status PyPI version

Conda-Forge GitHub Discussion

Install

The opera_utils package is available on PyPI and conda-forge:

pip install opera-utils
# 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.)

While not required for all, some utilities use the GDAL package, which can be installed most easily on conda-forge:

mamba env update --file environment-geo.yml

Example Usage

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']

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,

  1. Download source code:
git clone https://github.com/opera-adt/opera-utils.git && cd opera-utils
  1. Install dependencies:
mamba env create --name my-opera-env --file environment.yml
mamba install gdal
  1. Install the source in editable mode:
mamba activate my-opera-env
python -m pip install -e .

The extra packages required for testing and building the documentation can be installed:

# Run "pip install -e" to install with extra development requirements
python -m pip install -e ".[docs,test]"

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:

python -m pytest

About

Miscellaneous utilities for working with OPERA data products

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages