rom-py / rompy

Relocatable Ocean Modelling in PYthon (rompy) combines templated cookie-cutter model configuration with various xarray extensions to assist in the setup and evaluation of coastal ocean model
https://rom-py.github.io/rompy/
BSD 3-Clause "New" or "Revised" License
3 stars 9 forks source link

Multi components #119

Closed rafa-guedes closed 1 month ago

rafa-guedes commented 1 month ago

New framework to define MultiComponent types from existing components.

A MultiComponents base class has been implemented to convert existing components into a list of their own types which can be used to render more than one instance of that command.

A new BLOCKS components has been implemented using that approach.

Other components have been implemented before to provide a similar ability of replicating SWAN commands, for example the QUANTITIES component. These existing classes should now be rewritten to use this new Base Class approach (this still needs to be done). There will be a small change from the user's perspective in that the main field for them will always be components now, which is different from the existing ones which use custom fields for each class (for example, in the case of QUANTITIES, the field is called quantities, for the CURVES component the field is currently defined as curves, and so on).

This pull request should address https://github.com/rom-py/rompy/issues/118 from @alsonathif

rafa-guedes commented 1 month ago

@alsonathif, @benjaminleighton, @pbranson if you could have a look at this please that would be great, and some of you could perhaps review / merge it if happy. I have started a new notebook where there is an example of using the new BLOCKS component (as usual, the docstring of the component class itself also has some example).

pbranson commented 1 month ago

Thanks @rafa-guedes lgtm