Skip to content

[Feature Request] Native Temporal Reducers for Climate Layers Aligned to 14-Day EO Windows #554

@robmarkcole

Description

@robmarkcole

I commonly configure Sentinel-2 with period_duration: "14d" so rslearn produces one Sentinel-2 mosaic per 14-day period within a window. I want climate layers to be reduced over those exact same 14-day windows.

For example, if a window spans several months and Sentinel-2 materialization yields one mosaic per 14-day interval, I want an ERA5-based climate layer to produce matching outputs for each of those same intervals. Typical reductions would be:

  • TEMPORAL_MEAN
  • TEMPORAL_MAX
  • TEMPORAL_MIN

Example use cases:

  • mean / max / min 2 m temperature over the same 14-day interval as each Sentinel-2 mosaic
  • mean soil moisture over the same 14-day interval
  • total or mean precipitation over the same 14-day interval

Current behavior does not support this directly: period_duration splits matching into sub-periods, but does not reduce the raster time dimension. Existing MEAN / MEDIAN compositing methods operate across overlapping items, not across timesteps within a multi-temporal raster

Requested capability

Add native temporal reducers for raster layers that operate over the T dimension within each matched item group / request time range:

  • TEMPORAL_MEAN
  • TEMPORAL_MAX
  • TEMPORAL_MIN

These reducers should work naturally with period_duration, so that if a layer is matched into 14-day groups, each group can be reduced to a single raster representing that same 14-day interval.

Concrete example

Sentinel-2 configuration:

"data_source": {
  "class_path": "rslearn.data_sources.planetary_computer.Sentinel2",
  "init_args": {
    "cache_dir": "cache/planetary_computer",
    "harmonize": true,
    "query": {
      "eo:cloud_cover": {
        "lte": 100
      }
    },
    "sort_by": "eo:cloud_cover",
    "sort_ascending": true
  },
  "query_config": {
    "max_matches": 12,
    "period_duration": "14d",
    "space_mode": "MOSAIC",
    "time_mode": "WITHIN"
  }
}

Desired climate layer behavior:

{
  "layers": {
    "era5_14d_mean": {
      "type": "raster",
      "band_sets": [{
        "bands": ["temperature-2m", "total-precipitation"],
        "dtype": "float32"
      }],
      "data_source": {
        "class_path": "rslearn.data_sources.climate_data_store.ERA5LandHourly",
        "init_args": {
          "bounds": [-122.4, 47.6, -122.3, 47.7]
        },
        "query_config": {
          "max_matches": 12,
          "period_duration": "14d",
          "space_mode": "MOSAIC",
          "time_mode": "WITHIN"
        }
      },
      "compositing_method": "TEMPORAL_MEAN"
    }
  }
}

Expected result:

  • sentinel2, sentinel2.1, sentinel2.2, ...
  • era5_14d_mean, era5_14d_mean.1, era5_14d_mean.2, ...

With each climate layer aligned to the same 14-day interval as the corresponding Sentinel-2 group.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions