Computer ScienceTutorial

Python Libraries Every Geoscientist Should Know in 2026

The Python geoscience stack has settled into a stable core: labelled arrays, lazy computation, publication-quality maps, and geospatial machine-learning tooling. Here is what each library is for — and where the documentation lives.

Key facts

  • xarray is the interoperable core: labelled N-dimensional arrays over NetCDF, GRIB, and Zarr data.
  • Dask handles arrays and datasets larger than memory by chunking computation across cores or clusters.
  • PyGMT wraps Generic Mapping Tools for publication-quality maps; GeoViews/HoloViews targets interactive notebook work.
  • TorchGeo provides PyTorch datasets and transforms for satellite imagery, point clouds, and weather data.
  • The code samples below are illustrative examples of each library's API, not runnable pipelines.
On this page

The Python geoscience stack

Python has become the working language of computational geoscience, and the ecosystem has consolidated around a smaller set of libraries than it had five years ago. What follows is the core stack as of 2026, organised by what each tool actually does. The code fragments are illustrative API sketches rather than complete pipelines.

Data processing and analysis

xarray

xarray provides labelled, multi-dimensional arrays that carry their coordinates, dimensions, and metadata. If you work with NetCDF, GRIB, or Zarr data, this is the layer everything else is built on.

import xarray as xr

# Open a climate model output
ds = xr.open_dataset("temperature.nc")

# Select a region and compute an anomaly relative to the time mean
anomaly = ds.temperature.sel(lat=slice(30, 60), lon=slice(-10, 40)) - ds.temperature.mean("time")

Dask

Dask parallelises chunked computation across cores or a cluster, which is what makes terabyte-scale arrays workable. In practice you rarely call it directly — xarray.open_dataset(..., chunks={}) hands the array to Dask and the rest of your code stays the same.

Visualisation

PyGMT

PyGMT exposes Generic Mapping Tools through Python. It is the current recommendation for static, publication-quality maps.

import pygmt

fig = pygmt.Figure()
fig.coast(region="g", projection="W15c", land="lightgray", water="lightblue", frame=True)
fig.show()

GeoViews and HoloViews

GeoViews builds on HoloViews and Bokeh for interactive, browser-based exploration inside notebooks. Choose it when the map is a tool for finding the story rather than the final figure.

Machine learning for Earth science

TorchGeo

TorchGeo supplies PyTorch datasets, samplers, and transforms for geospatial data — satellite imagery, point clouds, and weather fields — including the coordinate-aware sampling that plain vision datasets get wrong.

from torchgeo.datasets import Landsat
from torchgeo.datamodules import InriaAerialImageLabelingDataModule

Verde

Verde handles gridding, trend removal, and blocked cross-validation for spatial data, from the Fatiando a Terra project. Its real value is not the interpolation algorithms but the cross-validation machinery for spatially correlated data, where random train/test splits leak information.

import verde as vd

chain = vd.Chain([vd.Trend(degree=1), vd.Spline()])
chain.fit(coordinates, data)

Data access

  • Copernicus Climate Data Store — ERA5, CMIP6, and the rest of the CDS catalogue via the CDS API.
  • Microsoft Planetary Computer — STAC-indexed satellite and environmental datasets with browser-side computation (planetarycomputer.microsoft.com).
  • Google Earth Engine — the ee Python API for planetary-scale analysis (earthengine.google.com).

Where to start

  1. xarray first. Everything else assumes you can work with labelled arrays.
  2. Add Dask the first time a dataset does not fit in memory, not before.
  3. Learn PyGMT or cartopy for maps depending on whether you need GMT's cartographic conventions or direct matplotlib integration.
  4. Reach for TorchGeo when the input is imagery and the task is supervised learning.
  5. Watch Pangeo for cloud-native patterns; it is the community where the storage and compute conventions get worked out.

The tooling is no longer the bottleneck. The problems — data quality, spatial autocorrelation, scale — still are.

Sources

  1. xarray documentation — xarray developersdocsRetrieved Sep 16, 2026
  2. Dask documentation — Dask developersdocsRetrieved Sep 16, 2026
  3. PyGMT documentation — The PyGMT TeamdocsRetrieved Sep 16, 2026
  4. HoloViz GeoViews documentation — HoloVizdocsRetrieved Sep 16, 2026
  5. TorchGeo documentation — TorchGeo developersdocsRetrieved Sep 16, 2026
  6. Verde — spatial data processing by Fatiando a Terra — Fatiando a TerradocsRetrieved Sep 16, 2026
  7. Copernicus Climate Data Store API — Copernicus / ECMWFdocsRetrieved Sep 16, 2026
  8. Microsoft Planetary Computer — MicrosoftdocsRetrieved Sep 16, 2026
  9. Google Earth Engine — GoogledocsRetrieved Sep 16, 2026

Masood Sultan

Computational geoscientist and AI engineer. Writes about machine learning systems, geospatial data, and the methods behind scientific computing. Published in Journal of Applied Geophysics (2020).