Skip to main content

GIS utility package

Project description

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-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 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 pyramids-gis[xarray]   # xarray/NetCDF4 interoperability

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


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.22.0.tar.gz (464.6 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.22.0-cp314-cp314-win_amd64.whl (37.2 MB view details)

Uploaded CPython 3.14Windows x86-64

pyramids_gis-0.22.0-cp314-cp314-manylinux_2_39_x86_64.whl (64.6 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ x86-64

pyramids_gis-0.22.0-cp314-cp314-manylinux_2_39_aarch64.whl (62.4 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ ARM64

pyramids_gis-0.22.0-cp314-cp314-macosx_11_0_x86_64.whl (56.5 MB view details)

Uploaded CPython 3.14macOS 11.0+ x86-64

pyramids_gis-0.22.0-cp314-cp314-macosx_11_0_arm64.whl (51.1 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pyramids_gis-0.22.0-cp313-cp313-win_amd64.whl (36.1 MB view details)

Uploaded CPython 3.13Windows x86-64

pyramids_gis-0.22.0-cp313-cp313-manylinux_2_39_x86_64.whl (64.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ x86-64

pyramids_gis-0.22.0-cp313-cp313-manylinux_2_39_aarch64.whl (62.4 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ ARM64

pyramids_gis-0.22.0-cp313-cp313-macosx_11_0_x86_64.whl (56.4 MB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

pyramids_gis-0.22.0-cp313-cp313-macosx_11_0_arm64.whl (51.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyramids_gis-0.22.0-cp312-cp312-win_amd64.whl (36.1 MB view details)

Uploaded CPython 3.12Windows x86-64

pyramids_gis-0.22.0-cp312-cp312-manylinux_2_39_x86_64.whl (64.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ x86-64

pyramids_gis-0.22.0-cp312-cp312-manylinux_2_39_aarch64.whl (62.4 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ ARM64

pyramids_gis-0.22.0-cp312-cp312-macosx_11_0_x86_64.whl (56.4 MB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

pyramids_gis-0.22.0-cp312-cp312-macosx_11_0_arm64.whl (51.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

pyramids_gis-0.22.0-cp311-cp311-win_amd64.whl (36.2 MB view details)

Uploaded CPython 3.11Windows x86-64

pyramids_gis-0.22.0-cp311-cp311-manylinux_2_39_x86_64.whl (64.9 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ x86-64

pyramids_gis-0.22.0-cp311-cp311-manylinux_2_39_aarch64.whl (62.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ ARM64

pyramids_gis-0.22.0-cp311-cp311-macosx_11_0_x86_64.whl (56.5 MB view details)

Uploaded CPython 3.11macOS 11.0+ x86-64

pyramids_gis-0.22.0-cp311-cp311-macosx_11_0_arm64.whl (51.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

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

File hashes

Hashes for pyramids_gis-0.22.0.tar.gz
Algorithm Hash digest
SHA256 1d498857b97df3e05dd41785f45f22292a015aed87a60f342bcb570feb03588c
MD5 94144745fa9cd779ebeb2b98958e7299
BLAKE2b-256 58e8f665d62f6744440fd81ec98c58ed50e276a7f2daa660f92be839c3d1ce91

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 95d1be1214637127723792c032063789f6e5108180f907e7ae8120458cbdb136
MD5 9a4864e16f016bd8e8d3dd1ef06ae0b5
BLAKE2b-256 116b6c7693cf07e4a3880c47af9d4e260c3d79dd10bac32f4924015566f28026

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp314-cp314-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 da8da81ca132bef4cefcb605361f9905abf30c94c8c4e9698e67852b75116f54
MD5 620e999238f4b45dd8a7c1f312cb67b9
BLAKE2b-256 c8314868c1c1b38a5f4ffdf8754012e2cc426954a57c98c6bf10dc503ba085c4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp314-cp314-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 659d291ea9583a86f311ac93a87cc9a20043c0c5ffbdcce8e36c6310c1319502
MD5 0e53ca7cf74c7818197b26b86c39be2a
BLAKE2b-256 2b7ad698ee77385a8c28778df4fb049aaf2c852359598333000a3491b3ea1491

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp314-cp314-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 507f5f2e920b72d2be9a2fd2eacc28b312d634acbd897fc8339cd450b3fe637c
MD5 07e62839ffd2596a0b8792f92f300e8b
BLAKE2b-256 fb7c1fc440cf581cf561c448c2218fe4a3e5e0e11c9ba1ad734b88c0f2667f61

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 6e75568895e57bc734813c77e50d3daa0a42ec81b9a4c835a31c358d0daecd7f
MD5 c15abeb87e3b01c303b23687f596162e
BLAKE2b-256 09ac35cad75e920c179ff2332eb3cf827f1fb9e575bbf0764ca973e00bd6a039

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7c2c1c1851ba988a38621ffddb3adf14c7fb9685f74ac961d79532e227b11833
MD5 ac3ffc4834363c65be18c01589e4d6c2
BLAKE2b-256 d65a25842b471ea7fdcec365624b981920677a0e1113ca1040bb41f1bc236790

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 43e3bbe8630f6f636215523ee33a2488cffadf6a7184d4967d46d4a05402f76b
MD5 7d3e25014d48d9a937002e3525c11f9d
BLAKE2b-256 b29a8f8e7131cfa02c818dcc4d86c69d3a71f3ded1ba4ab5e10792d35c8d9a74

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp313-cp313-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 2394dcdc0c64e66e9ab4a915fd5297cc316574d6da66268b27489bcd235b9391
MD5 147cc07d808eb77b033a320b82e3d892
BLAKE2b-256 a657fae648020e12be26369ec0cfaf2262ae083fbce0d405916cf8a89843cbc7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 cd94de5b94bc6e06f3c0db78a47a7320e10f2b2d444463c5b513553a68aa2204
MD5 0cea1decefd9b43f29dd9f63ed31032a
BLAKE2b-256 faadade29933e8687c257e8dfbba071863cc4a704c97de4f9736fb61c7b459f1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d5ef75116ed8734f5c7a97fffef61e496ac78b5cbb08253eec4471bb67584c97
MD5 50006f14d110fa5f089825c5e11d7de8
BLAKE2b-256 5e8d3c98bff5a12de64921bf2c36f8d9f15a55c72c03615b54a454ce5ffd37a9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 bc5b8436aed5beb75314cb48fce17e0ea40508a95f7860492b5d668c0aaa3fa5
MD5 2f89151ff06dbe606efbc2b51a5e4456
BLAKE2b-256 71d448bc6b04efae65cbb78c0346b7843baf707064f94aeb55594e02b582f125

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 7ad3dea7f6ed463f7d8b823e1db737168b34716bcc7cee9b42f7847890ce5765
MD5 df0102943a8102bafb221840379ac226
BLAKE2b-256 fdf98dc848a738dc508670ad22568e441f37000e684b5dc578a45e2659951749

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp312-cp312-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 1d0d98cea29e6b51cd001b76347372da816a883a7fd851d4e3192e6853ada77d
MD5 baed9bdb67ec538b530eccc7e8ec0f71
BLAKE2b-256 93428b826daff6de62e8ca8ed1bb3dc8b9847860477e960db058acc1a4f82c4d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 63c8281619767ad1b24e7478fd58e1fe17e880f9ac1fe0ad26973a60cd5f9c43
MD5 cb94af91e003de8a1e4fe8ac7e0b51cb
BLAKE2b-256 f68284a0381250053b6212f3a5664b468210d200af6f4d9b5ddfa268c10b9e51

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 74f793bdfb338f2c5feaf745c607df157b41adca5249c1e14054fa89279913cf
MD5 44b9027daed891c336e8968676755fc0
BLAKE2b-256 92563196d06e39614dc0e9da7bb91742921917796443a01f97a6d161a278ab83

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 fa912c1a9020dce306db54d6589cd8d8297b3aa7b13a4408585730464043a59d
MD5 42822364625dcd7b44f8c348da4fbe82
BLAKE2b-256 0dda186ff4baf23f08a7310250146f365e414004d141d6c80139cd32c62c4b20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 94edf97524153e63aa49cd41d298966aa81d8f0b837789956795b707c1dc7c92
MD5 8206a238e88e80668de4b811ef2c52e3
BLAKE2b-256 48ac2c49f9a33d9c2a377eccd9ab64bd9cfc901de072734ea0ad4e416f750fe7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp311-cp311-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 7657bd43338b0c3575ea740bb01130e700f27d42cbddac2d2be6421b0da1aaf7
MD5 d8807d30f0985825e97215d8ba7ba3eb
BLAKE2b-256 404c4c98266fbe9fee4e9926e50e10e2939844b55a27b21192dc07fb69b2c225

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 b1ee8194b1aafcc35be3133a5a0ec67e975624d4958521bf9d12b9efc846227f
MD5 0033a693890e36f4cd6168a7b847ce05
BLAKE2b-256 96f31c7b051eb37b60861ff67876276d51ad592a438407ce01f7e3315007cbda

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.22.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 831070ca27dc4e2042e64ef24818b7fcf22ce43d25ef4200b9f2f82d40837bcc
MD5 5cc2eb1172701a97e92148157e6568dd
BLAKE2b-256 f408708beff4ffd046ac59c01ce62c22d6a894a70ab5a3d8e05f70ed1584ef2e

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