model.runtime.builders.system_builderΒΆ

Single entry-point system builder for ADELM.

Module ContentsΒΆ

ClassesΒΆ

ADELMSystem

Build and expose a callable ADELM system from runtime config.

APIΒΆ

class model.runtime.builders.system_builder.ADELMSystem(config)ΒΆ

Bases: torch.nn.Module

Build and expose a callable ADELM system from runtime config.

This class is the single public entry point for the new builder layer. It owns the assembly flow but remains compatible with the existing runtime by exposing a torch.nn.Module-like interface.

Typical usage::

model = ADELMSystem.from_config("my_config.yaml")
model.build()
outputs = model(all_drivers)

:meth:from_config parses the config file and returns an un-initialised instance. :meth:build constructs the model and, when data.site.drivers_path is set, loads and binds site data automatically.

Initialization

Initialize internal Module state, shared by both nn.Module and ScriptModule.

classmethod from_config(config_path=DEFAULT_CONFIG_PATH, config_overrides=None)ΒΆ

Parse a YAML config file and return an un-initialised :class:ADELMSystem instance.

Call :meth:build afterwards to construct the model and load site data.

build(load_data=True)ΒΆ

Construct the model and optionally load site data.

Parameters

load_data : bool, default True When True and config.data.site.drivers_path is set, :meth:load_data is called automatically after the model is constructed. Pass False when the caller (e.g. a :class:~model.runtime.runners.BaseRunner) handles data loading itself.

load_data()ΒΆ

Load site data from config-specified paths and bind to the model.

Reads drivers, attributes, parameters, targets, and fractional cover from the NetCDF files declared under data.site.* in the config, then calls :meth:bind_static_inputs and :meth:initialize_states. The loaded data dict is stored on self.data.

bind_static_inputs(attris=None, fcover=None, params=None, n_entities=None)ΒΆ

Bind static site inputs and run all static parameterization routines.

Broadcasts scalar parameters to [n_entities], applies PFT-based lookup, runs pedotransfer and root-fraction precomputation, and records an initial NN parameter estimate.

initialize_states(n_entities, device=None)ΒΆ

Initialize default prognostic states for n_entities sites.

get_initial_states()ΒΆ
set_initial_states(initial_states)ΒΆ
forward(all_drivers, initial_states=None, output_keys=None, show_progress=False, progress_desc='Forward')ΒΆ