Skip to content

earthdaily Sentinel2EDACloudMask

rslearn.data_sources.earthdaily.Sentinel2EDACloudMask

Sentinel-2 EDA cloud-mask data on the EarthDaily platform using the sentinel-2-eda-cloud-mask collection.

See EarthDaily Setup for required dependency/credentials.

By default, the source exposes both thematic bands from the cloud-mask STAC asset: cloud-mask and cirrus-mask. Use resampling_method: "nearest" for this layer to preserve class values.

For a workflow that ranks cloud-mask items by AOI clear cover and then retrieves the related Sentinel-2 L2A item, see EarthDaily Cloud-Mask Clear-Cover Selection.

Configuration

{
  "class_path": "rslearn.data_sources.earthdaily.Sentinel2EDACloudMask",
  "init_args": {
    // Optional: EarthDaily STAC asset keys to fetch (default null).
    // If null and the layer config is available, assets are inferred from the layer's
    // requested band names. The only supported asset is "cloud-mask".
    "assets": null,
    // Optional: ordered rslearn names for bands to retain from the cloud-mask GeoTIFF.
    // The first name maps to GeoTIFF band 1; the second maps to GeoTIFF band 2.
    "band_names": ["cloud-mask", "cirrus-mask"],
    // Optional: maximum cloud cover (%) to filter items at search time. If set,
    // injects an `eo:cloud_cover` upper bound into the STAC query.
    "cloud_cover_max": null,
    // Maximum number of STAC items to fetch per window before rslearn grouping/matching.
    "search_max_items": 500,
    // Optional ordering of items before grouping (useful with SpaceMode.COMPOSITE +
    // CompositingMethod.FIRST_VALID): "cloud_cover" (default), "datetime", or null.
    "sort_items_by": "cloud_cover",
    // Optional: STAC API `query` filter passed to searches.
    "query": null,
    // Optional: STAC item property to sort by before grouping/matching (default null).
    // If set, it takes precedence over sort_items_by.
    "sort_by": null,
    // Whether to sort ascending when sort_by is set (default true).
    "sort_ascending": true,
    // Optional cache directory for cached item metadata.
    "cache_dir": null,
    // Timeout for HTTP asset downloads.
    "timeout": "10s",
    // Retry settings for EarthDaily API client requests (search/get item).
    "max_retries": 3,
    "retry_backoff_factor": 5.0
  }
}

Example layer snippet:

{
  "type": "raster",
  "band_sets": [{
    "bands": ["cloud-mask"],
    "dtype": "uint8",
    "nodata_value": 0,
    "zoom_offset": 0
  }],
  "resampling_method": "nearest",
  "data_source": {
    "class_path": "rslearn.data_sources.earthdaily.Sentinel2EDACloudMask"
  }
}

Available Bands

The cloud-mask band contains categorical cloud-mask values:

  • 0: nodata
  • 1: clear
  • 2: cloud
  • 3: cloud shadow
  • 4: thin cloud

The cirrus-mask band contains categorical cirrus-mask values:

  • 0: nodata
  • 1: non-cirrus
  • 2: cirrus

If you only need the first band, request ["cloud-mask"] in the layer band set or set band_names: ["cloud-mask"].

The STAC items include eda:derived_from_collection_id and eda:derived_from_item_id properties that identify the source Sentinel-2 item.