Skip to content

SeasonWindow

Definition

SeasonWindow is a frozen dataclass (@dataclass(frozen=True), config.py:257) representing one named temporal aggregation window expressed in season-DOY coordinates. Two collections of windows are declared per commodity: climo_windows (for climatology z-score aggregations) and weather_windows (for windowed weather accumulations). Both are held as tuple[SeasonWindow, ...] on CommodityConfig.

Fields

Field Type Meaning
name str Identifier used as a column suffix (e.g. "apr_jul"edd_zscore_apr_jul)
sdoy_start int Season-DOY of window open (season day 1 = first day of season_start month)
sdoy_end int \| None Season-DOY of window close. None means "progressive to the current init_date".

sdoy_end=None produces a growing-season-to-date (gstd) accumulation that grows weekly until harvest.

Window semantics

All aggregations are computed progressively: sum windows yield a running total over [sdoy_start, min(init_date_lag, sdoy_end)] that expands at each init_date and freezes once the window closes. Mean and max behave symmetrically but use their own identity element. Pre-window sums default to 0.0; pre-window mean/max remain NaN (undefined on zero samples).

Corn USA examples

CommodityConfig.climo_windows for corn USA (two windows):

Name sdoy_start sdoy_end Calendar equivalent
gstd 1 None Apr 1 → current init_date (progressive)
apr_jul 1 122 Apr 1 → Jul 31 (fixed)

CommodityConfig.weather_windows for corn USA (three windows):

Name sdoy_start sdoy_end Calendar equivalent
apr_may 1 61 Apr 1 → May 31
jun 62 91 Jun 1 → Jun 30
jul 92 122 Jul 1 → Jul 31

Source citations

config.py:257 — class definition and docstring. config.py:317CommodityConfig.climo_windows field. config.py:319CommodityConfig.weather_windows field.

Cross-references