xarray-contrib/xarray-simlab

visualising `inout` dependencies

feefladder opened this issue · 2 comments

I feel a bit guilty that #164 was initially about visualizing inout variables, but that has not been properly addressed in the following discussion or PRs. Furthermore, the checking algorithm works, but may be a bit aggressive. The user still does not really have a good way to see all relationships, such as seeming cycles as @jvail initially intendet. Therefore, the following proposal for two different options in the visualisation:

  1. the initial proposal by @jvail. Add dotted arrows from the last inout process to all first in processes for all variables. as an option in visualise model.visualize(cycle_arrows=True) e.g.:
in->inout->inout->in
 ^            /
  \- dotted -/
  1. add color enhancement for a single variable. Possibly as an enhancement of show_only_variable or separate model.visualize(show_variable_stages='p_name__var_name')
    green?        red?
 /---------\  /-----------\    red?        green?
in->other->inout->other->inout------>inout------->in
^           \            ^           /
 \    green? \--->in----/ green?    /
  \- - - - - - - - - - - - - - - - / dotted (as in 1.)

This would make it clear for the user if processes are updated or not before they are used.

Both require a similar algorithm to work, but 2 is quite more complex to implement.

#184 will not address 2. I think that it will help users in debugging custom dependencies however, what are your thoughts on that?

added an example notebook for why 2. is useful. For example when a user does not understand the error messages of strict_check, they can still visualize the graph with the different stages of that variable.