Multiple nesting feature#13
Conversation
|
@MireyaMMO this is great, thanks for sending this pull request :) Sorry for taking a bit to get back on this, a bit busy at the moment, but I'll address this soon. |
|
@MireyaMMO thank you so much for this this contribution — multiple nest support is a great new feature and the overall approach is solid. I've made some improvements on top of your code before merging, described below. I'm sorry this took a bit long to be reviewed. interface.py Extended OutputInterface to inject runtime times into nestout components within each NEST, consistent with how other write components are now handled. output.py — NEST design Simplified the validator logic in NEST. Rather than using a mode-before validator to inject sname into child dicts, we give sname a default of "nest" on both NGRID and NESTOUT directly — this makes behaviour consistent whether children are passed as dicts or pre-built objects, and removes the need for the injection step entirely. We also defined a shared SNAME_TYPE to avoid repeating field constraints across BaseLocation, BaseWrite, and NEST, and added min_length=1 to both base classes. group.py Split the nest_or_ngrid_and_nestout validator into two with clearer responsibilities:
Tests
Docs Updated docs/components/output.md to introduce NEST as the preferred approach and mark NGRID, NESTOUT standalone usage as deprecated. |
|
The only issue though is that there were some conflicts with changes merged to main after you started your work. I ended up doing the following: pulled your branch locally, merged the latest changes from main into it to bring it up to date, resolved the conflicts, and then made the changes described above. The updated code is on review/multiple-nests on the main repository — if you pull from there and push to your branch, your PR will be ready to merge: Alternatively, I'm also happy to open a new PR directly from review/multiple-nests — all your original commits are included and you'll be fully credited for the work. Just let me know which you'd prefer. |
|
Brilliant @rafa-guedes the improvements make a lot of sense! I have just followed your steps provided in the comment above and there are no more conflicts with main. |
Implementation Summary: Multiple Child Nests Support for ROMPY-SWAN
Overview
Successfully implemented support for defining multiple child nested grids from a single parent grid in ROMPY-SWAN, addressing a key limitation where only one child nest was previously allowed.
Changes Made
1. New
NESTComponent (output.py)NESTcomponent that couplesNGRIDandNESTOUTcomponents togethersnameacross all three components (NEST, NGRID, NESTOUT)NGRID) and unstructured (NGRID_UNSTRUCTURED) nested gridsKey Features:
2. Updated
OUTPUTComponent (group.py)nestsfield that accepts a list ofNESTcomponentsngridandnestoutfieldsNew Usage:
3. Updated
OutputInterface(interface.py)time_interfacevalidator to handle nests properlynestoutfield to avoid triggering deprecation warningsnestslist to set time parameters for each nest's NESTOUT component4. Validators and Error Handling
nestswith legacyngrid/nestoutfieldsTesting
Comprehensive test suite integrated into existing test files:
Usage Example
YAML Configuration