xarray-contrib / xarray-simlab

Xarray extension and framework for computer model simulations
http://xarray-simlab.readthedocs.io
BSD 3-Clause "New" or "Revised" License
73 stars 9 forks source link

visualising `inout` dependencies #181

Open feefladder opened 3 years ago

feefladder commented 3 years ago

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 -/
  2. 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.

feefladder commented 3 years ago

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

feefladder commented 3 years ago

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.