API Overview
This page points to the most important classes and functions of the xarray-simlab-ode API.
Top-level functions
|
Creates xsimlab Model instance, from dict of XSO components, automatically adding the necessary model backend, solver and time components. |
|
Create a specific setup for model runs. |
Component
|
A component decorator that adds everything needed to use the class as a XSO component. |
Variable types
|
Create a state variable. |
|
Create a parameter. |
|
Create a forcing variable. |
|
Create a flux function. |
|
Create an index. |
Backend components
|
Backend core class that initializes solver and model, and translates between the two for model construction and solving. |
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. |
|
Abstract base class of backend solver class, use subclass to solve model within the XSO framework. |
|
Solver backend using scipy.integrate.solve_ivp to solve model. |
|
Solver that can handle stepwise calculation built into xsimlab framework. |
|
|
Xarray-simlab process initializing and storing model backend and solver. |
|
Inherited by all other model components to access backend. |
|
Process defining model time and registering it in model backend. |
|
Inherits model backend from context and calls solver to run as final initialization stage of model runtime. |
Xarray-simlab
Since XSO mostly wraps xarray-simlab, it can be helpful to also reference that API.
The
@xso.component`decorator function returns a fully functional :deco:`xsimlab:xsimlab.processclass.The
xso.create()function returns axsimlab.Modelinstance.The
xso.setup()function is a light wrapper aroundxsimlab.create_setup().All variable types are represented in the model as
xsimlab.variable()instances.
We can access the xarray-simlab API through the xsimlab accessor of the created input and output xarray Datasets:
>>> import xarray as xr # first import xarray
>>> import xsimlab # import xsimlab (the 'xsimlab' accessor is registered)
>>> ds = xr.Dataset() # create or load an xarray Dataset
>>> ds.xsimlab.<meth_or_prop> # access to the methods and properties listed below