Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

isobands

In seconds, isobands turns a two-dimensional xarray raster into filled contour polygons, using GDAL's in-memory raster and vector datasets. It is useful when a few lines of Python should turn gridded values into analysis-ready GeoPandas geometry—without writing intermediate files.

Alpha: the public API is small and may change before a stable release.

Install

isobands requires GDAL 3.12.2, including the matching system development headers. PyPI's GDAL distribution is source-only: it compiles against the system library, so pip alone cannot install the system GDAL prerequisite.

Install GDAL 3.12.2 with your Unix or macOS package manager (or build that version), then verify the development installation:

gdal-config --version  # must print 3.12.2

On Windows, conda-forge is recommended:

conda install -c conda-forge gdal=3.12.2

After the matching GDAL installation is available:

pip install isobands

Contributors can install all locked development and documentation dependencies with make install; this also checks gdal-config.

Quick start

This complete example uses only an in-memory array:

import geopandas as gpd
import numpy as np
import xarray as xr

from isobands import isobands

data = xr.DataArray(
    np.array([[0.0, 1.0, 2.0], [1.0, 2.0, 3.0], [2.0, 3.0, 4.0]]),
    dims=("y", "x"),
    coords={"x": [0.0, 1.0, 2.0], "y": [2.0, 1.0, 0.0]},
)
bands: gpd.GeoDataFrame = isobands(data, levels=[1.5, 2.5], crs="EPSG:4326")
print(bands[["min_value", "max_value", "geometry"]])

The result has min_value, max_value, and geometry columns. Use levels=[...] for explicit interior thresholds or interval=... for thresholds at integral multiples of an interval. Exactly one is required; interval mode is limited to 100,000 interior thresholds.

Disconnected or nodata-separated regions can produce multiple rows with the same value bounds. Use ordinary GeoPandas operations if a dissolved band is needed.

Behavior and limits

  • Input is a numeric xarray.DataArray with exactly two nonsingleton dimensions; singleton dimensions may be squeezed.
  • Spatial coordinates must be regular, one-dimensional rectilinear axes. CF metadata is preferred when discovering x/y axes. Ascending and descending axes work; curvilinear, irregular, ambiguous, and missing axes fail clearly.
  • Explicit crs wins over registered rioxarray metadata, then recognized CF/grid-mapping/spatial-reference metadata. Coordinate names never imply a CRS.
  • Explicit finite nodata wins over _FillValue/missing_value; otherwise nonfinite floating cells are nodata. An all-nodata raster is invalid.
  • Explicit levels outside the data range are ignored and outer bands use the finite valid extrema. Values equal to a threshold belong to the upper band. Constant rasters produce one full-coverage band with equal labels.
  • Holes, multipart geometry, CRS, and Dask-backed input (materialized eagerly) are preserved.

See the Sphinx documentation source for installation details, full API semantics, and limitations. Contributor instructions are in CONTRIBUTING.md.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

isobands-0.1.0a1.tar.gz (2.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

isobands-0.1.0a1-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file isobands-0.1.0a1.tar.gz.

File metadata

  • Download URL: isobands-0.1.0a1.tar.gz
  • Upload date:
  • Size: 2.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for isobands-0.1.0a1.tar.gz
Algorithm Hash digest
SHA256 a76351a88deca9fe5d605425eea113a1ba2e193ff5b7e05008fff785a8cc827c
MD5 565d28eaadd8910d51c61135bc12c275
BLAKE2b-256 8664fbb5a6ad39de4aab901dfb84a57d8ba92d002a5002e74cee3278b250da05

See more details on using hashes here.

Provenance

The following attestation bundles were made for isobands-0.1.0a1.tar.gz:

Publisher: continuous-deployment.yaml on palewire/isobands

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file isobands-0.1.0a1-py3-none-any.whl.

File metadata

  • Download URL: isobands-0.1.0a1-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for isobands-0.1.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 42b9a60382e46dce917e2f7eba1ac8ffd4e852854ab5acc5f3bb9e7089bfe639
MD5 cb556376f2d20146017ef2c9df6c9894
BLAKE2b-256 cc45eceefe35e85b1ace55289d2aad6469c3d75e8ee4036bdb4fb0b4d81f90ad

See more details on using hashes here.

Provenance

The following attestation bundles were made for isobands-0.1.0a1-py3-none-any.whl:

Publisher: continuous-deployment.yaml on palewire/isobands

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

This release

0.1.0a1 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page