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
Datasethas 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:
- Read / write / convert — Dataset basics, format conversions, windowed reads.
- Transform — reproject / resample / align, crop & mask, mosaic & merge, no-data & gap filling.
- Analyse — zonal statistics, extract at points, terrain analysis, raster algebra.
- Raster ↔ vector — rasterize ↔ vectorize.
- Visualize — visualization gallery, color tables, overviews.
- Scale out — using pyramids with Dask.
Related classes#
DatasetCollection— a time-stack of co-registered rasters.NetCDF— multidimensional / CF rasters.FeatureCollection— the vector counterpart.