This release is a pre-release and may not be stable for production use.
isobands
An easy way to make filled contour maps with Python.
isobands converts a regular two-dimensional
xarray raster into filled contour polygons backed by a
GeoPandas GeoDataFrame.
Install
Install GDAL 3.10.2 or 3.12.2 and matching development headers using the official GDAL installation guide. Then install the matching binding:
pip install "isobands[gdal310]" # native GDAL 3.10.2
# or
pip install "isobands[gdal312]" # native GDAL 3.12.2
Quick start
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 = isobands(data, levels=[1.5, 2.5], crs="EPSG:4326")
print(bands[["min_value", "max_value", "geometry"]])
The result always has the stable min_value, max_value, and geometry
columns and a GeoPandas CRS. Exactly one of levels or interval is required.
Use levels for strictly increasing interior thresholds, or interval for
integral thresholds. Values equal to a threshold belong to the upper band.
Compatibility APIs
isobands() is the stable convenience API. Its
min_value/max_value/geometry schema and finite interior-threshold
semantics remain unchanged.
Use gdal_fixed_level_polygons() when a workflow needs native
gdal_contour -p -fl fixed-level output:
from isobands import gdal_fixed_level_polygons
native = gdal_fixed_level_polygons(
data,
levels=[0.0, 1.0, 2.0, 3.0, 4.0],
crs="EPSG:4326",
)
It returns GDAL-style ID/floor/ceil/geometry features in native order
without clipping or post-contour normalization. It uses GDAL's virtual
in-memory GeoJSON output, not intermediate files. See the guide
for its exact contract and limits.
Regular one-dimensional rectilinear coordinates are required, and coordinate
names do not imply a CRS. Pass crs= explicitly when metadata is absent or
ambiguous. Explicit finite nodata takes precedence over _FillValue and
missing_value; otherwise nonfinite cells are excluded. Dask-backed arrays
are materialized eagerly for GDAL's in-memory dataset. See the
guide for usage examples and the API reference.
Real-world example
The runnable NOAA/NCEP example uses the pinned
fixture in examples/data/, calls isobands with Kelvin levels and
EPSG:4326, checks the schema, CRS, and geometry validity, and dissolves
components with GeoPandas:
python examples/air_temperature.py
The ERA5 MapLibre example downloads the global
daily high temperature for August 16, 2020, creates five-degree Celsius
isobands, and writes GeoJSON for the accompanying
era5_maplibre.html page. It requires a
Copernicus Climate Data Store API key and the optional cdsapi, h5netcdf,
and h5py packages.
Documentation
The hosted documentation is intended for
palewi.re/docs/isobands/. The source is in
docs/, with a single-page guide covering installation, quick start,
the API reference, and the MapLibre example. Benchmarks and their
reference data remain in benchmarks/.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file isobands-0.2.0rc1.tar.gz.
File metadata
- Download URL: isobands-0.2.0rc1.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
672d6b0610953cfd3d8c6deb869a8aa049f15c10151400b84e087deb24626b07
|
|
| MD5 |
4bbe1bc02e150bedb53e58ca79e831d6
|
|
| BLAKE2b-256 |
3da304ab6803a3103f002adfdea2cc7a3d71ae09a52f3ee5746775146f68f699
|
Provenance
The following attestation bundles were made for isobands-0.2.0rc1.tar.gz:
Publisher:
continuous-deployment.yaml on palewire/isobands
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
isobands-0.2.0rc1.tar.gz -
Subject digest:
672d6b0610953cfd3d8c6deb869a8aa049f15c10151400b84e087deb24626b07 - Sigstore transparency entry: 2506687856
- Sigstore integration time:
-
Permalink:
palewire/isobands@9af109165fcc78504b2fc2762a7cb51dae572922 -
Branch / Tag:
refs/tags/0.2.0rc1 - Owner: https://github.com/palewire
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
continuous-deployment.yaml@9af109165fcc78504b2fc2762a7cb51dae572922 -
Trigger Event:
push
-
Statement type:
File details
Details for the file isobands-0.2.0rc1-py3-none-any.whl.
File metadata
- Download URL: isobands-0.2.0rc1-py3-none-any.whl
- Upload date:
- Size: 20.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
daeb688bfab08c06f2baf0a3c8ff8c0db4f0e975decbd34d660d8b1505182987
|
|
| MD5 |
803cf14495ea02f917eef51f1b4fc737
|
|
| BLAKE2b-256 |
c5b0b281d4f14cbf7373ec9afff47cc2993f1d134c2153e8851646e67fd517b5
|
Provenance
The following attestation bundles were made for isobands-0.2.0rc1-py3-none-any.whl:
Publisher:
continuous-deployment.yaml on palewire/isobands
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
isobands-0.2.0rc1-py3-none-any.whl -
Subject digest:
daeb688bfab08c06f2baf0a3c8ff8c0db4f0e975decbd34d660d8b1505182987 - Sigstore transparency entry: 2506687962
- Sigstore integration time:
-
Permalink:
palewire/isobands@9af109165fcc78504b2fc2762a7cb51dae572922 -
Branch / Tag:
refs/tags/0.2.0rc1 - Owner: https://github.com/palewire
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
continuous-deployment.yaml@9af109165fcc78504b2fc2762a7cb51dae572922 -
Trigger Event:
push
-
Statement type: