area_aggregation¶
aggregators¶
- class AttributeAggregator(source: UniformAttribute, target: UniformAttribute, func: str, mapping: QueryResult = None, default_special_value=-9999, weights: ndarray = None, previous_source: ndarray = None)¶
Bases:
object- add_mapping(mapping: QueryResult)¶
- calculate(dt=None)¶
- static ensure_special_value(attr, special_value)¶
- initialize()¶
- set_weights(weights: ndarray)¶
- aggregation_function(name: str, time_history: bool = False)¶
- func_avg(source, special, weights, **_) ndarray¶
- func_integral(previous_source, weights, dt, previous_target, scale=1, **_) ndarray¶
- func_integral_days(previous_source, weights, dt, previous_target, **_) ndarray¶
- func_integral_hours(previous_source, weights, dt, previous_target, **_) ndarray¶
- func_integral_minutes(previous_source, weights, dt, previous_target, **_) ndarray¶
- func_max(source, special, **_) ndarray¶
- func_min(source, special, **_) ndarray¶
- func_sum(source, weights, **_) ndarray¶
model¶
- class AggregatorConfig¶
Bases:
TypedDict- function: str¶
- source_attribute: str¶
- source_entity_group: Tuple[str, str]¶
- source_geometry: str¶
- target_attribute: str¶
- class Model(config)¶
Bases:
TrackedModelImplementation of the area aggregation model
- add_aggregators(state: TrackedState, target_entity, aggregators: List[AggregatorConfig], schema: AttributeSchema)¶
- aggregators: List[AttributeAggregator]¶
- static calculate_weights(mapping: QueryResult, length: int)¶
Calculate the frequency of every source entity mapping and set its weight to 1/frequency. If a source entity occurs in multiple target entities, its contribution to the sum, avg, and integral aggregators is divided equally over the areas it occurs in
- ensure_ready()¶
- static ensure_uniform_attribute(ds, entity, spec: AttributeSpec)¶
- initialize(**_)¶
- classmethod install(sim: Simulation)¶
- output_interval: int | None¶
- parse_config(state: TrackedState, config: Dict, schema: AttributeSchema)¶
- resolve_mapping()¶
- setup(state: TrackedState, schema, **_)¶
- src_entities: List[GeometryEntity | EntityGroup]¶
- target_entity: PolygonEntity | EntityGroup | None¶
- update(state: TrackedState, moment: Moment) Moment | None¶
- convert_v1_v2(config)¶
- ensure_function(func)¶