Skip to main content

Smart Geocubes

A high-performance library for intelligent loading and caching of remote geospatial raster data, built with xarray, zarr and icechunk.

The concept of this package is heavily inspired by EarthMovers implementation of serverless datacube generation.

Quickstart

Install the package with uv or pip:

pip install smart-geocubes
uv add smart-geocubes

Open data for your region of interest:

import smart_geocubes
from odc.geo.geobox import GeoBox

accessor = smart_geocubes.ArcticDEM32m("datacubes/arcticdem_32m.icechunk")

roi = GeoBox.from_bbox((150, 65, 151, 65.5), shape=(1000, 1000), crs="EPSG:4326")

arcticdem_at_roi = accessor.load(roi, create=True)

Out of the box included datasets

Dataset Quickuse Source Link / Notes
ArcticDEM Mosaic 2m smart_geocubes.ArcticDEM2m STAC PGC
ArcticDEM Mosaic 10m smart_geocubes.ArcticDEM10m STAC PGC
ArcticDEM Mosaic 32m smart_geocubes.ArcticDEM32m STAC PGC
Tasseled Cap Trends 2019 smart_geocubes.TCTrend2019 Google Earth Engine AWI
Tasseled Cap Trends 2020 smart_geocubes.TCTrend2020 Google Earth Engine AWI
Tasseled Cap Trends 2022 smart_geocubes.TCTrend2022 Google Earth Engine AWI
Tasseled Cap Trends 2024 smart_geocubes.TCTrend2024 Google Earth Engine AWI
AlphaEarth Satellite Embeddings* smart_geocubes.AlphaEarthEmbeddings Google Earth Engine EE

*: Note that the original embeddings are stored in their respective UTM-Zones, but Smart-Geocubes reprojects them into EPSG:4326 to create a single Datacube. This may change in the future, if UTM-Zones are properly supported.

Implemented Remote Accessors

Accessor Description
smart_geocubes.accessors.STAC Accessor for the STAC API, which allows to download data from a STAC API.
smart_geocubes.accessors.GEE Accessor for Google Earth Engine, which allows to download data from Google Earth Engine.

What is the purpose of this package?

This package solves a specific problem that Earth-observation practitioners run into when they need repeated, tile-based access to large raster datasets. When you're creating new data from existing data (for example, doing image segmentation with machine learning on Sentinel-2 images), people usually:

  1. Download all the data
  2. Run the algorithms and data science on it
  3. Delete the data afterwards

This "batched-processing" works great if you have a big computer with lots of storage space, like a cluster.

But if you're working on a smaller computer (like a laptop with a few hundred GB of storage and 16GB of RAM), this approach creates problems. It makes it hard to test and improve your programs because you don't have enough space. Using frameworks like Ray for processing is also tricky with this approach. They work better with "concurrent-processing": when each step of your processing pipeline can be done for each element separately instead of expecting to run a single step for all your data at once. Plus, if you only need to look at certain areas but don't know which ones ahead of time, downloading everything is wasteful.

So instead, this package downloads the data only when you need it. But downloading the same thing over and over is inefficient. That's why we save (or "cache") the data on your computer's hard drive in form of zarr datacubes. We call this way of working "procedural download" because you download pieces as you need them.

Therefore, this package does handle:

  1. The download "on-demand" (or "procedural download") of the data
  2. The caching of the data on your computer's hard drive
  3. The loading of the data into memory for regions specified by the user
  4. Making everything thread-safe, so you can run on any scaling framework you like.

Danger! On linux systems it is necessary to the the multiprocessing start method to spawn or forkserver. Read more about this in icechunk's documentation, a discussion on icechunk's GitHub repository and in Polars documentation.

The approach itself is already implemented in one of the pipelines we develop at the AWI, you can read more about their docs.

This library won't help if your computer doesn't have fast storage space available - like if you're working on a cloud-cluster that can't save files locally.

Contribute

Please read the contribution guidelines for more information on how to contribute to this project.

Download files

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

Source Distribution

smart_geocubes-0.1.6.tar.gz (17.2 MB view details)

Uploaded Source

Built Distribution

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

smart_geocubes-0.1.6-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file smart_geocubes-0.1.6.tar.gz.

File metadata

  • Download URL: smart_geocubes-0.1.6.tar.gz
  • Upload date:
  • Size: 17.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.7

File hashes

Hashes for smart_geocubes-0.1.6.tar.gz
Algorithm Hash digest
SHA256 e3e72b7f2e9c67fee7334e3a86fd035ce2f1a59d19a4fb7adff7b005103e93da
MD5 bb26e074ee330141d76ba85096d501fd
BLAKE2b-256 09fdb937cb42977953be5b085f50e8885993c09af844e769f74a00207984252e

See more details on using hashes here.

File details

Details for the file smart_geocubes-0.1.6-py3-none-any.whl.

File metadata

File hashes

Hashes for smart_geocubes-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c06162f3b05919829fab712f03b9f759c5520d97ed6e7433341fd8ce347d3fc8
MD5 0218b85c7c3955b47bdcfc1060aa88f3
BLAKE2b-256 866245253900f6b7324f24de9de84b75871c4e20c8a84124418aff7ce261a99b

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.10

2 files

0.0.9

2 files

0.0.8

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

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