Skip to content

Dataset#

Dataset is the core raster class. It wraps a GDAL raster (GeoTIFF, NetCDF, ASCII, COG, …) and exposes a high-level, Pythonic API for reading, transforming, analysing, and writing geospatial rasters. NetCDF and DatasetCollection build on top of it.

The model#

  • A Dataset has one or more bands over a regular grid, georeferenced by a geotransform (origin + cell size) and a CRS (EPSG).
  • Reads are eager by default (NumPy); pass chunks= to read lazily as a Dask array.
  • Cells that don't hold data carry a no-data sentinel.

A first look#

from pyramids.dataset import Dataset

ds = Dataset.read_file("dem.tif")
ds.shape, ds.band_count, ds.epsg, ds.cell_size   # grid + georeferencing
arr = ds.read_array()                            # (bands, rows, cols) NumPy array
ds.to_file("copy.tif")                           # driver inferred from the extension

Useful attributes: shape, rows, columns, band_count, band_names, epsg, crs, cell_size, geotransform, bbox, bounds, no_data_value, dtype, meta_data. The full, always-current list is generated from the source in the API reference.

What you can do#

The operations are demonstrated as short, runnable notebooks — start from the "How do I…?" index. In brief: