_GET_HORIZONTAL_ not implemented for diagnostics #142
-
|
Dear community, I calculated a 2D diagnostic (z_opt below) from a 3D field. It is registered as a horizontal diagnostic and setting it works fine. At some parts of my program, I want to read this diagnostic with Error message: Indeed horizontal_index is not declared as a member of the type_variable_id (in fabm_types and fabm) for horizontal diags... |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
|
To achieve this, you'd register an additional dependency to read the value of the diagnostic. That dependency then needs to be coupled to the diagnostic. That coupling can be done explicitly in code, but as it is a recurrent pattern, you can achieve the same implicitly by registering your dependency with the same name as the diagnostic. For instance, in And then in This is described, albeit in very compact fashion, at the very end of https://github.com/fabm-model/fabm/wiki/Developing-a-new-biogeochemical-model#diagnostic-variables. |
Beta Was this translation helpful? Give feedback.
-
|
We implemented this successfully. Now we have a (more complex) model that has both do() and do_column(). We consistently added for all diags also the corresponding dependencies to make them readable. And we need data in do() that originates from do_column() and vice versa. We get the error:
Is that @jornbr
|
Beta Was this translation helpful? Give feedback.
-
|
FABM's problem here is that it cannot schedule the calls to which states that Note 1: in the previous scenario, where you register a dependency on your own diagnostic, this Note 2: it is quite common for such circular dependencies to arise when a lot of logic is put in a single module. In such cases it may be that the detected circular dependency is not real, in the sense that one of the routines does not actually use the dependency value at all. For those cases, a much better solution is to split that one monolithic module into multiple modules. |
Beta Was this translation helpful? Give feedback.
-
|
Thank you @jornbr . We had thought of the 2nd possibility, too, but the first one make more sense (with stale flag), as it is not a real circular dependency anyway. |
Beta Was this translation helpful? Give feedback.
To achieve this, you'd register an additional dependency to read the value of the diagnostic. That dependency then needs to be coupled to the diagnostic. That coupling can be done explicitly in code, but as it is a recurrent pattern, you can achieve the same implicitly by registering your dependency with the same name as the diagnostic. For instance, in
initialize:And then in
do_column:This is described, albeit in very compact fashion, at the very end of https://github.com/fabm-model/fabm/wiki/Developing-a-new-biogeochemical-model#diagnostic-variables.