Skip to main content

Raptor Zonal Statistics

Project description

raptor-stats

Docs: latest PyPI Python  3.12.8+ License

Compute zonal statistics using efficient Raptor (Raster+Vector) methods.

Installation

pip install raptor-stats

Usage

from raptorstats import zonal_stats

stats = zonal_stats("path/to/vector.shp", "path/to/raster.tif", method="scanline")

See the zonal_stats API docs for more details on input types and additional parameters.

Methods

  • scanline: Scans the raster file once, line by line, and computes all the intersections with the vector layer in a single pass. Suitable for fast one-time run results.
  • agqt: Builds a QuadTree with precomputed statistics, then combines it with the scanline method to answer queries more efficiently. Suitable for systems that repeatedly query changing vector layers over the same raster.

Performance

Raptor methods performance advantage increases with the size of the input raster and number of features. For example, with an ~1.9 billion pixel raster and 50 features (US states):

See images at https://github.com/simonpedrogonzalez/raptor-stats/blob/main/README.md

For the same raster, on but around 3000 features (US counties):

See images at https://github.com/simonpedrogonzalez/raptor-stats/blob/main/README.md

NOTES:

  • These tests were made on a i7-8750H (2019) 16GB RAM Linux machine.
  • The performance of the agqt method depends on the depth of the tree selected and the size of the features.

Credits

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

raptor_stats-0.0.5.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

raptor_stats-0.0.5-py3-none-any.whl (23.2 kB view details)

Uploaded Python 3

File details

Details for the file raptor_stats-0.0.5.tar.gz.

File metadata

  • Download URL: raptor_stats-0.0.5.tar.gz
  • Upload date:
  • Size: 27.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for raptor_stats-0.0.5.tar.gz
Algorithm Hash digest
SHA256 b26c134b371ed3cc6b25bcc9b7829188ae4549331357ba21a3fe6b58b7da2240
MD5 b2e68ba0543ffdb03a9f7cb5976adfaf
BLAKE2b-256 422395418328efc8ea3097e4791ce6c041ea997e05ef61cff7138b429a82e259

See more details on using hashes here.

File details

Details for the file raptor_stats-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: raptor_stats-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 23.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for raptor_stats-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 5d44fb7dfd24691ecd89fdec99a5aeff10ae506721f806068d27c95575997187
MD5 8ca81999ce44f8cfe3bd84a93b01065c
BLAKE2b-256 2ccbfe9eb447f3bf399118fdcf1ac720b87476f9ce7f483d5cf160267b5f9c5c

See more details on using hashes here.

Supported by

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