-
Notifications
You must be signed in to change notification settings - Fork 18
Description
Description:
There is currently some confusion in the BMI specification regarding how to handle variables that are not associated with any grid. While the documentation may not be inherently ambiguous, it deviates from the original intent of the specification, which has led to inconsistencies across some implementations.
Current behavior
The documentation implies that all variables must be associated with a grid, even if that grid is conceptually a scalar or not associated with a location in space. As a result:
get_var_grid(name)is expected to return a valid grid ID.get_grid_type(grid_id)is expected to return "scalar" for ungridded variables.
The value returned by get_var_location(name) is effectively ignored for scalar/ungridded variables.
However, in practice, some BMI users and implementations have returned "none" from get_var_location
to indicate the variable has no spatial location. This convention has not been officially supported.
Proposal
To resolve this discrepancy and clarify intent, I propose the following changes to the specification:
-
Add "none" as a valid return value for
get_var_location."none"indicates that the variable has no spatial location
and is not associated with a grid.- If
get_var_location(name)returns "none":get_var_grid(name)should not be called. - None of the
get_grid_*functions (get_grid_type,get_grid_shape, etc.) need to be implemented for this variable. - This avoids assigning meaningless or artificial grid IDs to scalar/ungridded variables.
- If
-
Maintain backward compatibility by treating "none" as a special case within existing tools, while encouraging adoption
of this clarified behavior in future BMI-compliant models and frameworks. Existing tools should still work with
models that follow the current convention.
Benefits
- Eliminates the need for artificial grid IDs for scalar or non-spatial variables.
- The
get_grid_functions are only called by variables that have grids. - Decouples the
get_grid_functions from theget_var_functions for ungridded variables. The grid functions can be
thought of as an "extension" only for variables that are gridded.