Skip to content
Skills Library
Data & analytics · Analysis

aggregate-temporal

/aggregate-temporal

Roll up a weather-skills Zarr along its time axis or forecast lead (step) axis into fixed windows (sub-daily such as 6 hours, daily, weekly, 10-day, calendar monthly, or any whole number of days) or a rolling window, taking the mean, min, or max. Use to turn hourly rates into 6-hour means, or daily rates into weekly, dekadal, or monthly mean rates; each output window is stamped with its length and how complete it is.

Licence
MIT
Last repository change
24.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
3
Scripts
2
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 24.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 2 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/aggregate.py, tests/test_aggregate.py

What it does and when to use it

Roll up a weather-skills Zarr along its time axis or forecast lead (step) axis into fixed windows (sub-daily such as 6 hours, daily, weekly, 10-day, calendar monthly, or any whole number of days) or a rolling window, taking the mean, min, or max. Use to turn hourly rates into 6-hour means, or daily rates into weekly, dekadal, or monthly mean rates; each output window is stamped with its length and how complete it is.

Original author description

Roll up a weather-skills Zarr along its time axis or forecast lead (step) axis into fixed windows (sub-daily such as 6 hours, daily, weekly, 10-day, calendar monthly, or any whole number of days) or a rolling window, taking the mean, min, or max. Use to turn hourly rates into 6-hour means, or daily rates into weekly, dekadal, or monthly mean rates; each output window is stamped with its length and how complete it is.

How it works

  1. Usage
  2. Details
Original SKILL.md headings · 61 lines, 728 words
SKILL.md preview
---
name: aggregate-temporal
description: "Roll up a weather-skills Zarr along its time axis or forecast lead (step) axis into fixed windows (sub-daily such as 6 hours, daily, weekly, 10-day, calendar monthly, or any whole number of days) or a rolling window, taking the mean, min, or max. Use to turn hourly rates into 6-hour means, or daily rates into weekly, dekadal, or monthly mean rates; each output window is stamped with its length and how complete it is."
license: MIT
compatibility: Requires Python 3.12 and uv.
allowed-tools: Bash(uv run ${CLAUDE_SKILL_DIR}/scripts/aggregate.py *)
metadata:
  version: "0.0.5"
  catalog-group: transforms
---

# aggregate-temporal

Averages (or takes the min or max of) a dataset's samples over time windows; rates in, rates out.

## Usage

```bash
# Fixed windows
uv run ${CLAUDE_SKILL_DIR}/scripts/aggregate.py -i IN.zarr -o OUT.zarr --period PERIOD [--end-time YYYY-MM-DD [--start-time YYYY-MM-DD]] [--method mean|max|min] [-v VAR ...] [--time-dim DIM]
# Rolling window
uv run ${CLAUDE_SKILL_DIR}/scripts/aggregate.py -i IN.zarr -o OUT.zarr --window N [--align left|right|center] [--stride S] [--method mean|max|min] [-v VAR ...] [--time-dim DIM]
```

### Arguments
- `--input`, `-i` — input Zarr with a `time` or `step` axis.
- `--output`, `-o` — output Zarr.
- `--period` — `daily`, `weekly` (7 days), `dekadal` (a fixed 10 days back to back, not calendar dekads), `monthly` (calendar months, `time` only, in the input's own calendar), or a duration such as `21 day`, `3 week`, or sub-daily `6 hour` (bins start at 00 UTC on `time` and at lead 0 on `step`). Pass exactly one of `--period` and `--window`.
- `--window` — rolling window length in axis rows.
- `--align` — with `--window`: label each window at its `left` (first) row, `right` (last) row, or `center`. Default: `left`.
- `--stride` — with `--window`: keep every Nth window (integer), or keep dates by `day`, `week`, `month`, `year`, or weekday names (`Monday`, `Monday/Thursday`). Date strides need every picked date on the axis (daily data); on weekly data use an integer.
- `--method` — `mean`, `max`, or `min`. Default: `mean`.
- `--variable`, `-v` — aggregate only this variable; repeat for several. Default: all.
- `--time-dim` — axis to aggregate. Default: `time`, or `step` when there is no `time` axis or `time` has one value.
- `--end-time` — with `--period` on `time`: exclusive right edge of the last window; windows walk backward from it. Pass the day after the last day you want (data through 2026-10-14 takes `--end-time 2026-10-15`). Later samples are dropped and counted on stderr. Not allowed with `monthly`; ignored on `step`.
- `--start-time` — with `--end-time`: stop creating windows before this date.

### Output
- Same variables and units; the aggregated axis holds one label per window, at the window's left edge. Without `--end-time`, `time` windows start at the first sample; `step` windows start at lead 0. Ensemble members stay separate.
- Each variable gets `aggregation_period` (window length, e.g. `7 day`, `1 dekad`, `1 month`), `data_interval` (output spacing: the period, or the input spacing for `--window`), and CF `cell_methods` (e.g. `time: mean (interval: 1 day)`, where the interval is the input spacing).
- Coordinate `aggregation_coverage` (0–1) on the axis: the share of expected input samples with data. Incomplete windows are kept and listed on stderr.

### Notes
- A cell missing samples that other cells have is NaN for that window; values are never averaged over a partial record.
- `--window` is refused on axes with missing rows or CF `{dim}_bounds`; use `--period`.

### Example
```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/aggregate.py -i chirps_kenya.zarr -o chirps_kenya_weekly.zarr \
  --period weekly --end-time 2026-10-15
```
Writes weekly mean CHIRPS rates (`mm day-1`) whose last week is 2026-10-08 to 2026-10-14, labeled 2026-10-08.

```bash
uv run ${CLAUDE_SKILL_DIR}/scripts/aggregate.py -i gfs_precip.zarr -o gfs_precip_6h.zarr --period "6 hour" --time-dim step
```
Writes 6-hour mean GFS precip rates; hourly and 3-hourly leads are weighted by their `step_bounds`. Step 42 h is the 42–48 h mean.

## Details

- Input that is already aggregated must divide evenly into the period (weekly → `14 day`, not `monthly`), else exit 2. A period shorter than the input's samples (`6 hour` on daily data, or shorter than the widest `step_bounds` cell) also exits 2. Input already at the period is only stamped, not changed.
- Concatenated segments with gaps (e.g. one week per year) straddle windows; aggregate each segment before concatenating.

**Window geometry.** Windows are half-open `[left, right)` and labeled at the left edge, on `step` and with `--end-time` alike: week 1 of a forecast initialized 2026-10-12 is `step = 0` and covers the same days as the `--end-time 2026-10-19` observation week labeled 2026-10-12.

**Coverage.** A sample counts only when some cell has data (a fixed land mask does not count as missing; an all-NaN unpublished lead does). Re-aggregated input counts at its own coverage, so a 3/7 week inside a 14-day window gives 10/14.

**Irregular axes.** Inputs with CF `{dim}_bounds` are weighted by sample duration (`sum(rate × dt) / sum(dt)`).

**Calendar dekads.** Fetch the dekad and pass its length with `--end-time` the day after it: 21–31 Oct is `--period '11 day' --end-time 2026-11-01`.
Files in this package (3)
  • SKILL.md 5 KB
  • scripts/aggregate.py 30 KB
  • tests/test_aggregate.py 34 KB

Versions

The database has no other skills named aggregate-temporal.

Database snapshot: 13.11.2026 · package version d20074811e51 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100convert-calendar
    Convert a weather-skills Zarr's time axis to another CF calendar: the standard calendar of observations, or a climate-model calendar such as noleap (no Feb 29) or 360_day (twelve 30-day months). Use to put two datasets on one calendar before comparing them, e.g. a noleap model…
  • 100convert-to-totals
    Convert precipitation mean rates in a time-aggregated weather-skills Zarr into period totals in mm, by multiplying each interval's rate by its stamped aggregation period (calendar months by their real length). Use when you need weekly, monthly, or seasonal rainfall amounts for a…
  • 100derivation-aggregate-metrics
    Create an Estuary derivation that continuously aggregates metrics (daily totals, running counts, min/max, lifetime revenue) using reduction annotations. Use for real-time dashboards, continuous materialised views, and replacing batch ETL aggregations with streaming. Derivations…
  • 100social-youtube-report
    YouTube analytics report — queries channel stats, recent videos, engagement rates, top content. Generates HTML report. Use when user says 'youtube report', 'youtube metrics', 'youtube analytics', or any reference to YouTube performance analysis. Supports daily, weekly, and monthly periods.

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.