Skip to main content

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

Metadata

Release files for raptor-stats 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for raptor-stats 0.0.5
File Size Uploaded
raptor_stats-0.0.5.tar.gz 27.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for raptor-stats 0.0.5
File Interpreter ABI Platform
raptor_stats-0.0.5-py3-none-any.whl Python 3 none any Details

Total release size: 50.2 kB

Release files / raptor_stats-0.0.5.tar.gz

Download URL raptor_stats-0.0.5.tar.gz
Size 27.0 kB
Tags Source
SHA-256 checksum
How to use checksums
b26c134b371ed3cc6b25bcc9b7829188ae4549331357ba21a3fe6b58b7da2240
BLAKE2b-256 checksum
How to use checksums
422395418328efc8ea3097e4791ce6c041ea997e05ef61cff7138b429a82e259
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / raptor_stats-0.0.5-py3-none-any.whl

Download URL raptor_stats-0.0.5-py3-none-any.whl
Size 23.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5d44fb7dfd24691ecd89fdec99a5aeff10ae506721f806068d27c95575997187
BLAKE2b-256 checksum
How to use checksums
2ccbfe9eb447f3bf399118fdcf1ac720b87476f9ce7f483d5cf160267b5f9c5c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

0.0.5 This release

2 release files

0.0.4

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page