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
2 stars 9 forks source link

Difficulty implementing multiple BLOCK commands in SWAN INPUT file generation #118

Open alsonathif opened 2 weeks ago

alsonathif commented 2 weeks ago

I am having trouble writing multiple BLOCK commands for the SWAN INPUT file using the current output.py in rompy/swan/components. I would like to be able to create multiple BLOCK commands and combine them using another class that can handle multiple blocks, similar to the CURVES as below: block1 = BLOCK( sname="COMPGRID", fname="./output-grid1.nc", output=["hsign", "dir"], ) block2 = BLOCK( sname="BOTTGRID", fname="./output-grid2.nc", output=["watlev"], ) blocks = BLOCKS(blocks=[block1, block2]) print(blocks.cmd())

Questions Is there a current way to achieve this functionality that I'm overlooking? If not, could this feature be added to the rompy package? Are there any plans to extend the SWAN output functionality in rompy to handle such instances with lists?

rafa-guedes commented 1 day ago

@alsonathif sorry I missed this issue. I'll have a look at this, if multiple block commands isn't supported it won't be difficult to implement it. I'll look into this soon and get back to you.

rafa-guedes commented 1 day ago

This has been implemented in https://github.com/rom-py/rompy/pull/119. A notebook with example usage is provided here.