Skip to content

CU-ESIIL/climate_cube_math

Repository files navigation

climate_cube_math

What is CubeDynamics?

CubeDynamics (the climate_cube_math package) is a spatiotemporal analysis system for environmental science. It treats climate, NDVI, and other geospatial datasets as data cubes—variables defined over latitude, longitude, and time:

V(lat, lon, time)

This cube representation preserves spatial and temporal coherence and supports scientific questions that require full spatiotemporal context.

Why use a cube-based framework?

Environmental questions are rarely purely spatial or purely temporal. They depend on patterns that unfold across both:

  • drought synchrony
  • seasonal and interannual variability
  • disturbance recovery
  • climate–vegetation coupling
  • propagating anomalies
  • compound extreme events

CubeDynamics provides a cube-native grammar of verbs so that these analyses can be expressed directly and clearly.

Installation

The easiest way to get started is with conda and the provided environment file:

conda env create -f envs/cube-env.yml
conda activate cube-env
pip install --no-deps "git+https://github.com/CU-ESIIL/climate_cube_math.git@main"

See INSTALL.md for detailed instructions, verification steps, and Docker/cloud notes.

10-minute Tour (Start Here)

See the full Quickstart guide: 👉 https://cu-esiil.github.io/climate_cube_math/quickstart/

Minimal example:

import cubedynamics as cd
from cubedynamics import pipe, verbs as v

ndvi = cd.ndvi(
    lat=40.0,
    lon=-105.25,
    start="2023-01-01",
    end="2024-12-31",
)

pipe(ndvi) | v.plot()

See the Minimal NDVI vignette for a step-by-step version of this example: https://cu-esiil.github.io/climate_cube_math/vignette_minimal_ndvi/

Documentation

Full docs: https://cu-esiil.github.io/climate_cube_math/

FIRED polygons (CONUS+AK)

Use the load_fired_conus_ak helper in cubedynamics.fire_time_hull to load the FIRED daily or event polygons. By default it reads from a local cache at ~/.fired_cache/ and raises a FileNotFoundError if the expected file is missing. In cloud notebooks, enable download-on-miss:

from cubedynamics.fire_time_hull import load_fired_conus_ak

fired_daily = load_fired_conus_ak(which="daily", prefer="gpkg", download=True)

Set cache_dir= to point the cache somewhere else (for example, a mounted volume).

Contributing

See: docs/dev/contributing.md

Developer invariants for the cube viewer and verbs: docs/dev/cube_viewer_invariants.md