GIS utility package
Actively maintained. Last release 3 days ago, commits in 26 of the last 26 weeks. A safe choice.
pip install pyramids-coreREADME as published on PyPI with version 0.83.0.
GIS utility package
Actively maintained. Last release 3 days ago, commits in 26 of the last 26 weeks. A safe choice.
pip install pyramids-coreREADME as published on PyPI with version 0.83.0.
PyPI — pyramids-gis (deprecated alias) | — |
conda-forge — pyramids |
pyramids-gisis the deprecated alias ofpyramids-core. Installpyramids-core— the import name stayspyramids.pip install pyramids-gisstill works (it just depends on the matchingpyramids-coreand emits aFutureWarning), so existing pins keep resolving. The conda-forge package name is unchanged:pyramids.
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-core 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-core 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]
MeshDataset
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 / FacetSpec / CoordinateSpec · basemap"]
end
end
Dataset -->|crop · reproject · align| Dataset
Dataset --- Engines
FeatureCollection -->|rasterize| Dataset
MeshDataset -->|interpolate| Dataset
Dataset -->|vectorize| FeatureCollection
DatasetCollection -->|lazy temporal stack| Dataset
NetCDF_class -->|extends| Dataset
Dataset & NetCDF_class & DatasetCollection & MeshDataset -->|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.
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.plot exposes a labeled-array-style plotting API
(variable= + grouped Selectors / FacetSpec dataclasses, loose colour kwargs (cmap, robust, …),
curvilinear coordinates via axes=CoordinateSpec(...), kind=, animate=, lazy chunks=).Dataset / NetCDF / DatasetCollection / MeshDataset 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 the cleopatra glyph add_tiles method).ds.to_cog,
ds.is_cog, and ds.validate_cog.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
To install the latest development version, you can install the library from GitHub:
pip install git+https://github.com/serapeum-org/pyramids-core
Note: installing from GitHub uses the sdist and requires a pre-installed system GDAL. See the full installation guide and troubleshooting for details.
To install the latest release from PyPI:
pip install pyramids-core
pip install pyramids-core[viz] # cleopatra plotting support
pip install xarray # to_xarray / from_xarray / to_netcdf interop (peer dep, not an extra)
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, Selectors, FacetSpec # grouped plot options
# Open a NetCDF file
nc = NetCDF.read_file("path/to/data.nc")
print(nc.variables)
# labeled-array-style plotting (needs the [viz] extra); colour knobs are loose kwargs
nc.plot("t2m", selectors=Selectors(time="2020-07-01", level=850),
cmap="coolwarm", robust=True)
nc.plot("t2m", facet=FacetSpec(col="time", col_wrap=4)) # small multiples
nc.plot("t2m", animate="time") # 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
pyramids is the GIS engine at the centre of a small family of packages. There are three ways other packages relate to it:
pyramids.raster_drivers, pyramids.vector_drivers,
pyramids.mesh_drivers, pyramids.plot_backends, pyramids.compute_backend, pyramids.cli_commands,
pyramids.gdal_plugin_path) — install one and pyramids discovers it automatically, no code change. Current
plugins: pyramids-eo (Earth-observation raster sources),
pyramids-mesh (hydraulic/simulation mesh formats),
pyramids-citymodels (CityJSON / CityGML / 3D Tiles),
digitalearth (interactive / 3-D / web plot backends), and
pyramids-lazy (Dask out-of-core compute — chunked reads,
Zarr & kerchunk writes). See the plugins catalog and
Extending pyramids to write your own.pointclouds, the GDAL-free point-cloud engine, which
declares an optional [gis] extra (on pyramids-core) as its seam for interop toward pyramids.pyramids-qgis, which exposes pyramids as a QGIS Processing
provider (see Using pyramids in QGIS).The full map, with the libraries pyramids builds on and the peers you might reach for alongside it, is in the Ecosystem guide.
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
Performance benchmarks run nightly and publish a trend chart — with ≥ 1.5× regression alerts — at https://serapeum-org.github.io/pyramids-core/bench/. See the Testing in CI guide for details.
A Dockerfile is provided to run pyramids-core 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-core:latest .
Run the container (mount your current folder as /workspace):
docker run --rm -it -v ${PWD}:/workspace pyramids-core:latest bash
Inside the container you can verify the package is installed:
python -c "import pyramids; print('pyramids', pyramids.__version__)"