Skip to main content

GIS utility package

Project description

pyramids — GIS utilities for rasters, vectors & datacubes, built on GDAL/OGR

Documentations Python Versions License: GPL v3 pre-commit GitHub last commit GitHub Repo stars codecov Codacy Badge

GitHub commits since latest release (by SemVer including pre-releases)

pages-build-deployment

Current release info

Name Downloads Version Platforms
Conda Recipe Conda Downloads Downloads Downloads Downloads PyPI - Downloads Conda Version PyPI version Conda Platforms

conda-forge feedstock

Conda-forge feedstock

pyramids - GIS utility package

pyramids is a GIS utility package built on top of GDAL/OGR for working with raster data (GeoTIFF, NetCDF), vector data (shapefiles, GeoJSON), and multi-temporal datacubes.

pyramids at a glance — every GDAL format, none of the boilerplate

pyramids-gis is licensed under GPLv3 (see LICENSE.md). The platform wheels published on PyPI bundle GDAL and its native dependencies (PROJ, GEOS, libtiff, NetCDF-C, HDF5, libcurl, …) — each under its own MIT, BSD, LGPL, or Apache license. The full attribution list and shipped license texts are documented in THIRD_PARTY_LICENSES.md; if you use pyramids-gis in publications please also cite GDAL itself per gdal.org/cite_gdal.html.

graph LR
    GeoTIFF & NetCDF & Shapefile & UGRID -->|read| pyramids
    subgraph pyramids
        direction TB
        Dataset
        NetCDF_class[NetCDF]
        UgridDataset
        DatasetCollection
        FeatureCollection
        subgraph Engines["Dataset engines (ds.io · ds.spatial · ds.bands · ds.analysis · ds.cell · ds.vectorize · ds.cog)"]
        end
        subgraph Plotting["Plotting layer — _plot_helpers.render_array · mesh_render · NetCDFPlot · Selectors / ColourOpts / FacetSpec · basemap"]
        end
    end
    Dataset -->|crop · reproject · align| Dataset
    Dataset --- Engines
    FeatureCollection -->|rasterize| Dataset
    UgridDataset -->|interpolate| Dataset
    Dataset -->|vectorize| FeatureCollection
    DatasetCollection -->|lazy temporal stack| Dataset
    NetCDF_class -->|extends| Dataset
    Dataset & NetCDF_class & DatasetCollection & UgridDataset -->|plot| Plotting
    Plotting -->|delegates| cleopatra(["cleopatra<br/>ArrayGlyph · MeshGlyph · tiles"])

For the class relationships, internal layers, and detailed architecture diagrams, see docs/overview/architecture.md.

Main Features

  • Dataset - Read, write, crop, reproject, and align single-band and multi-band rasters (GeoTIFF) with full no-data handling and coordinate reference system support. Public API is organized into seven engine collaborators (ds.io, ds.spatial, ds.bands, ds.analysis, ds.cell, ds.vectorize, ds.cog); same-named facade methods on the Dataset itself keep the short form working — ds.crop(mask) and ds.spatial.crop(mask) are equivalent.
  • NetCDF - Extends Dataset for NetCDF files with time/variable dimensions and CF conventions metadata. Optional xarray interoperability. NetCDF.plot exposes an xarray-aligned plotting API (variable= + grouped Selectors / ColourOpts / FacetSpec dataclasses, curvilinear coords=, kind=, animate=, lazy chunks=).
  • UgridDataset - Read and visualize UGRID-1.0 unstructured meshes (triangles, quads, mixed). Supports mesh-to-raster interpolation and mesh-to-vector export.
  • DatasetCollection - Manage time-series of co-registered rasters as a lazy temporal stack (per-timestep gdal handles open on demand; the full cube is never materialised in RAM) with optional dask-backed reductions and groupby.
  • FeatureCollection - Work with vector data (shapefiles, GeoJSON) through a unified GeoDataFrame and OGR DataSource interface, including rasterization and geometry operations.
  • Plotting - Dataset / NetCDF / DatasetCollection / UgridDataset all expose a plot method backed by cleopatra (the [viz] extra), routed through a shared pyramids.dataset._plot_helpers core. Optional web-tile basemap underlays via pyramids.basemap.add_basemap (a thin wrapper over cleopatra.tiles.add_tiles).
  • Cloud-Optimized GeoTIFF (COG) - First-class read/write/validate support via ds.to_cog, ds.is_cog, and ds.validate_cog.
  • Spatial operations - Align rasters to a reference grid, reproject between coordinate systems, crop to vector boundaries, and convert between raster, NetCDF, and vector formats.

Installing pyramids

Installing pyramids from the conda-forge channel can be achieved by:

conda install -c conda-forge pyramids

It is possible to list all the versions of pyramids available on your platform with:

conda search pyramids --channel conda-forge

Install from GitHub (development)

To install the latest development version, you can install the library from GitHub:

pip install git+https://github.com/serapeum-org/pyramids

Note: installing from GitHub uses the sdist and requires a pre-installed system GDAL. See the full installation guide and troubleshooting for details.

pip

To install the latest release from PyPI:

pip install pyramids-gis

Optional extras

pip install pyramids-gis[viz]      # cleopatra plotting support
pip install xarray                 # to_xarray / from_xarray / to_netcdf interop (peer dep, not an extra)

Quick start

from pyramids.dataset import Dataset

# Open a raster file
src = Dataset.read_file("path/to/raster.tif")
print(src.epsg)        # coordinate reference system EPSG code
print(src.cell_size)   # pixel resolution
print(src.shape)       # (bands, rows, columns)

# Read the raster data as a NumPy array
arr = src.read_array()                  # all bands
band0 = src.read_array(band=0)          # one band

# Spatial ops route through the spatial engine; the facade stays short
reprojected = src.to_crs(to_epsg=3857)  # same as src.spatial.to_crs(...)
from pyramids.netcdf import NetCDF
from pyramids import Selectors, ColourOpts, FacetSpec   # grouped plot options

# Open a NetCDF file
nc = NetCDF.read_file("path/to/data.nc")
print(nc.variables)

# xarray-aligned plotting (needs the [viz] extra)
nc.plot("t2m", selectors=Selectors(time="2020-07-01", level=850),
        colour=ColourOpts(cmap="coolwarm", robust=True))
nc.plot("t2m", facet=FacetSpec(col="time", col_wrap=4))   # small multiples
nc.plot("t2m", animate="time", chunks={"time": 1})        # lazy per-frame animation
from pyramids.feature import FeatureCollection

# Open a vector file
vector = FeatureCollection.read_file("path/to/shapefile.shp")
print(vector.epsg)            # CRS EPSG code
print(vector.total_bounds)    # (minx, miny, maxx, maxy)
from pyramids.dataset import DatasetCollection

# Build a lazy stack of co-registered rasters (no pixels read yet)
cube = DatasetCollection.from_files(["a.tif", "b.tif", "c.tif"])
print(cube.time_length, cube.shape)

# Reductions over the time axis use dask under the hood
mean = cube.mean()                       # nan-aware by default

Testing

This project uses pixi as the environment and task manager.

# Install dependencies and create dev environment
pixi install -e dev

# Run all tests (excluding plot tests)
pixi run -e dev main

# Run plot tests only
pixi run -e dev plot

# Run a specific test file
pixi run -e dev pytest tests/netcdf/test_dimensions.py -v

# Run a single test by node id
pixi run -e dev pytest tests/netcdf/test_dimensions.py::TestStripBraces::test_with_braces -q

Docker

A Dockerfile is provided to run pyramids-gis in a controlled environment with the correct GDAL stack preinstalled via conda-forge. The image uses a multi-stage pixi build for a minimal production container.

Build the image:

docker build -t pyramids-gis:latest .

Run the container (mount your current folder as /workspace):

docker run --rm -it -v ${PWD}:/workspace pyramids-gis:latest bash

Inside the container you can verify the package is installed:

python -c "import pyramids; print('pyramids', pyramids.__version__)"

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

pyramids_gis-0.35.0.tar.gz (655.0 kB view details)

Uploaded Source

Built Distributions

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

pyramids_gis-0.35.0-cp314-cp314-win_amd64.whl (36.4 MB view details)

Uploaded CPython 3.14Windows x86-64

pyramids_gis-0.35.0-cp314-cp314-manylinux_2_39_x86_64.whl (48.9 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ x86-64

pyramids_gis-0.35.0-cp314-cp314-manylinux_2_39_aarch64.whl (48.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ ARM64

pyramids_gis-0.35.0-cp314-cp314-macosx_11_0_x86_64.whl (45.7 MB view details)

Uploaded CPython 3.14macOS 11.0+ x86-64

pyramids_gis-0.35.0-cp314-cp314-macosx_11_0_arm64.whl (41.6 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pyramids_gis-0.35.0-cp313-cp313-win_amd64.whl (35.4 MB view details)

Uploaded CPython 3.13Windows x86-64

pyramids_gis-0.35.0-cp313-cp313-manylinux_2_39_x86_64.whl (48.9 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

pyramids_gis-0.35.0-cp313-cp313-manylinux_2_39_aarch64.whl (48.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ ARM64

pyramids_gis-0.35.0-cp313-cp313-macosx_11_0_x86_64.whl (45.7 MB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

pyramids_gis-0.35.0-cp313-cp313-macosx_11_0_arm64.whl (41.6 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyramids_gis-0.35.0-cp312-cp312-win_amd64.whl (35.4 MB view details)

Uploaded CPython 3.12Windows x86-64

pyramids_gis-0.35.0-cp312-cp312-manylinux_2_39_x86_64.whl (48.9 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

pyramids_gis-0.35.0-cp312-cp312-manylinux_2_39_aarch64.whl (48.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ ARM64

pyramids_gis-0.35.0-cp312-cp312-macosx_11_0_x86_64.whl (45.7 MB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

pyramids_gis-0.35.0-cp312-cp312-macosx_11_0_arm64.whl (41.6 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyramids_gis-0.35.0-cp311-cp311-win_amd64.whl (35.4 MB view details)

Uploaded CPython 3.11Windows x86-64

pyramids_gis-0.35.0-cp311-cp311-manylinux_2_39_x86_64.whl (48.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

pyramids_gis-0.35.0-cp311-cp311-manylinux_2_39_aarch64.whl (48.4 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ ARM64

pyramids_gis-0.35.0-cp311-cp311-macosx_11_0_x86_64.whl (45.7 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

pyramids_gis-0.35.0-cp311-cp311-macosx_11_0_arm64.whl (41.6 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

Details for the file pyramids_gis-0.35.0.tar.gz.

File metadata

  • Download URL: pyramids_gis-0.35.0.tar.gz
  • Upload date:
  • Size: 655.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for pyramids_gis-0.35.0.tar.gz
Algorithm Hash digest
SHA256 09f11382c60dfc59eaa5ba029bd523915cb1008ff6b484f246e12b6095ae33a5
MD5 3503a549692b242397e80c2ccc43644d
BLAKE2b-256 e6e7af753900ba3606423566dfe457ffbb2ff10d68cbcb15b4d4158075690b1b

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 82905872709aee80a12f63025dc1075fc57427ff9eee3e02430cf153c747d3d2
MD5 99554fa6f40c997cbea83c1000b2e5cd
BLAKE2b-256 34eb6be70fdb6206ddf982409b0834488a8a0c220686ba6f85d44bd745d3a5c1

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp314-cp314-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp314-cp314-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 0853639e42a31fbe7d76d8c9c7e3d656c1ce7d731859bf29a8ff4a39bc1a3f81
MD5 3ee0e642a55a38c3ccb373ce08e24a00
BLAKE2b-256 2edab60c1cd01dc1f2843759d7569029ca8f420fb646362941cd1043aec4af29

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp314-cp314-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp314-cp314-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 de3cee06d68475371cdd7f4864ee875f70c8f10b2f935fa2036283b15ea8ec18
MD5 458952d8e68824e44a2ad7eb809d377e
BLAKE2b-256 d2a0445a496902c51e370adf6ab8a7de0b1587a7159b3932e1fd6d74e8728cdb

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp314-cp314-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp314-cp314-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 eff7d74abccf0004ce5ddb55438051b11da1a98954dbfb0ec7000498b034063f
MD5 ac7b3ebbd4d436cb39c958fc1f4da6b7
BLAKE2b-256 07d0aa9f2fef29cb570eceaf5107ff54acc6811d7b86743c339f37d46305360b

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp314-cp314-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4cf121b0019b2949a6e62c851837ab0a81afd5d0e220457e6f835a11e7b7ee2b
MD5 272ce083916f70dfddba7dc06db2c417
BLAKE2b-256 00ce74e896868b0ad60570bd32c840d95f74116b21ee68436bc2ca273c3f2f7b

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp313-cp313-win_amd64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 8e49534835c38be94406bf10479c57182679dfc1dd589be1e0097acdfc30e948
MD5 d776e6d97d74238c360e83a87dee60c0
BLAKE2b-256 9f29520ba71d7229a79029665c8d767bbfe457a059458591b834065159c74379

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp313-cp313-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 959565b861e0661faf0cebf5dd19dab5e4da49296166a235725ae2c3ed95d15f
MD5 c5fa737df679e91643286d380aec2cbd
BLAKE2b-256 53f956ada3ebfbf18cbd6fe4da0d7d2d4bde9a25c863399ef218f8a78ab4f756

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp313-cp313-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp313-cp313-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 d6eabfee4e14c5722bfe975cdc1d72a3acb0251b03b8cf0b577623b10de4fa28
MD5 2d9a65b585857f10bc6e70f079d547e5
BLAKE2b-256 1ebce91bbbe25ff1569c4ddd2c85e5c31c0500c979571a0efe09e915f43e8183

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp313-cp313-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 bd7ee7198ce605669afaa434d1720900c3fc3ba4e503385c3e11f3d7f6b06a7d
MD5 2a00b9965bd27c4a5214a8624ce255f6
BLAKE2b-256 aaf4cd2f6562f1f730aee1a13a9c1ca180ed7abf17ddce37a3914e06cb5c6928

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 25953232d7dde5be10310c4223166e4b61dcf399be33991e4b5a1927ba84f0b3
MD5 865f0a8c9dd375676753d44cc96ccfdb
BLAKE2b-256 079564cb653a8846d82627bfba9b2e970107ec3945ceba0440d8e64414827114

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp312-cp312-win_amd64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bb2bfb6469d8284e3bed95dcd89c14a2a787203cf53a5bec77ab3241d4f02857
MD5 5ee0b96143f5e19364540d561e82794d
BLAKE2b-256 14274dd1877078ab5e9f63ff13f5824bc5659e38710520340938102236e4414e

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp312-cp312-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 c179cb1244c7ca63ba5502d4554177bcb3959c993ccadb556841b901fc49bec0
MD5 9ccc726055095ea39800d71734e0b1c8
BLAKE2b-256 831896c1b4f82066d6e61964cc3e69b0e28514a9115b948c513cea32f30fd36e

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp312-cp312-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp312-cp312-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 c24f88a94fcbdfb649ef027b0be10f84cc56462f23f68cbc281e1f3e79c6a12a
MD5 4d5913e38da3c1962ced7c427431aeab
BLAKE2b-256 b26142bb80453964b55f01eea365eeee5075d1bd467c5a2588475d6b763b7648

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp312-cp312-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 9eed5a1edaf568e550b7c696cd610385b9a03a492d7155d67c24df85ce99d07e
MD5 ff8d01f78bc5613b04387a36b01177fb
BLAKE2b-256 6d7e6686eaaef14c8a80131ce2f35491e2753b8cb353854db6ba0065bca65f7e

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5cd2b5b259b15897f67a06f82e94b9ca69959884603862bdf59fae92cb5b0faf
MD5 78a338f4dc0555d435eee78ec1bd0d70
BLAKE2b-256 d9fa9895aa4b8e6a6ccb4ad91ff221f3a16dd1880e492a57f94a9d41bb855be0

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp311-cp311-win_amd64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 38b62102d3dbde3c43c08a99a9ab46d7d01b0eb4f927d0c9abc3ab01051cdba1
MD5 672def11d62328776ec2fe5a6b1a503a
BLAKE2b-256 14048dba88566064c2f24a15124be7a733517f374d8f5e3d23304d53f4b0f6e9

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp311-cp311-manylinux_2_39_x86_64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 ea3f99f52ddf25162a142ee01342903f0c7d32e7fc595b9a8298d8978ef59841
MD5 e73c081737d1246dcef026c38ce6d3ed
BLAKE2b-256 80638e6e6aafc4ae6a40d776b38b3ef39688c708ffd4167c67ab2d0ba46244c8

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp311-cp311-manylinux_2_39_aarch64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp311-cp311-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 717b22452625ee2ead55435967d81fc4816f4d9d77318000e9e165b159b31411
MD5 e84f53f3332fea17d4d176d46c4c9d3b
BLAKE2b-256 00682ef9b648094a0d68b5dec37e015ed3e08c4c7859a5a06275977b7572f8d9

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp311-cp311-macosx_11_0_x86_64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 4ce8633b4e92207f2a86c34cedcda99591250e7337b5bdd7bb9e301649be2c56
MD5 9a16444bfdd33851607e8bf3ef333ad1
BLAKE2b-256 1f595777d5f3d06950f9bc41e5ebb40b7c6cdb2c0d3a7f581b001d485efc6df0

See more details on using hashes here.

File details

Details for the file pyramids_gis-0.35.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for pyramids_gis-0.35.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 c0e3bf1df37c0fdd5fc235cbf8367dadd45c12f80e03b8ca6a33ca09d746e81c
MD5 c3cb3a8dc12eb865a37ce23e66515021
BLAKE2b-256 472041fcabe5033613aa98146df9a06a0bf16c5be14ddc8f0a4d1e1d4e0bbd49

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