model.runtime.builders.system_builderΒΆ
Single entry-point system builder for ADELM.
Module ContentsΒΆ
ClassesΒΆ
Build and expose a callable ADELM system from runtime config. |
APIΒΆ
- class model.runtime.builders.system_builder.ADELMSystem(config)ΒΆ
Bases:
torch.nn.ModuleBuild 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_configparses the config file and returns an un-initialised instance. :meth:buildconstructs the model and, whendata.site.drivers_pathis 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:
ADELMSysteminstance.Call :meth:
buildafterwards 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
TrueWhenTrueandconfig.data.site.drivers_pathis set, :meth:load_datais called automatically after the model is constructed. PassFalsewhen 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_inputsand :meth:initialize_states. The loaded data dict is stored onself.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_entitiessites.
- get_initial_states()ΒΆ
- set_initial_states(initial_states)ΒΆ
- forward(all_drivers, initial_states=None, output_keys=None, show_progress=False, progress_desc='Forward')ΒΆ