xso.model

Module Contents

Classes

Model

Base model class, containing dictionaries of all model variables and components,

Functions

return_dim_ndarray(value)

Helper function to always have at least 1d numpy array returned.

xso.model.return_dim_ndarray(value)[source]

Helper function to always have at least 1d numpy array returned.

class xso.model.Model[source]

Base model class, containing dictionaries of all model variables and components, as well as the function that sorts through all of these, and computes each step at model runtime.

It is instantiated once at model setup and filled with the specific variables defined in components and their supplied labels and values. The Model class is stored in the model backend and shared and written to by all components.

__repr__()[source]

Simple repr implementation that prints model components

unpack_flat_state(flat_state)[source]

Function called at the beginning of the model_function, to convert array of model values into a labeled dictionary. This allows for easier calculations, and ensures compatibility to most solving algorithms.

model_function(time=None, current_state=None, forcing=None)[source]

General model function that computes forcings and fluxes. Is called within solve function of Solver.

Parameters:
  • current_state (numpy array) – Large array containing all current values for model.

  • time (numpy array or None) – Can be passed explicitly for certain solvers, e.g. odeint solver passes array of model time.

  • forcing (dict or None) – Can be passed explicitly for certain solvers, e.g. stepwise solver evaluates current time step value and passes that as dict.