Skip to content

stac-utils/stac-api-benchmark

Repository files navigation

STAC API Benchmark

PyPI Status Python Version License

Read the documentation at https://stac-api-benchmark.readthedocs.io/ Tests Codecov

pre-commit Black

Features

  • STEP - A vector dataset of 1983 ecoregions throughout the world. These are simple 5 point GeoJSON Polygons covering a few square kilometers. These are much smaller than most gridded data products. For example, Sentinel-2 L2A scenes are 10,000 square km, so they are effectively points when compared against those sizes. The size of these polygons are closer to data produced closer to the ground, for example, by commercial drones.

images/step.png

  • TNC Ecoregions - A vector dataset of 814 large polygons multipolygons covering the entire earth. These irregular shapes are larger than most gridded data product scenes and typically span many such grid squares.

images/tnc.png

  • Country political boundaries - Many analyses are done at the country level, as they are funded by the country's government. There are two benchmarks here - one querying for all the items in a country during a single month, and another that only retrieves the first 1000 results, but sorts by cloud cover ascending.
  • Random queries. Generate queries with a random geometry and properties filtering on 3 integer-valued properties.
  • Repeated request for same item - Benchmarks caching of a single item.
  • Sorts - Datetime, Cloud Cover, Created - Benchmarks the performance of results sorting.

Installation

Currently, you must clone the repo and run from there. After cloning, run:

$ poetry install

TODO You can install STAC API Benchmark via pip from PyPI:

$ pip install stac-api-benchmark

Usage

$ poetry run stac-api-benchmark \
    --verbosity INFO \
    --url http://localhost:8080
    --collection sentinel-2-l2a \
    --queryable cloud_cover \
    --queryable cloud_shadow_percentage \
    --queryable properties.s2:nodata_pixel_percentage

Options:

  • --url - The root / Landing Page url for a STAC API
  • --collection - The collection to operate on
  • --concurrency - The number of concurrent request to run
  • --seed - For the random query generation, the seed value. This allows you to consistently generate random queries.
  • --queryable - Supports multiple parameters. The name of a queryable to include in random queries, ranged 0-100.
  • --max-items - Request this maximum number of items from the API for each query in the feature collection queries. Otherwise, if there are large numbers of results for these queries, it may take a very long to paginate through them, and this doesn't necessarily reflect something a user will do in practice. This defaults to 10000.
  • --limit - Request this maximum number of items per page from the API for each query
  • --num-features - Only query this number of features from the feature collection inputs. This is useful if you just want to run a quicker test with a few queries rather than the thousands in each of the features tests
  • --num-random - The number of random queries to run.
  • --verbosity - DEBUG, INFO, WARNING, ERROR, or CRITICAL to set the level of logging that will be in the output
  • --timeout - Amount of time (in seconds) to run searches before considering them to have timed out

Contributing

Contributions are very welcome. To learn more, see the Contributor Guide.

License

Distributed under the terms of the Apache 2.0 license, STAC API Benchmark is free and open source software.

Issues

If you encounter any problems, please file an issue along with a detailed description.

Credits

This project was generated from @cjolowicz's Hypermodern Python Cookiecutter template.