Climate Demo (Lao PDR)

Aggregate dekads to period

Publishes a dataset

Description

Aggregate a published dekadal dataset to months or ISO weeks, weighted by day overlap, and publish it as a new GeoZarr dataset

Loads a published dekadal (10-daily) collection, aggregates it to calendar months or ISO weeks with the aggregate_dekads process, and publishes the result.

Dekads are not equal in length — day 1-10, 11-20, then 21 to the end of the month, so the third runs 8, 9, 10 or 11 days. A plain mean over the three dekads of a month therefore over-weights a short third dekad: February's 8-day dekad by 4.8 percentage points, a 14% relative error on its contribution, and always in the same direction, so an unweighted monthly series carries a seasonal artefact that tracks month length. This workflow weights each dekad by the days it shares with the target period instead.

Choose method by what the variable is:

  • mean (default) — for a per-day rate such as the CLMS GPP/NPP products (gC/m²/day). Returns the target period's average daily value, in the same units.
  • sum — for a per-dekad total. Each dekad's value is converted to a daily rate and summed across the target's days, so the annual total is conserved exactly regardless of dekad length. Passing sum for a per-day rate is logged as a warning: adding daily rates does not produce a total.

period: week is available but rarely what you want. Dekads and ISO weeks never align — 36 dekads against 52 or 53 weeks — so a weekly series has an effective resolution of about 10 days no matter how it is derived, and the weights must be recomputed per year. Monthly is exact by comparison: three dekads tile a month with no remainder.

The output variable carries a cell_methods recording the weighting, so a consumer can tell a day-weighted aggregate from an observation.

The output_dataset_id must have a registered data source on the instance: a dataset template in plugins/rasters/ with sync: {kind: static}, a matching period_type, and a display block.

Zarr output cannot be produced synchronously, so run this as a batch job (POST /jobs, then POST /jobs/{id}/results):

{
  "agg": {
    "process_id": "aggregate_dekads_to_period",
    "arguments": {
      "dataset_id": "clms_gpp_dekad",
      "output_dataset_id": "clms_gpp_monthly",
      "variable": "gpp",
      "temporal_extent": ["2024-01-01", "2024-12-31"]
    },
    "result": true
  }
}

Parameters

Name Type Description
dataset_id
required
string ID of the published dekadal collection to load (as listed under /datasets). Its timesteps must fall on the 1st, 11th and 21st.
output_dataset_id
required
string ID of the aggregated dataset to publish. Must have a registered data source on the instance (a dataset template with sync: {kind: static}, a matching period_type and a display block; no ingestion plugin needed).
variable
required
string Variable/band name carried through to the published dataset.
temporal_extent
required
temporal-interval Range of dekads to load as [start, end] ISO-8601 dates. A partially covered target period at either end is computed from the dekads that exist.
period
optional, default "month"
month | week Target period: 'month' (default) or 'week'. Monthly is exact; weekly does not align with dekads.
method
optional, default "mean"
mean | sum 'mean' (default) for a per-day rate — the day-weighted average daily value. 'sum' for a per-dekad total — reallocated by day overlap, conserving the total.

Produces

Publishes a dataset.

Automation

No automation runs this workflow on this instance.