Install + first run
The default pipeline downloads imagery from free, public AWS Open-Data buckets via Element 84’s Earth Search STAC API. You do not need an account, API key, or .env file to run it. Just clone, install, edit a few parameters, and go.
1. Clone the repository
git clone https://github.com/buckai-observatory/geoai-datacubes.git
cd geoai-datacubes2. Create and activate a clean Python environment
We recommend mamba (a drop-in conda replacement that solves environments dramatically faster). The simplest install is the Miniforge distribution, which ships mamba pre-configured against the conda-forge channel.
If you already have conda installed and prefer not to switch, substitute conda for mamba in the commands below.
If the mamba/conda install below runs into any dependency issues — for example a PyTorch ↔︎ libprotobuf ABI mismatch, or another conda-forge package landing at a version that conflicts with something else the solver picked — skip to Reproducible locked install with
pixibelow and use that path instead (pixi install -e notebooks --locked, thenpixi run -e notebooks jupyter lab; usefullinstead ofnotebooksfor notebook 03). It installs from a frozen, CI-tested lockfile that avoids re-solving against the moving conda-forge target, and reliably works around exactly that class of drift.
3. Install the package
The package ships with a pyproject.toml that declares the core data pipeline as required and bundles everything else into named optional- dependency extras. Every dependency including geoai-py is on conda-forge, so the recommended path is a pure-mamba install from conda-forge with a single pip install -e . at the end for the local repo itself (which is not on conda-forge yet).
This avoids the libLerc / GDAL loader-chain breakage that pure-pip environments occasionally hit on macOS, and gives you conda-forge’s CUDA-tested PyTorch builds on Linux clusters.
Recommended: all from conda-forge, plus pip install -e . for this repo
The single command below builds the full geoai-cubes environment used by all notebooks in this repo:
mamba create -y -n geoai-cubes -c conda-forge \
python=3.11 \
geoai-py leafmap torchgeo omniwatermask \
rasterio gdal libgdal-jp2openjpeg pyproj shapely \
pystac pystac-client planetary-computer \
"pytorch>=2.0" "torchvision>=0.15" \
zarr lmdb scikit-image pillow \
matplotlib numpy pandas tqdm requests \
scikit-learn xgboost ultralytics transformers \
jupyterlab ipywidgets seaborn geopandas contextily
mamba activate geoai-cubes
pip install -e . # geoai-datacubes itself (not on conda-forge yet)
bash smoke-tests/check_env.sh # verifyThis single env is enough for every notebook in the repo:
00_geoai_datacubes_tour.ipynb— multi-mission tour01_classification.ipynb— RF / XGBoost / U-Net water classification03_with_opengeos_geoai.ipynb— the two-package interop demo02_building_detection.ipynb— YOLOv8 + OWLv2 + HF YOLO building detection (in-development scaffold, not part of the reviewed release)
Slimmer installs (only the deps you’ll actually use)
Core pip install geoai-datacubes gives you the fetch + fuse surface plus the raster-side preprocessing helpers (compute_ndvi, fuse_response_tiffs, tile_geotiff, band-meta normalisation). It does not install PyTorch. Total footprint: ~200 MB of Python wheels plus GDAL / rasterio system libraries.
Add optional extras for the pieces you actually need. Only the extra you install adds to your footprint, so a fetch-only user pays no ML tax:
| Extra | Adds | Enables | Approx. extra install size |
|---|---|---|---|
| (core) | — | Every mission fetch, provider dispatch, AOI validation, fusion, tiling, band math, NaN handling, cloud-mask decoding, per-band norms | — |
[ml] |
PyTorch, torchvision, scikit-image, scikit-learn, XGBoost, Ultralytics YOLO, transformers, HF hub | LazyTileDataset, geotiff_to_zarr, tiler augmentation (rotate / inpaint), all of geoai_datacubes.ml_dl |
~2 GB |
[geoai] |
opengeos/geoai + leafmap + torchgeo + omniwatermask | Foundation-model wrappers (Prithvi, Clay, DOFA, SatMAE, DINOv3), pretrained task-specific models, notebook 03 integration | ~1 GB (also pulls torch, so implies [ml]-ish footprint) |
[earthdata] |
earthaccess, h5py, xarray, h5netcdf | NASA DAAC fetches (NISAR, ICESat-2, SWOT, CryoSat, GEDI, SMAP, Sentinel-5P, …) | ~30 MB |
[earthengine] |
earthengine-api | Google Earth Engine fetches (Dynamic World, JRC-GFC2020, MODIS with server-side reproject) | ~50 MB |
[notebooks] |
jupyterlab, ipywidgets, seaborn, geopandas, contextily | Running / editing the shipped notebooks locally | ~200 MB |
[planet] |
python-dotenv, sentinelhub | Commercial Planet Orders + Sentinel Hub provider paths | ~10 MB |
[dev] |
pytest, ruff, pre-commit | Running the test suite, linting, contributing | ~10 MB |
[all] |
Every extra above | Everything | ~4 GB |
Install syntax:
pip install -e ".[ml]" # + scikit-learn, XGBoost, Ultralytics YOLO, transformers
pip install -e ".[geoai]" # + opengeos/geoai (Wu 2026, JOSS 11(118):9605)
pip install -e ".[notebooks]" # + jupyterlab, ipywidgets, seaborn, geopandas, contextily
pip install -e ".[planet]" # + Planet Orders + Sentinel Hub (commercial providers)
pip install -e ".[earthengine]" # + Google Earth Engine provider (Dynamic World, JRC-GFC2020, MODIS with EE tile-mosaicking)
pip install -e ".[earthdata]" # + NASA Earthdata provider (NISAR L-band SAR, GEDI, SMAP, ICESat-2, ...)
pip install -e ".[all]" # everything above
pip install geoai-datacubes[ml,earthdata] # multiple extras — comma-separated inside brackets
pip install -e ".[dev,earthdata]" # from a local cloneThe corresponding conda-forge names are: pytorch torchvision scikit-image scikit-learn xgboost ultralytics transformers huggingface_hub for [ml]; geoai-py leafmap torchgeo omniwatermask for [geoai]; earthaccess h5py xarray h5netcdf for [earthdata]; earthengine-api for [earthengine]; jupyterlab ipywidgets seaborn geopandas contextily for [notebooks]; python-dotenv sentinelhub for [planet]. The pip recipes are convenient when you already have a working conda env, and pin slightly faster on a few fast-moving ML packages (ultralytics, transformers).
For [earthengine] and [earthdata] in particular, mamba is strongly preferred over pip — both pull in cloud-provider auth stacks (Google for earthengine-api, Google + AWS for earthaccess) that have shadowed pip-installed packages in this project’s env before. See docs/providers/earth_engine.md and docs/providers/earthdata.md for the full auth setups and the credential-selection modes.
v1.0.0 note. Prior to v1.0.0,
torch,torchvision, andscikit-imagewere core dependencies – fetch-only users paid the full 2 GB PyTorch install even if they never touched a model. That’s fixed as of v1.0.0: those three moved to[ml]. If youpip install geoai-datacubestoday and try to useLazyTileDatasetorgeotiff_to_zarr, you’ll get a clear ImportError telling you to add[ml]. See CHANGELOG.md for the full rationale.
Docker (zero-install, full stack + JupyterLab)
A pre-built container with the complete geoai-cubes stack, the four notebooks, and JupyterLab is published on GitHub Container Registry on every tagged release. The shortest path from “I want to try this” to “running notebook 03 in my browser”:
docker run -p 127.0.0.1:8888:8888 \
ghcr.io/buckai-observatory/geoai-datacubes:latestThe container prints a JupyterLab URL with a one-time token; copy it into your browser. To mount a local folder for persistent outputs:
docker run -p 127.0.0.1:8888:8888 \
-v "$PWD/work:/home/mambauser/work" \
ghcr.io/buckai-observatory/geoai-datacubes:latestTags follow the PyPI version (for example :1.0.0, :1.0, :latest). On academic HPC clusters with Apptainer / Singularity, the image can be pulled directly: apptainer pull docker://ghcr.io/buckai-observatory/geoai-datacubes:latest. See the Dockerfile for the exact build recipe.
Reproducible locked install with pixi (optional)
If you want the exact environment we develop and test against — same package versions, cross-platform reproducible, one command — install pixi and use the committed pixi.lock. The lockfile is regenerated on every dependency change and pinned in git. Two CI jobs exercise it: pixi-locked in .github/workflows/tests.yml installs the tests environment with --locked, checks that every environment in the lock is current and runs the test suite; notebooks in .github/workflows/notebooks.yml installs the notebooks environment with --locked on a macOS (Apple silicon) runner and executes notebooks 00 and 01 top to bottom with smoke-tests/run_notebook.py, which also checks that the kernel is the environment’s own Python. A second job in the same workflow installs the full environment and executes notebook 03 the same way, weekly and on request, in a reduced “smoke” mode (GEOAI_DATACUBES_SMOKE=1: smaller areas, a cropped scene for the water model, 2 training epochs), because the full-size notebook is too heavy for a free CI machine.
# One-time: install pixi (a ~5 MB self-contained binary)
curl -fsSL https://pixi.sh/install.sh | bash # macOS / Linux
# or: powershell -c "iwr -useb https://pixi.sh/install.ps1 | iex" (Windows)
# In a fresh clone of the repo (a normal `git clone`, not a shallow one):
pixi install --locked # -> default env (core, no ML)
pixi install -e tests --locked # -> default + [dev,ml,earthdata], test-runnable
pixi install -e full --locked # -> everything (default + every extra)
# Run things in a locked env without activating it:
pixi run pytest # -> uses whichever env has pytest
pixi run -e tests pytest -v
pixi run test # -> shortcut for the same, see [tool.pixi.tasks]
# Or activate a shell in the env:
pixi shell -e tests
pixi run -e notebooks jupyter lab # notebooks 00 + 01
pixi run -e full jupyter lab # notebook 03 as well--locked installs exactly the package set recorded in pixi.lock and stops with an error if pixi.lock and pyproject.toml disagree. It never solves, so it does not depend on what conda-forge has published since the lockfile was made. (Without the flag pixi re-solves, and rewrites pixi.lock, when the two disagree. --frozen installs the lockfile as it is, without even checking that it is current.)
Named environments and what they include:
| Env | Includes | Best for |
|---|---|---|
default |
Core only (fetch + fuse + tile + band math) | Data-acquisition-only users |
ml |
+ [ml] (PyTorch, scikit-learn, XGBoost, scikit-image) |
Scripts and tests on the ML/DL side; has no Jupyter |
earthdata |
+ [earthdata] |
NASA DAAC fetches (NISAR, ICESat-2, …) |
notebooks |
[notebooks] (JupyterLab, basemap, geopandas) + [ml] |
Notebooks 00 and 01 (about 2.5 GB) |
dev |
+ [dev] |
Contributing (linter, pytest, pre-commit) |
tests |
dev + ml + earthdata |
What CI runs — reproduces the green build exactly |
full |
Every feature | All three reviewed notebooks, including 03, which needs geoai-py (about 3.6 GB) |
Two things to know about pixi environments:
- They are separate installs, not layers.
pixi install -e mlafterpixi install -e notebooksgives you two independent environments, each with its own Python; it does not add PyTorch to thenotebooksone. Pick the one environment that has everything you need (notebooksfor notebooks 00 and 01,fullfor notebook 03). - Start Jupyter from inside the environment, with
pixi run -e notebooks jupyter lab(orpixi run -e full jupyter lab). Inside apixi shellof an environment that has no JupyterLab, such asml, thejupytercommand falls through to any Jupyter installed elsewhere on your machine, and its kernel is then not the environment’s Python, so packages that are installed look missing.
Notebook 01 ships cached models. Its Random Forest cache is a scikit-learn pickle and is only loaded under the scikit-learn version that wrote it; in an environment with a different version (including this locked one) the notebook retrains it once, in about three minutes, and keeps the result in the git-ignored notebooks/_ml_outputs/model_cache/.
The pixi config lives in pyproject.toml under [tool.pixi.*] sections. You never need to edit pixi.lock by hand — after changing a dep (in either the pip [project.dependencies] block or the pixi feature blocks), run pixi lock to regenerate.
pixi.lock covers linux-64, osx-arm64, osx-64, win-64 as of this release. Adding another target is one command: pixi project platform add <triple> then pixi lock.
Pip-only fallback (when conda / mamba isn’t available)
python -m venv .venv && source .venv/bin/activate
pip install -e ".[all]"This works in clean virtual environments but can fail mid-stream if a wheel-less GDAL stack can’t compile from source (notably on macOS without Xcode CLT, or on minimal Linux images). When it does, fall back to the mamba path above — it’s also faster on a cold cache.
pip install -e . is the editable / developer install. If you just want to use the package without modifying it, drop the -e. The flat requirements.txt file is preserved for tooling that doesn’t read pyproject.toml extras (e.g. the smoke-tests/check_env.sh --pip import check).
Known install-time gotchas
Missing JPEG-2000 codec: ERROR 4: Unable to open … JP2OpenJPEG driver is unavailable
Why it matters. ESA distributes Sentinel-2 bands as JPEG-2000 (.jp2) files. Some public STAC buckets (notably Element 84’s Earth Search Sentinel-2 L2A collection) serve these .jp2 assets directly rather than converting to Cloud-Optimised GeoTIFF. Reading them requires the GDAL JP2OpenJPEG driver, which in turn requires the libopenjp2 shared library to be present at runtime.
Status by installer (as of 2026):
| Installer | Ships JP2 support by default? | If not, fix |
|---|---|---|
| conda-forge / mamba | ❌ Split package — gdal doesn’t imply the codec |
Already added to the recommended mamba create line in Section 3. If you rolled your own env, mamba install -n <env> -c conda-forge libgdal-jp2openjpeg. |
PyPI wheel (pip install rasterio) |
✅ Yes — manylinux / macOS / Windows wheels bundle a GDAL built --with-openjpeg |
Nothing to do. Verify with the diagnostic at the bottom of this callout. |
apt (libgdal-dev on Ubuntu 22.04+) |
✅ Yes | Nothing to do. |
Homebrew (brew install gdal) |
✅ Yes — the formula lists openjpeg as a dependency | Nothing to do. |
| MacPorts | ❌ Base port lacks it | sudo port install gdal +openjpeg |
| Colab | ✅ Yes — bundled GDAL wheel includes every codec | Nothing to do. |
Diagnostic — regardless of installer, this one-liner tells you whether JP2 is available in your current Python env:
from osgeo import gdal
print([gdal.GetDriver(i).GetDescription()
for i in range(gdal.GetDriverCount())
if 'JP2' in gdal.GetDriver(i).GetDescription()])
# Expected: ['JP2OpenJPEG'] (or similar)
# Empty list -> codec is missingIf osgeo is not importable (the GDAL Python bindings are not part of every environment, including the pixi ones), ask rasterio instead:
import rasterio
with rasterio.Env() as env:
print(sorted(d for d in env.drivers() if "JP2" in d))Symptom you’ll actually see when it’s missing: rasterio.errors.RasterioIOError: ... JP2OpenJPEG driver is unavailable during a Sentinel-2 fetch.
Reported during JOSS review: openjournals/joss-reviews#11034.
Python aborts with OMP: Error #15: Initializing libomp.dylib, but found libomp.dylib already initialized (macOS)
Two copies of the OpenMP runtime are loaded in one process. On macOS this almost always means a package installed with pip that bundles its own libomp (the PyPI wheels of torch, xgboost and lightgbm do) sits next to conda-forge’s llvm-openmp, which the conda-forge pytorch, scikit-learn and xgboost builds share. Find the pip-installed copy with pip list | grep -i -E "torch|xgboost|lightgbm" (conda-forge builds show their channel in mamba list instead), pip uninstall it, and reinstall the same package from conda-forge (mamba install -c conda-forge xgboost). Setting KMP_DUPLICATE_LIB_OK=TRUE only silences the check and can give wrong results; do not use it. Keeping every package in one environment from one channel, or using the pixi lockfile, avoids the problem.
A package is installed according to mamba list, but import in the notebook fails
The notebook kernel is almost certainly running a different Python than the environment you installed into. Check with import sys; print(sys.executable) in a cell (the first code cell of each shipped notebook prints it): the path should be inside the environment, e.g. .../envs/geoai-cubes/bin/python or .../.pixi/envs/notebooks/bin/python. If it is not, either pick that kernel in Jupyter, or start Jupyter from inside the environment (mamba activate geoai-cubes then jupyter lab, or pixi run -e notebooks jupyter lab). The same mismatch makes a mamba install or pip install look like it had no effect.
4. Choose what to download
Open geoai_datacubes/main.py and edit the USER INPUT block at the top to describe the data you want:
# ---- USER INPUT ----
PROVIDER = "auto" # default: ES for S2, PC for S1/Landsat (all no-creds)
MISSION = "Sentinel-2" # "Sentinel-2", "Sentinel-2-L1C", "Sentinel-1", or "Landsat"
BANDS = None # None = mission default bands
# Area of interest -- the default is a ~5-mile square around OSU in Columbus, OH.
# Three other formats are supported; see "Defining the AOI" below.
AOI = {"bbox": [-83.077, 39.964, -82.983, 40.036]}
ROI = resolve_aoi(AOI)
TIME_RANGE = ("2024-06-15", "2024-06-20") # start, end date
RESOLUTION = 10 # metres per pixel
MAX_CLOUD = 0.10 # keep scenes under 10% cloud cover
TILE_SIZE = 256
SPLIT = (0.8, 0.1, 0.1) # train / val / test fractionsLeaving BANDS = None picks sensible defaults per mission (Red+NIR for optical, VV+VH for radar) and auto-adds the cloud/quality bands. To run Landsat instead, just set MISSION = "Landsat" — everything else stays the same.
More band-selection examples
The BANDS argument takes a Python list of band names (case-sensitive, matching the table in docs/data_layers.md). Four common patterns:
# 1. Default behaviour (None) -- mission defaults plus helper bands.
# For Sentinel-2 L2A this yields B04 + B08 (Red, NIR) plus SCL / AOT / WVP
# so per-pixel cloud masking and atmospheric correction inputs are present.
BANDS = None
# 2. Just NDVI inputs -- minimal, fastest fetch (~2 bands).
BANDS = ["B04", "B08"]
# 3. True-colour RGB + NIR + SCL for cloud masking. This is what
# notebook 01 uses as its headline Sentinel-2 set.
BANDS = ["B02", "B03", "B04", "B08", "SCL"]
# 4. All 12 spectral bands plus the three atmospheric helpers --
# the maximum-information Sentinel-2 L2A fetch.
BANDS = ["B01", "B02", "B03", "B04", "B05", "B06", "B07",
"B08", "B8A", "B09", "B11", "B12",
"SCL", "AOT", "WVP"]Fetching more than one mission
main.py runs one mission per execution. To pull several missions over the same AOI, run the script multiple times (each writes its own <Mission>_full_size.tiff into a per-scene folder under data/):
# In one terminal session or shell loop:
for MISSION in ["Sentinel-2", "Sentinel-1", "Landsat",
"Copernicus-DEM", "ESA-WorldCover"]:
# set MISSION, BANDS, etc. in main.py (or pass via environment)
# then run: python main.py
...Once each mission has its own <Mission>_full_size.tiff on disk, the multi-mission fusion step (see docs/fusion.md) stacks them onto a common UTM grid for ML.
Defining the AOI
AOI is a small dict. Pick one of four formats:
| Format | Example | Use when |
|---|---|---|
| Rectangular bbox | {"bbox": [lon_min, lat_min, lon_max, lat_max]} |
You already have the corners in WGS84. |
| Polygon file | {"shapefile": "/path/to/aoi.shp"} (or .gpkg, .geojson) |
You have an existing polygon. Requires geopandas. The polygon’s bounding box is used; add "clip_to_geometry": True to also set pixels outside the polygon (and inside any holes) to NaN after the fetch. |
| Square around a point | {"center": (40.0067, -83.0305), "side_miles": 5} |
You know roughly where, just want a square AOI of size N miles. |
| Native S2 tile around a point | {"tile_around": (40.0067, -83.0305)} |
Quickest first look — returns the full ~100×100 km MGRS tile containing the point. |
5. Run the pipeline
# From the repo root:
python -m geoai_datacubes.mainThe pipeline will find the least-cloudy scene, download it, mask clouds, compute NDVI, cut the scene into tiles, split them into train/val/test, and export GPU-ready datasets. Outputs land in the data/ folder.
Want to see results without downloading anything first? Skip straight to the notebooks (see the README), which run on bundled sample data or fetch live.
6. Switching to a paid / advanced provider
The default earthsearch and planetary_computer providers cover almost everything in the catalogue without credentials. Two opt-in paths are documented separately:
- Sentinel Hub — for server-side band-math via
evalscriptsand very large ROIs. - Planet Orders API — for commercial PlanetScope 4-band / 8-band SuperDove imagery at ~3 m.
Setup recipes for both live in docs/credentials.md; the technical trade-offs between providers are in docs/providers.md.