Support NEMO tripolar T and F pivots. Add option to follow latitude circles - #45
Conversation
- tripolar-Tpivot for NEMO orca2 orca025 orca12 orca36 -- and maybe MOM6? - tripolar-Fpivot for NEMO orca1 orca05 - curve="latitude circle" option follows latitude=constant curves. Other curves can be added by providing two functions, one that measures closeness to the desired curve, and one that measures closeness to the endpoint. - kwargs argument added to GriddedSection.__init__ to allow passing through `topology` argument - Removed modulo nx operations where not necessary in `infer_grid_path`, but added a check on initial i values that I have not seen fail - build lons_c_seg, lats_c_seg as numpy arrays directly, rather than appending to a list - examples/4_sections_on_global_tripolar_grid.ipynb updated to show `curve="latitude circle"` and `topology="tripolar-Tpivot"`. Testing `topology="tripolar-Fpivot"` will require some other dataset.
|
I left I found the MOM5 elements manual section 9.4.3 specifies that the northern seam for U points (same as F points, as that document is written for an Arakawa B-grid) operates as From
Oddly, I thought the issue might be with the (i,j) walk algorithm, so I made a separate branch with a new algorithm over in https://github.com/geoffstanley/sectionate/tree/dev--walk-algorithm . More on that later. I get good results with following various transects across the north fold with a mesh_mask from NEMO's eorca1 ( |
|
Thanks for these great contributions, @geoffstanley ! Reviewing your PR inspired me to finally put in the effort (assisted by @claude) to do a major overhaul of sectionate's internals so it finds its neighbors using the grid-topology-aware internals of The major overhaul PR for sectionate is #47, which only extends support to the tripolar grid thanks to the new xgcm PR xgcm/xgcm#711, which works by extending the internal I am going to hold off on this PR until I get further test and get feedback on the other two PRs, since if they are merged they would supercede this one. |
|
Ok, that sounds good. It certainly makes sense to have all the grid connections handled by xgcm. I see you implemented Regarding my other branch dev--walk-algorithm, as I recall from my testing of CMIP6/7 sections (eg for |
|
@geoffstanley , I've done some more testing of my own implementation of the |
|
Hey @hdrake, my intention was to throw an error if the user requests
Yes, I'd say so. It does not make sense to use the |
|
@geoffstanley , I am thinking of testing this PR and potentially releasing it as 0.3.5, which leaves open the option that a future 0.4.0 release would extend support to multi-tile grids like ECCOv4r4 (e.g. as in my PR#47 that leverages new xgcm features for finding neighbors across face-connections and tripolar folds). Before merging this, I'd like to add the following two changes:
What do you think of this plan? |
|
That 0.3.5 plan sounds good to me.
|
|
I've done 1. Let me know about 2.! And any other changes that would help make executing the PR more seamless. Eg. |
|
I think stick we should stick with the current API of space-separated e.g. "great circle". I had just misremembered. I think it is worthwhile to add (2). Your suggested workaround of using |
|
I had read up on the MOM5 tripolar grid (I could not find a MOM6 description, so I assumed it was the same). From the MOM5 manual, I gleaned that the But, as I recall, using I'll review what's in the notebooks on this branch. |
Having it inside infer_grid_path can fail to trigger 'latitude circle' because the gridlat's at [i1,j1] and [i2,j2] can be different even though the given latitudes (latstart, latend) are the same.
|
In |
a56b446 to
9db3722
Compare
|
Just a minor update: I now average the latitudes of the two grid points that define the ends of the curve to be followed in I thought about instead passing the exact latitude of the section ( (force push was just to fix execution order diffs in the notebook, sorry.) I think it's ready to go now, if you want. I also ran |





New options for the
topologyargument:topology = "tripolar-Tpivot"handles the NEMO tripolar grid pivoting on the T (tracer) pointtopology = "tripolar-Fpivot"handles the NEMO tripolar grid pivoting on the F (vorticity) pointThe formulas for how to cross the north fold were created by studying Appendix E of the NEMO manual, v4.2.
New argument
curve:curve = "great circle"is the default; no changes from previous behaviourcurve = "latitude circle"is new; the walk through grid space will approximate a latitude circle.Minor updates to
examples/4_sections_on_global_tripolar_grid.ipynbto showcasecurve = "latitude circle".Minor edits to
docs/environment.ymlandexamples/load_example_model_grid.pythat I needed to make to get started.