Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/terrafloww/rasteret/llms.txt

Use this file to discover all available pages before exploring further.

Class Definition

from rasteret import CloudConfig

config = CloudConfig(
    provider,
    requester_pays=False,
    region="us-west-2",
    url_patterns={}
)
Storage configuration for a data source. CloudConfig manages URL rewriting and requester-pays access for cloud-hosted datasets.

Parameters

provider
str
required
Cloud provider identifier (e.g. "aws", "gcs", "azure").
requester_pays
bool
default:"False"
Whether the data source requires requester-pays access. Set to True for datasets like Landsat Collection 2.
region
str
default:"us-west-2"
Cloud region for the data source.
url_patterns
dict[str, str]
default:"{}"
URL pattern rewrites for converting HTTP URLs to cloud URIs. Keys are HTTP prefixes, values are cloud URIs (e.g. {"https://landsatlook.usgs.gov/data/": "s3://usgs-landsat/"}).

Class Methods

register()

CloudConfig.register(collection_id: str, config: CloudConfig) -> None
Register a cloud config for a collection ID.
collection_id
str
required
Collection identifier (e.g. "my-collection").
config
CloudConfig
required
Configuration to register.

get_config()

CloudConfig.get_config(data_source: str) -> CloudConfig | None
Look up cloud config for a data source.
data_source
str
required
Data source identifier.
config
CloudConfig | None
The registered configuration, or None if not found.

Examples

Register Custom Config

from rasteret import CloudConfig

# Register config for a custom collection
CloudConfig.register(
    "my-collection",
    CloudConfig(
        provider="aws",
        requester_pays=True,
        region="eu-west-1"
    )
)

With URL Rewriting

# Rewrite HTTP URLs to S3 URIs
CloudConfig.register(
    "my-collection",
    CloudConfig(
        provider="aws",
        region="us-west-2",
        url_patterns={
            "https://example.com/data/": "s3://my-bucket/"
        }
    )
)

Requester Pays Dataset

# Configuration for Landsat (requester pays)
landsat_config = CloudConfig(
    provider="aws",
    requester_pays=True,
    region="us-west-2",
    url_patterns={
        "https://landsatlook.usgs.gov/data/": "s3://usgs-landsat/"
    }
)

CloudConfig.register("landsat-c2-l2", landsat_config)

Using with Collections

import rasteret

# Config is automatically applied when building
collection = rasteret.build(
    "landsat-c2-l2",
    name="my_area",
    bbox=(-122.5, 37.7, -122.3, 37.9),
    date_range=("2023-06-01", "2023-08-31")
)

# Or pass explicitly
custom_config = CloudConfig(
    provider="aws",
    region="eu-west-1"
)

data = collection.get_xarray(
    geometries=bbox,
    bands=["B04"],
    cloud_config=custom_config
)

Lookup Config

# Check if a data source has registered config
config = CloudConfig.get_config("sentinel-2-l2a")

if config:
    print(f"Provider: {config.provider}")
    print(f"Region: {config.region}")
    print(f"Requester pays: {config.requester_pays}")

Built-in Configs

Rasteret pre-registers configs for well-known datasets:

Sentinel-2 L2A

CloudConfig(
    provider="aws",
    requester_pays=False,
    region="us-west-2"
)

Landsat Collection 2 Level-2

CloudConfig(
    provider="aws",
    requester_pays=True,
    region="us-west-2"
)

Notes

  • Configs are stored in a class-level registry
  • Collection IDs are case-insensitive
  • URL patterns are applied in order
  • Requester-pays access requires valid AWS credentials
  • Built-in configs are automatically registered at import time

Build docs developers (and LLMs) love