More poloidal selectors#28
Open
mikekryjak wants to merge 25 commits into
Open
Conversation
Need the flexibility to plot an arbitrary selection, not just a named region. This also makes nomenclature consistent with sdtools.
It can plot either the RZ or poloidal grid
Now no longer relies on try/except for selections which are unavailable in a particular topology, which was bad design. Also correctly saves and retrieves the reference data.
Now RZ plot doesn't have the pink shading which can hide region boundaries. Also reduced font size in legend.
The guards can be either guard replaced or removed by the user. This is much easier than adding guards to the selection later.
Update for fix in yguards, add image generation
This has many advantages, especially because it allows you to easily see if a region is missing (due to wrong topology or not being implemented).
This was referenced Apr 10, 2026
They were in the metadata, so Xarray had to compare them for many operations, and slices are not comparable as it turns out
mrhardman
added a commit
to UKAEA-Edge-Code/hermes-3
that referenced
this pull request
Apr 17, 2026
Merged
mikekryjak
added a commit
that referenced
this pull request
Apr 20, 2026
- Add more poloidal selections and finish test - Now radial selections are explicit instead of bundled into combined regions "e.g. SOL boundary"
Now there is a separate radial and poloidal selector. The combined 2D selection always needs the radial, then the poloidal region. select_2d now has the function of ensuring the radial and poloidal choices make sense and handle special cases. Also added an example notebook and tests. Co-authored-by: Copilot <[email protected]>
This resolves a big confusor - the select_... tools return selectors, while ds.select_region returns an actual selected region. Now that the names are different, it should be clearer. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Previously ixseps1 was used instead of ixseps1g etc, breaking radial indexing when guards were removed - something that is handled properly for datasets already. I added a grid with guards removed to both the DN and SN tests in both poloidal and radial selector tests. Co-authored-by: Copilot <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds more poloidal selectors and improves
plot_region.plot_region
This has been renamed to
plot_selection, and now accepts either a region string like before (which is passed toslice_2d) or a selection tuple. This makes it more flexible and consistent with the sdtools implementation.New selectors
It is assumed that the midplane is always at a cell boundary. A poloidal index is provided for the cell centre above the midplane (e.g.
outer_upper_midplane) and below (e.g.outer_lower_midplane). In double null topologies, they are calculated from the branch cuts. In single null topologies, they are calculated based on theRgradient changing sign.X-point poloidal indices are provided for each target, e.g.
outer_lower_xpointfor double null, orouter_xpointfor single null. The convention is that this point always corresponds to the first point in the divertor region. This is because it is assumed that the main use of this feature is to mark the X-point on plots along the field line.Misc improvements
dltodpoland adddtorThis PR lays the groundwork for the implementation of two key functions from sdtools:
get_1d_poloidal_data and get_1d_radial_data.
To do: