BMIv3: Defining sets of variables exported by a model - #186
Conversation
|
I posed this question to Nels: Should there be an API to get the set of set names that a model defines? I'm leaning toward 'no', because
Additionally, "what sets can I expect from a given model?" seems like a very natural thing to tie into "what extensions does the model support?", and a given set name might even have different semantics around its contents depending on which of multiple conflicting extensions promise its presence |
|
Initially asking for review from Scott and Nels for help in drafting this well, before really looking for feedback from the broader BMI council. |
|
Discussed this with Nels, and made some small revisions accordingly. |
…n for major version
265c54d to
af8ffd8
Compare
e40459f to
96727be
Compare
|
@RolfHut Eric mentioned you may not have seen this suggestion at a previous meeting. It had pretty general support. It replaces |
96727be to
01387c7
Compare
|
I still worry that some information is lost from the transition from input/output variables to varsets; the implied "settability" of variables. Especially for frameworks wrapping BMI it can be very valuable to know if a variable can be set with For example, in my BMI controller front-end it is nice to only present users with an input field and a set button for variables which you can actually set. Having to read through a model's BMI documentation (if it even exists) is not machine-readable and thus makes it more difficult to implement frameworks on top of BMI. |
I think the idea here is to provide/document known sets, e.g.
Under 2.0 semantics,
These exact same semantics would work with the var set, but the controller interface would take a slightly different path. On existing BMI 2.0 the controller (likely) does something like this (python flavored) model = initialize( config )
inputs = model.get_input_var_names( )
# show user available inputs
# get input from user to pass to model
result = model.set_value( var, value )The exact same semantics under this proposal would look like model = initialize( config )
inputs = get_varset_members( "input_vars" )
# show user available inputs
# get input from user to pass to model
result = model.set_value( var, value )What we ask models to do differently here is to implement a named varset, On the topic of "settability", in a more general sense, I have found the following BMI 2.0 functions to be the minimum required to ensure a variable can be set properly -- the variable must be "known" to each of these functions and each must yield a
But the minimum test is still a call to I would definitely be interested in perhaps a slightly separate, yet definitely related, discussion on expanding/enumerating |
|
my two cents:
|
Yes, but this should then be explicitly stated in the BMI specification. For BMI 2.0 this was largely just implied.
This is only specified for the C/Fortran specs. For C++ and Java it's a void function. It is not specified if e.g. Python should raise an exception here in case the value cannot be set. The main thing to rely on here was just "if it's in the input variables it is probably settable, otherwise it's not".
For Python, C++, Java, R, JavaScript, and Julia the
I think that expanding on the expected behavior for when function calls fail would improve BMI. The spec could use with more formalized error handling or at a minimum more guidance on this. It could also be a solution to this problem. |
|
Can I ask that the discussion of "what is settable" and what that means be considered separately from this change? It's as much an issue with BMI 2 |
|
Regarding the |
01387c7 to
5393121
Compare
This is a generalization of the 'input' and 'output' sets of export items defined in BMI v2. This will enable models to present a richer range of variables to frameworks that are calling and driving them.
Example uses: