Skip to main content

Interactive viewer for geospatial XAI attributions

Project description

GeoXplain

GeoXplain GeoXplain Aurora Adapter Documentation Live demo Paper
Current repository Aurora backend User guide and API Hosted viewer Manuscript

GeoXplain header

GeoXplain is an interactive Python-based visualization toolkit for exploring geospatial attribution maps across climate variables, atmospheric pressure layers, and forecast time. It turns computed attribution arrays, saved result bundles, targets, timestamps, vertical levels, and weather overlays into an interactive Jupyter widget or a standalone browser viewer.

The core package does not compute explanations and does not need to import your model. It is the visualization and interchange layer. Compute can happen anywhere: in your own pipeline, in a batch job, in another library, or through a backend such as the separate Aurora adapter.

Cite us

Will be published shortly.

Why GeoXplain

  • Inspect geospatial attributions across variables, levels, methods, and time.
  • Import raw NumPy arrays, .xia.npz attribution bundles, or compatible Python result objects.
  • Add weather-field overlays from .overlay.npz bundles or compatible overlay objects.
  • Work inside notebooks with GeoXplainWidget or export a self-contained static browser view with GeoXplain.
  • Keep model-specific compute code out of the viewer package.

Import computed data

The most portable GeoXplain workflow is to compute explanations somewhere else and import the result. A saved .xia.npz bundle is self-describing, so the viewer can recover method names, timestamps, targets, layer labels, and attribution grids without the original model package.

Quickstart: a runnable walkthrough of the snippets below, including bundle import, manual .npy import, and building grids from in-memory NumPy arrays, lives in examples/quickstart.ipynb.

from geoxplain import GeoXplainWidget
from geoxplain.xia_result import load_xia_result

result = load_xia_result("zurich.xia.npz")  # can be found in examples

widget = GeoXplainWidget(title="Ticino attribution", height=720)  # both optional
widget.add_attribution(result)
widget

You can also add arrays directly when you already have a computed grid:

import numpy as np
from geoxplain import GeoXplainWidget

saliency = np.load("saliency_700hPa.npy")

widget = GeoXplainWidget(title="Model attribution")
widget.add_attribution(
    saliency,
    pressure_level=700,
    method="Saliency",
    timestamp="2024-03-20T00:00:00Z",
    target=(46.25, 8.75),
)
widget

Weather overlays use the same idea:

from geoxplain.overlay_result import load_overlay_result

overlay = load_overlay_result("zurich.overlay.npz")
widget.add_overlay(overlay)

Compute on-the-fly with a backend

When you want GeoXplain to sit next to live explanation computation, use a backend that produces GeoXplain-compatible results. The first packaged backend is the separate geoxplain-aurora-adapter, which computes attributions and weather overlays for Microsoft Aurora.

Quickstart: find a runnable walkthrough for on-the-fly computations in examples/quickstart_on_the_fly.ipynb.

import geoxplain_aurora_adapter as ax
from geoxplain import GeoXplainWidget

target = ax.Target.point(
    var="q",
    level=850,
    lat=46.25,
    lon=8.75,
    timestamp="2024-03-20T00:00:00Z",
)

result = ax.run_saliency(
    target=target,
    input=["t", "q"],
    remote="http://localhost:8765",
)

GeoXplainWidget(result=result, height=720)

Without remote=, the adapter runs in the current Python process. With a listener URL, the same call can dispatch work to a GPU workstation, server, or SLURM-backed service while GeoXplain remains the viewer.

Installation

pip install geoxplain

This package is only the visualization tool; for on-the-fly computations for Microsoft Aurora, see GeoXplain Aurora Adapter.

Screenshot capture is optional:

pip install "geoxplain[screenshots]"

For local documentation and development:

uv sync --group dev
uv run mkdocs serve

Documentation

The documentation source lives in docs/ and is built with MkDocs Material. The deployed documentation is available at clemenskoprolin.github.io/geoxplain. Useful starting points:

Quick reference links for LLMs and tooling:

Build docs locally

uv run python docs/_tooling/generate_llm_reference.py
uv run mkdocs build --strict

License

GeoXplain is distributed under the MIT License. See LICENSE and THIRD_PARTY_NOTICES.md.

Project details


Download files

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

Source Distribution

geoxplain-1.0.0.tar.gz (68.5 MB view details)

Uploaded Source

Built Distribution

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

geoxplain-1.0.0-py3-none-any.whl (2.2 MB view details)

Uploaded Python 3

File details

Details for the file geoxplain-1.0.0.tar.gz.

File metadata

  • Download URL: geoxplain-1.0.0.tar.gz
  • Upload date:
  • Size: 68.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for geoxplain-1.0.0.tar.gz
Algorithm Hash digest
SHA256 80af8d09d48467a30122f560316cdcce71c296f9e4c77603a121e470ea80111c
MD5 a81de5529ff76a46e5c76e4d8c69345c
BLAKE2b-256 4ad9e3cd517d32a4b5d6dcf9bdbc19880d4b0732639a20004ab95562f0bd0800

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoxplain-1.0.0.tar.gz:

Publisher: publish.yml on clemenskoprolin/geoxplain

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

File details

Details for the file geoxplain-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: geoxplain-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 2.2 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for geoxplain-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 611a0135d01063ffef7bba0b23e7e5c1ab1f8d22ab87e957489ddcd36e144bc3
MD5 432a00511b61b8ff9a4b6003985ac092
BLAKE2b-256 1033ee63381499a6e80fbe8b04c6e5c5c9a52eef7bec7719218b1371a3517663

See more details on using hashes here.

Provenance

The following attestation bundles were made for geoxplain-1.0.0-py3-none-any.whl:

Publisher: publish.yml on clemenskoprolin/geoxplain

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

Supported by

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