Version: dev

parameter_update

Stable type · Document types

Tier: stable · Kind: type · Topic: Document types

JuliaTypeScriptPythonRustGo
ParameterUpdatenot exportedParameterUpdateParameterUpdateParameterUpdate

Julia

struct ParameterUpdate
ParameterUpdate(kind::AbstractString; times, interval, initial_offset, when, direction, source, hook, expression, from, handler)
ParameterUpdate

One rule saying WHEN a parameter refreshes and WHAT it refreshes from (esm-spec §5.4). One mechanism covers a Wiener noise source (kind: "wiener"), a refresh on a schedule, from data or on a remesh (schedule / data / remesh), and a change when a condition holds or a crossing occurs (condition / crossing).

Trigger fields by kind: schedule uses times / interval / initial_offset; condition and crossing use when (plus direction for crossing); data uses source; remesh uses hook; wiener uses none. Value forms: exactly one of expression, from, handler for every kind except wiener, which resamples the parameter’s own distribution.

Source

TypeScript

TypeScript does not export this type.

Python

class ParameterUpdate
ParameterUpdate(kind: Literal['wiener', 'schedule', 'condition', 'crossing', 'data', 'remesh'], times: list[float] | None = None, interval: float | None = None, initial_offset: float | None = None, when: Expr | None = None, direction: str | None = None, source: str | None = None, hook: str | None = None, expression: Expr | None = None, from_source: DataSourceBinding | None = None, handler: FunctionalUpdate | None = None)

One rule declaring WHEN a parameter refreshes and WHAT from (esm-spec §5.4). Six kinds, and this single dataclass carries the union of their slots — only those belonging to kind are ever populated or emitted.

wiener is a driving stochastic process: it takes no value form (it resamples the parameter’s own distribution) and requires one. The other five each take EXACTLY ONE value form — expression, from_source (wire key from), or handler.

schedule fires at preset times and/or every interval; condition at the end of any step where when is true; crossing when when crosses zero (located by root-finding); data when the named data_sources entry advances a record; remesh on a mesh-topology change. ParameterUpdate is also the SOLE seed of the DISCRETE cadence class (CONFORMANCE_SPEC §5.7.2).

Source

Rust

pub enum ParameterUpdate {
    Wiener,
    Schedule { times: Option<Vec<f64>>, interval: Option<f64>, initial_offset: Option<f64>, value: UpdateValue },
    Condition { when: Expr, value: UpdateValue },
    Crossing { when: Expr, direction: Option<String>, value: UpdateValue },
    Data { source: String, value: UpdateValue },
    Remesh { hook: Option<String>, value: UpdateValue },
}

impl ParameterUpdate { pub fn kind(&self) -> &'static str }

impl ParameterUpdate { pub fn value(&self) -> Option<&UpdateValue> }

impl ParameterUpdate { pub fn value_mut(&mut self) -> Option<&mut UpdateValue> }

impl ParameterUpdate { pub fn when(&self) -> Option<&Expr> }

impl ParameterUpdate { pub fn when_mut(&mut self) -> Option<&mut Expr> }

impl ParameterUpdate { pub fn data_source(&self) -> Option<&str> }

One update rule: WHEN a parameter refreshes, and WHAT from (esm-spec §5.4). Every kind except wiener carries exactly one value form — expression, from, or handler — held in the flattened UpdateValue ; wiener carries none, because the parameter’s distribution IS its value.

Source · Rust docs

Go

type ParameterUpdate struct {
	Kind string `json:"kind"`

	// --- schedule ---
	Times         []float64 `json:"times,omitempty"`
	Interval      *float64  `json:"interval,omitempty"`
	InitialOffset *float64  `json:"initial_offset,omitempty"`

	// --- condition / crossing ---
	When Expression `json:"when,omitempty"`
	// Direction is crossing-only: "up" | "down" | "any" (default "any").
	Direction string `json:"direction,omitempty"`

	// --- data ---
	// Source names a `data_sources` key; it MUST resolve
	// (`data_source_undefined`, esm-spec 8.5).
	Source string `json:"source,omitempty"`

	// --- remesh ---
	Hook string `json:"hook,omitempty"`

	// --- the three value forms; exactly one is set on a non-wiener rule ---
	Expression Expression         `json:"expression,omitempty"`
	From       *DataSourceBinding `json:"from,omitempty"`
	Handler    *FunctionalUpdate  `json:"handler,omitempty"`
}

func (u ParameterUpdate) IsBrownian() bool

func (u *ParameterUpdate) UnmarshalJSON(data []byte) error

ParameterUpdate is ONE rule of a parameter’s update block (esm-spec 5.4): WHEN the parameter refreshes (Kind, plus the kind’s own trigger fields) and WHAT from (exactly one of Expression / From / Handler – except wiener, which takes none because it resamples the parameter’s own Distribution).

It collapses three 0.x constructs: the brownian variable type (now wiener), the discrete type’s RefreshTrigger (now schedule / data / remesh), and the discrete_parameters event lists with their functional_affect (now condition / crossing carrying a Handler).

Methods

func (u ParameterUpdate) IsBrownian() bool

IsBrownian reports whether this rule is the driving Wiener process.

func (u *ParameterUpdate) UnmarshalJSON(data []byte) error

Custom JSON unmarshaling for ParameterUpdate: when and expression are Expression positions and must go through UnmarshalExpression so a numeric literal keeps its int/float wire shape and an operator object becomes an ExprNode rather than a raw map.

Source · Go docs