boutproject / xBOUT

Collects BOUT++ data from parallelized simulations into xarray.
https://xbout.readthedocs.io/en/latest/
Apache License 2.0
22 stars 10 forks source link

FCI geometry: basic test #228

Closed dschwoerer closed 3 years ago

dschwoerer commented 3 years ago

The test is failing, but with a slighly different error ... but I think this is related to dask ...

dschwoerer commented 3 years ago
# Works (no coordinates)
ds["Ne"].isel(y=0,t=-1).plot.pcolormesh()
# raises: ValueError: Dimensions {'y'} do not exist. Expected one or more of ('x', 'z')
ds["Ne"].isel(y=0,t=-1).bout.pcolormesh()

Is that expected? Any hints what I need to change to fix it?

codecov-commenter commented 3 years ago

Codecov Report

Merging #228 (e1b1e1c) into fci-geometry (d6fbeaa) will increase coverage by 0.55%. The diff coverage is 66.66%.

Impacted file tree graph

@@               Coverage Diff                @@
##           fci-geometry     #228      +/-   ##
================================================
+ Coverage         75.31%   75.86%   +0.55%     
================================================
  Files                15       15              
  Lines              2702     2702              
  Branches            631      631              
================================================
+ Hits               2035     2050      +15     
+ Misses              435      420      -15     
  Partials            232      232              
Impacted Files Coverage Δ
xbout/region.py 85.88% <ø> (+1.98%) :arrow_up:
xbout/geometries.py 72.67% <66.66%> (+2.90%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update d6fbeaa...e1b1e1c. Read the comment docs.

johnomotani commented 3 years ago

@dschwoerer the PR looks good to me. Error seems a bit odd - can you post a back-trace please? I can't see where the exception is coming from, doesn't seem to actually be in xBOUT...

johnomotani commented 3 years ago

Ah, actually I think I might know what the problem was. plot2d_wrapper() https://github.com/boutproject/xBOUT/blob/e1b1e1c6e1abcac20266db83965dde49fb9af164/xbout/plotting/plotfuncs.py#L79 was written to make 'poloidal plane' plots, assuming that the dimensions would be bout_xdim and bout_ydim. Actually plot2d_wrapper is most useful for that case, because it's only when we have an x-y plane that we might need to split up into different regions to plot. The best fix for this error might actually be to fix #167, so we can turn of poloidal_plot (which should get rid of the error), and check that when poloidal_plot=True the dimensions are actually bout_xdim and bout_ydim.

A workaround, since FCI doesn't use regions, is to just not use the xBOUT method, and instead do something like

ds["Ne"].isel(y=0,t=-1).plot.pcolormesh(x="R", y="Z")
johnomotani commented 3 years ago

...merging this on the assumption that my previous comment was the cause of the error @dschwoerer reported. We can fix that issue in a future PR.