In [1]:
import veneer
v = veneer.Veneer()
%matplotlib inline
Demonstration model
In [2]:
v.network().plot()
Out[2]:
In [3]:
set(v.model.catchment.runoff.get_models())
Out[3]:
In [4]:
v.model.find_states('TIME.Models.RainfallRunoff.AWBM.AWBM')
Out[4]:
In [5]:
v.model.catchment.runoff.create_modelled_variable?
NOTE: When creating modelled variables we need to use the names that appear in the Project Explorer.
Also note that not everything will be available. If its not in the Project Explorer, you probably can't use it for a modelled variable
In [6]:
# Save the result!
variables = v.model.catchment.runoff.create_modelled_variable('Baseflow store')
The result of the function call is very important. It tells us what was created and the names.
The names will be based on the target variable (Baseflow store) and the names (plural) of the target object, in this case, catchment and FU.
In [18]:
variables
Out[18]:
In [19]:
# variables['created'] are the variable names that we want to insert into the functions
variables['created']
Out[19]:
In [9]:
name_params = list(v.model.catchment.runoff.enumerate_names())
name_params
Out[9]:
In [3]:
v.model.functions.create_functions?
In [11]:
# Again, save the result...
functions = v.model.functions.create_functions('$funky_%s_%s','1.1 * %s',variables['created'],name_params)
Result of create_functions includes a list of created functions
In [12]:
functions
Out[12]:
In [13]:
functions['created']
Out[13]:
Note You can see all these in Edit | Functions But the dockable 'Function Manager' doesn't tend to update (at least as of 4.3)
We apply the function against a particular target (eg v.model.catchment.runoff).
Because we've done all this against one target (v.model.catchment.runoff) we can assume that everything is in the same order, so the following bulk application can work.
In [15]:
# Applying functions in some nonsensical manner...
v.model.catchment.runoff.apply_function('A2',functions['created'])
Out[15]:
In [ ]: