Skip to main content

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

Project description

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.

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

smart_geocubes-0.1.5.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.5-py3-none-any.whl (36.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: smart_geocubes-0.1.5.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.5.tar.gz
Algorithm Hash digest
SHA256 b701e42521e23ed25437ae2554ee83f10e49405e290edb1efb52f5aef0a8ea96
MD5 b11507b62ecd901d5f55a16a5f988891
BLAKE2b-256 9ba8dc82cca61369862e0e9d477c187ae26fcc768dd7fa44c432ca21e0d8359c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for smart_geocubes-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 de8c98e851feda398368953a34fc90c02dd26aaf99055e8aa3870f317c5ddff0
MD5 cd422e1dee937dc0d9d3fe1b2fd16325
BLAKE2b-256 1d68929e3d383f372245c42b937d8ba768c06f82a38642b8c3cd947ec257bc4e

See more details on using hashes here.

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