{"id":"aggregate_dekads_to_period","summary":"Aggregate a published dekadal dataset to months or ISO weeks, weighted by day overlap, and publish it as a new GeoZarr dataset","description":"Loads a published dekadal (10-daily) collection, aggregates it to calendar months or ISO weeks with the `aggregate_dekads` process, and publishes the result.\n\nDekads 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.\n\nChoose `method` by what the variable is:\n\n- `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.\n- `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.\n\n`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.\n\nThe output variable carries a `cell_methods` recording the weighting, so a consumer can tell a day-weighted aggregate from an observation.\n\nThe `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.\n\nZarr output cannot be produced synchronously, so run this as a batch job (POST /jobs, then POST /jobs/{id}/results):\n\n{\n  \"agg\": {\n    \"process_id\": \"aggregate_dekads_to_period\",\n    \"arguments\": {\n      \"dataset_id\": \"clms_gpp_dekad\",\n      \"output_dataset_id\": \"clms_gpp_monthly\",\n      \"variable\": \"gpp\",\n      \"temporal_extent\": [\"2024-01-01\", \"2024-12-31\"]\n    },\n    \"result\": true\n  }\n}","parameters":[{"name":"dataset_id","description":"ID of the published dekadal collection to load (as listed under /datasets). Its timesteps must fall on the 1st, 11th and 21st.","schema":{"type":"string"}},{"name":"output_dataset_id","description":"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).","schema":{"type":"string"}},{"name":"variable","description":"Variable/band name carried through to the published dataset.","schema":{"type":"string"}},{"name":"temporal_extent","description":"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.","schema":{"type":"array","subtype":"temporal-interval"}},{"name":"period","description":"Target period: 'month' (default) or 'week'. Monthly is exact; weekly does not align with dekads.","schema":{"type":"string","enum":["month","week"]},"optional":true,"default":"month"},{"name":"method","description":"'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.","schema":{"type":"string","enum":["mean","sum"]},"optional":true,"default":"mean"}],"returns":null,"process_graph":{"load":{"process_id":"load_collection","arguments":{"id":{"from_parameter":"dataset_id"},"temporal_extent":{"from_parameter":"temporal_extent"}}},"aggregated":{"process_id":"aggregate_dekads","arguments":{"data":{"from_node":"load"},"period":{"from_parameter":"period"},"method":{"from_parameter":"method"}}},"save":{"process_id":"save_result","arguments":{"data":{"from_node":"aggregated"},"format":"Zarr","options":{"dataset_id":{"from_parameter":"output_dataset_id"},"variable":{"from_parameter":"variable"},"publish":true}},"result":true}},"links":[]}