Skip to main content

L2 Subsetter Service

Project description

l2ss-py

Coverage
develop: Develop Build
main: Main Build

Harmony service for subsetting L2 data. l2ss-py supports:

  • Spatial subsetting
    • Bounding box
    • Shapefile subsetting
    • GeoJSON subsetting
  • Temporal subsetting
  • Variable subsetting

If you would like to contribute to l2ss-py, refer to the contribution document.

How to test l2ss-py locally

Unit tests

There are comprehensive unit tests for l2ss-py. The tests can be run as follows:

poetry run pytest -m "not aws and not integration" tests/

You can generate coverage reports as follows:

poetry run pytest --junitxml=build/reports/pytest.xml --cov=podaac/ --cov-report=html -m "not aws and not integration" tests/

l2ss-py script

You can run l2ss-py on a single granule without using Harmony. In order to run this, the l2ss-py package must be installed in your current Python interpreter

$ l2ss-py --help                                                                                                                    
usage: run_subsetter.py [-h] [--bbox BBOX BBOX BBOX BBOX]
                        [--variables VARIABLES [VARIABLES ...]]
                        [--min-time MIN_TIME] [--max-time MAX_TIME] [--cut]
                        input_file output_file

Run l2ss-py

positional arguments:
  input_file            File to subset
  output_file           Output file

optional arguments:
  -h, --help            show this help message and exit
  --bbox BBOX BBOX BBOX BBOX
                        Bounding box in the form min_lon min_lat max_lon
                        max_lat
  --variables VARIABLES [VARIABLES ...]
                        Variables, only include if variable subset is desired.
                        Should be a space separated list of variable names
                        e.g. sst wind_dir sst_error ...
  --min-time MIN_TIME   Min time. Should be ISO-8601 format. Only include if
                        temporal subset is desired.
  --max-time MAX_TIME   Max time. Should be ISO-8601 format. Only include if
                        temporal subset is desired.
  --cut                 If provided, scanline will be cut
  --shapefile SHAPEFILE
                        Path to either shapefile or geojson file used to subset the provided input granule

For example:

l2ss-py /path/to/input.nc /path/to/output.nc --bbox -50 -10 50 10 --variables wind_speed wind_dir ice_age time --min-time '2015-07-02T09:00:00' --max-time '2015-07-02T10:00:00' --cut

An addition to providing a bounding box, spatial subsetting can be achieved by passing in a shapefile or a geojson file.

poetry run l2ss-py /path/to/input.nc /path/to/output.nc --shapefile /path/to/test.shp

or

poetry run l2ss-py /path/to/input.nc /path/to/output.nc --shapefile /path/to/test.geojson

Running Harmony locally

In order to fully test l2ss-py with Harmony, you can run Harmony locally. This requires the data exists in UAT Earthdata Cloud.

  1. Set up local Harmony instance. Instructions here
  2. Add concept ID for your data to services.yml
  3. Execute a local Harmony l2ss-py request. For example:
    localhost:3000/YOUR_COLLECTION_ID/ogc-api-coverages/1.0.0/collections/all/coverage/rangeset?format=application%2Fx-netcdf4&subset=lat(-10%3A10)&subset=lon(-10%3A10)&maxResults=2
    

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

l2ss-py-1.5.0.tar.gz (25.5 kB view details)

Uploaded Source

Built Distribution

l2ss_py-1.5.0-py3-none-any.whl (27.0 kB view details)

Uploaded Python 3

File details

Details for the file l2ss-py-1.5.0.tar.gz.

File metadata

  • Download URL: l2ss-py-1.5.0.tar.gz
  • Upload date:
  • Size: 25.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.8.12 Linux/5.13.0-1023-azure

File hashes

Hashes for l2ss-py-1.5.0.tar.gz
Algorithm Hash digest
SHA256 7ec9ebde47a7969853f611c88e4180adefdaaaeba479bcd0b10a6ad092b551be
MD5 7f958379f9a365aed7acf5fddd46a4bd
BLAKE2b-256 d7f2eb6d5c15c7680a829a7ef58a8c820bcdbbfd6c60bdddb8a639198998b2f2

See more details on using hashes here.

File details

Details for the file l2ss_py-1.5.0-py3-none-any.whl.

File metadata

  • Download URL: l2ss_py-1.5.0-py3-none-any.whl
  • Upload date:
  • Size: 27.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.8 CPython/3.8.12 Linux/5.13.0-1023-azure

File hashes

Hashes for l2ss_py-1.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0ed10c1eb7e14b4a87223922dd108fedc42494f74cbe006d89a3484c13436043
MD5 3317ba0334dbcdeffa49efc49e57b1e0
BLAKE2b-256 da2c5dc88b72d0d09438c9f646ecdabad61208252a2437eb484c4a627265487d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page