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

More flexible API for model creation and customization #62

Open benbovy opened 5 years ago

benbovy commented 5 years ago

An alternative (or orthogonal) option to #52, inspired by PyMC3 and Keras Sequential model:

with xs.Model() as model:
    model.add(Grid, name='grid')
    model.add(Flow, name='flow')

    in_ds = xs.create_setup(...)
    out_ds.xsimlab.run()

The advantages of this approach:

ben1post commented 4 years ago

This possible feature looks very interesting, and might be helpful for my workflow.

To understand the aim correctly: Is the order that processes are added to the model recorded, and the processes will be initialized in that order at runtime? Or is this order only related to foreign variables and process dependencies?

benbovy commented 3 years ago

To understand the aim correctly: Is the order that processes are added to the model recorded, and the processes will be initialized in that order at runtime? Or is this order only related to foreign variables and process dependencies?

It should enable both. This is discussed in https://github.com/xarray-contrib/xarray-simlab/issues/164#issuecomment-803196865 and in #177, although using a different API that is a bit more flexible than the one here above.