-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure separatrices, target plotted correctly if Dataset transposed #68
Conversation
I'm not really a fan of adding extra coordinates to the dataset if we don't need to, if only because it's going to be confusing for users. So this is intended to solve the problem of not knowing which dimensions correspond to the radial and poloidal directions on a plot if the ds.attrs['plot_dims'] = {'radial': 'x', 'poloidal': 'y'} The downside of this approach compared to yours is that it would have to be manually updated if someone renames their dims, whereas your coordinate-approach will update the coordinate to match automatically. I'm not sure which approach would be less confusing for users? |
I'm not completely up to speed on what problem is trying to be solved here, but just be careful that "radial" and "poloidal" do imply a particular coordinate system, or set of coordinate systems, and don't apply to all BOUT++ uses. For example, linear plasma devices might use "azimuthal" instead of "poloidal". |
@TomNicholas good points. I guess the question is what is the expected use-case? Probably most people will use 'toroidal' geometry, or a few other types (e.g. linear device, FCI) that could be added to The place this is actually needed is in the plotting routines that support plots in the R-Z plane in toroidal geometry, which are probably allowed to fail in other geometries (although I guess a cylindrical linear device might be able to use some of them). So cases where users are re-naming coordinates interactively and don't create a |
f03bf90
to
c286033
Compare
Hello @johnomotani! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found: There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2019-12-09 18:43:33 UTC |
Create metadata variables called 'bout_tdim', 'bout_xdim', 'bout_ydim', and 'bout_zdim' that record what 't', 'x', 'y', and 'z' respectively were renamed to. This means that in plot_separatrices() and plot_targets() we can find renamed dimensions corresponding to 'x' and 'y' even if the Dataset has been transposed so that we cannot rely on the order of the dimensions.
c286033
to
bc62e98
Compare
I had to add the new stuff to |
Codecov Report
@@ Coverage Diff @@
## master #68 +/- ##
==========================================
+ Coverage 44.74% 50.05% +5.31%
==========================================
Files 8 8
Lines 789 877 +88
Branches 152 178 +26
==========================================
+ Hits 353 439 +86
- Misses 380 381 +1
- Partials 56 57 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So cases where users are re-naming coordinates interactively and don't create a plot_dims attribute probably just don't expect those methods to work anyway.
Yes, exactly. If the user doesn't specify geometry='toroidal'
, they won't have 'R'
and 'Z'
coordinates, so the plotting method will fail with an appropriate error.
Thanks!
Ensure separatrices, target plotted correctly if Dataset transposed
Create coordinates called
'xdim'
,'ydim'
and'zdim'
that depend only onx
,y
andz
respectively, before applying geometry and re-naming the dimensions. This means that inplot_separatrices()
andplot_targets()
we can find renamed dimensions corresponding tox
andy
even if the Dataset has been transposed so that we cannot rely on the order of the dimensions.This isn't exactly a beautiful solution, but I think it makes things more robust, without restricting what users can do with the BoutDataset.