Pure configuration objects for describing raster layers — categorical and continuous.
CategoricalLayer
A CategoricalLayer describes where categorical raster data lives and how to access it.
Key insight: Categorical data can be encoded temporally in two ways: - band-per-year (MapBiomas): Each year is a separate band in a single ee.Image - collection (Dynamic World): An ee.ImageCollection filtered by date
The temporal_mode field makes this explicit.
This object contains no Earth Engine calls, no geometry, no statistics. Just descriptors.
Supports two temporal modes: - ‘band’: Each year is a band in a single Image (e.g., MapBiomas) - ‘collection’: An ImageCollection filtered by date (e.g., Dynamic World)
Attributes: asset_id: GEE asset path temporal_mode: How time is encoded - ‘band’ or ‘collection’ band_pattern: For ‘band’ mode - pattern with {} for year (e.g., ‘classification_{}’) band: For ‘collection’ mode - the band name to select (e.g., ‘label’) scale: Pixel resolution in meters (default 30) class_map: Optional mapping of class values to names palette: Optional mapping of class values to hex colors
ContinuousLayer
A ContinuousLayer describes continuous-valued raster time series (e.g., NDVI, EVI, temperature).
Key features: - Multi-band support: Extract one or more bands in a single call - Preprocessing hook: Optional preprocess function for derived indices, cloud masking, scaling - Dataset-agnostic: The extraction logic knows nothing about specific datasets
The preprocess function receives an ee.Image and returns an ee.Image with the bands you want to extract. This is where dataset-specific logic (cloud masking, index computation) lives.
Used for floating-point data like vegetation indices, temperature, or any continuous signal that varies over time.
Attributes: collection_id: GEE ImageCollection ID bands: List of band names to extract (output columns in DataFrame) scale: Pixel resolution in meters (default 10) preprocess: Optional function (ee.Image -> ee.Image) for preprocessing. Use this for cloud masking, scaling, computing derived indices. Must return an image containing all bands listed in bands.
Example: # Simple - extract existing band ContinuousLayer(collection_id=‘…’, bands=[‘B4’])
# With preprocessing - compute NDVI
ContinuousLayer(
collection_id='COPERNICUS/S2_SR_HARMONIZED',
bands=['NDVI', 'EVI'],
preprocess=compute_s2_indices # defined in datasets/sentinel2.py
)
Both layer types are intentionally simple configuration objects. Dataset-specific presets (MapBiomas, Dynamic World, Sentinel-2) are defined in gee_polygons.datasets modules.