<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Example for bulk function management
Shows
Step1:  Demonstration model
Step2:  NOTE
Step3:  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.
Step4:  Result of create_functions includes a list of created functions
Step5:  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.
<ASSISTANT_TASK:>
Python Code:
import veneer
v = veneer.Veneer()
%matplotlib inline
Explanation: Example for bulk function management
Shows:
Creating multiple modelled variables
Creating multiple functions of the same form, each using one of the newly created modelled variables
Applying multiple functions
End of explanation
v.network().plot()
set(v.model.catchment.runoff.get_models())
v.model.find_states('TIME.Models.RainfallRunoff.AWBM.AWBM')
v.model.catchment.runoff.create_modelled_variable?
Explanation: Demonstration model
End of explanation
# Save the result!
variables = v.model.catchment.runoff.create_modelled_variable('Baseflow store')
Explanation: 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
End of explanation
variables
# variables['created'] are the variable names that we want to insert into the functions
variables['created']
name_params = list(v.model.catchment.runoff.enumerate_names())
name_params
v.model.functions.create_functions?
# Again, save the result...
functions = v.model.functions.create_functions('$funky_%s_%s','1.1 * %s',variables['created'],name_params)
Explanation: 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.
End of explanation
functions
functions['created']
Explanation: Result of create_functions includes a list of created functions
End of explanation
# Applying functions in some nonsensical manner...
v.model.catchment.runoff.apply_function('A2',functions['created'])
Explanation: 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.
End of explanation
<END_TASK>