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

Uploaded CPython 3.14Windows x86-64

pyramids_gis-0.24.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.24.0-cp314-cp314-manylinux_2_39_aarch64.whl (62.5 MB view details)

Uploaded CPython 3.14manylinux: glibc 2.39+ ARM64

pyramids_gis-0.24.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.24.0-cp314-cp314-macosx_11_0_arm64.whl (51.2 MB view details)

Uploaded CPython 3.14macOS 11.0+ ARM64

pyramids_gis-0.24.0-cp313-cp313-win_amd64.whl (36.2 MB view details)

Uploaded CPython 3.13Windows x86-64

pyramids_gis-0.24.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.24.0-cp313-cp313-manylinux_2_39_aarch64.whl (62.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.39+ ARM64

pyramids_gis-0.24.0-cp313-cp313-macosx_11_0_x86_64.whl (56.5 MB view details)

Uploaded CPython 3.13macOS 11.0+ x86-64

pyramids_gis-0.24.0-cp313-cp313-macosx_11_0_arm64.whl (51.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

pyramids_gis-0.24.0-cp312-cp312-win_amd64.whl (36.2 MB view details)

Uploaded CPython 3.12Windows x86-64

pyramids_gis-0.24.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.24.0-cp312-cp312-manylinux_2_39_aarch64.whl (62.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.39+ ARM64

pyramids_gis-0.24.0-cp312-cp312-macosx_11_0_x86_64.whl (56.5 MB view details)

Uploaded CPython 3.12macOS 11.0+ x86-64

pyramids_gis-0.24.0-cp312-cp312-macosx_11_0_arm64.whl (51.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

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

Uploaded CPython 3.11Windows x86-64

pyramids_gis-0.24.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.24.0-cp311-cp311-manylinux_2_39_aarch64.whl (62.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.39+ ARM64

pyramids_gis-0.24.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.24.0-cp311-cp311-macosx_11_0_arm64.whl (51.2 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

File details

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

File metadata

  • Download URL: pyramids_gis-0.24.0.tar.gz
  • Upload date:
  • Size: 514.1 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.24.0.tar.gz
Algorithm Hash digest
SHA256 31ad63fc52ddaec8d298831838eab08addc0768c607f8021f103f6a89ead4aa4
MD5 9bf273321cfe56065028de71ac75605b
BLAKE2b-256 456f6ab3b7506ee5432f20c8cb3a304d0f8d2a796c7fb2ca01d82f3678b1a26f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 694b18779f8afb435fb6f738983cf20e73ca91d5e2416e4d0ee654cf0e1effcd
MD5 93ac661da5e203d301bd4ddd6c42864f
BLAKE2b-256 5ee71f22b227631b4f427848891ff23b42b83cf8e1907e1f8837ec83b38e0f80

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp314-cp314-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 dfa4aef040af026133ccdaf6eca15b5a1a91cf03a98aae6bc60dc6ed40806c8c
MD5 242b5f43bbd7e7844ead6c9eaa2149df
BLAKE2b-256 0b92970c72d4ebc1c906db1c33ec452cc6776b66040a63781e9fb05d8ddc6f4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp314-cp314-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 999c01d160304cdbce02764b69bd6cc38cd7f43aa892b990fa94ab591385f569
MD5 02656c6578b5ef08095f7394eb12a8ac
BLAKE2b-256 9ca334c9c4a359274446dd88779438a5a9aead0cf7d964c248c4432b484f1f60

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp314-cp314-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 1048dc48495e20a7f3bad46bfb7333e59bb2c319233f4014a420280d36abc8c0
MD5 ec305c86e05d4f6e605283a67ca06fbd
BLAKE2b-256 5e47c983a5d60381e8f4e783f88d259fe35ab3abd24f02e88b5ea25123cd30ed

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp314-cp314-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 27dd7c7214e3ef58ab39008a6d627ec71785638cfd919f9ba1ad790f6082b3b4
MD5 f1d66310cb5d5361d4aa8cb372e5f6d7
BLAKE2b-256 a2468982c159bd863e73779bbee8ff8e67fe862c5e8734e41b9ffc5d6f524b20

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 7aead982e812b1ba5fcb57fa13ec3efbb495633945d0865648284a1b9ea73598
MD5 84ec766e8c03a42c29354edb94a0fb8f
BLAKE2b-256 d629433ee2d0ca45055f4ac426c2791b28e001c876f64480a4abdbafdc14148f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp313-cp313-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 96d402596a7897589065a10aca3f9c3e3d19e1ca1700451714eba914d80fd18c
MD5 2c0078ad2e6236121452d06cbd76ed29
BLAKE2b-256 eec8200c0c7e4843c9e8d66b1aa08b60787476eb883f51a7d5fe28a36f77b361

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp313-cp313-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 d3812e0e04dc49ac1630cf1c7d459f651ba8042e86042cf10332b468777bb180
MD5 3e065834fd9778de2f3fb2946bb9b283
BLAKE2b-256 2cd4e1fce3bf8297e46bab16197f515da69ee409c1f67ece17d17c04fca9dced

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp313-cp313-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 0d64ff0994bc8ca44dd49940fbc807f2cb6d726ae5f9a18b58d25b9d1cd321ce
MD5 ede24b028b81d410ab86e79e605d9e76
BLAKE2b-256 ed761ec3290ae1a6e9d643eb4deedf76e4ef9f3d58fe11624dd2bdbde5feb256

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 447d912d549077fca6fb07edb1bd49f4cae1ef48e011ec29b5664bc663b08757
MD5 fbc25cb3389fb6b355e2009093144941
BLAKE2b-256 42f1b7d4c982e0ddd4858c267b6ebe56126b49b40a0e6d5691cdf5d9b84f3023

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 7edc6aef2a52e8419bf305f724c45ec7cd72869656204413fffda1a62ef8e32a
MD5 273db29c03b90463e0463ace2a73fe30
BLAKE2b-256 10081c8b1cc4caf2a97f71900a92d95269183e254d84f6125e087409f57407e0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp312-cp312-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 125233533d75cb87a06d860b72089ebd3bc4b1aea4adad7649b7121b2915af37
MD5 576d7517f857d8422cd7d6eac1cfad66
BLAKE2b-256 c3494e240a9156a17e9936d23c9e93401e42e4bb001edc277feddd1d50800af5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp312-cp312-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 d2e49e3c40e597ea4df1f7cbf8af35a4e6b033c14433602566f0edd1515c96a9
MD5 b2680d0fda64abe13632d18e43b23d49
BLAKE2b-256 630f4557852c0d530f17b615f5b3f4840fba2b989643753887e1a0646a24ed8c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp312-cp312-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 87f98068c30ae50d34ff33e388a225c00be3d2d9b0d5904121f5640fd97c64d5
MD5 916d034497244609b55e8c9a6943e0bf
BLAKE2b-256 e7e7aae16f9ca1c86a2302736c2006b642d8d29bb8f60efcecda96533fb744df

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 d4bec3c5fdbaf88f7955cc1ddb07e7ae177bde62bcdb2f715b6842579eda0590
MD5 e84affb863a7ac0067e21c7dceaac09a
BLAKE2b-256 9d2ed859cf573f62d6a3287601c8112915cfbfd0a7d018f9e07be6e32b5ab2e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 74c4b150be987d10f233ec5fd6c5ad167306a5823f2932610be8c6edd56cac48
MD5 0c6a5e59e70aa878b82e06b2d86507b9
BLAKE2b-256 f7eb06146162ee164e8724cbde956b538e3966ea627d856fb44895ed4420affa

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp311-cp311-manylinux_2_39_x86_64.whl
Algorithm Hash digest
SHA256 e5584caa055fed748ed987f5bd858324dfc51525917b31d23c5921fe198fc507
MD5 4f46a183f635689b86ce8868921a864e
BLAKE2b-256 d230ec781c45e7a83c41d006ff12f7021e4d74111da29be551cc2681909bc935

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp311-cp311-manylinux_2_39_aarch64.whl
Algorithm Hash digest
SHA256 7ca070bf7f15285fb72088308cc0f913c05ff801fbf1f15d65e2196bf5fbb82f
MD5 47878c421dc33f3be7777cc97b7b7a52
BLAKE2b-256 735803c1cef9ea5fa508b5c32e390efff3323144ace7ca0620bbfa2389f2b5e9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp311-cp311-macosx_11_0_x86_64.whl
Algorithm Hash digest
SHA256 f84d93947a66f330b345424336fda55377f15a980d44b111d7728fd51408c4bf
MD5 bc49cbf2597e934781e71e8a255bf89e
BLAKE2b-256 a297cc015f88edb3706ea272d586cd1880a5fc896d8c2ea1d9a9ea7713122c4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pyramids_gis-0.24.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 5ff32794c4976880abd53e7dbf3142af2f1d27c8309c47b00c8ccd05e6023a0b
MD5 92c88d5757e058f6ed92c8cc18b20f52
BLAKE2b-256 210868f3af4aad09739b906fc6d429eb625789f009a90bc0ea85102a90cef407

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