gafusion / omas

Ordered Multidimensional Array Structure
http://gafusion.github.io/omas
MIT License
32 stars 15 forks source link

ITER case: plotting is failing #65

Closed kripnerl closed 5 years ago

kripnerl commented 5 years ago

Failing plotting for ITER baseline:

ods = omas.load_omas_iter_scenario(pulse=130501, run=1)
In [28]: omas.omas_plot.equilibrium_summary(ods)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-28-913587c8af9d> in <module>()
----> 1 omas.omas_plot.equilibrium_summary(ods)

~/.local/lib/python3.6/site-packages/omas/omas_plot.py in equilibrium_summary(ods, time_index, fig, **kw)
    483 
    484     ax = fig.add_subplot(1, 3, 1)
--> 485     ax = equilibrium_CX(ods, time_index=time_index, ax=ax, **kw)
    486     eq = ods['equilibrium']['time_slice'][time_index]
    487 

~/.local/lib/python3.6/site-packages/omas/omas_plot.py in equilibrium_CX(ods, time_index, contour_smooth, levels, ax, **kw)
    422     line = numpy.array([numpy.nan, numpy.nan])
    423     for item1 in contourPaths(eq['profiles_2d'][0]['grid']['dim1'], eq['profiles_2d'][0]['grid']['dim2'], value2D.T,
--> 424                               levels, smooth_factor=contour_smooth):
    425         for item in item1:
    426             line = numpy.vstack((line, item.vertices, numpy.array([numpy.nan, numpy.nan])))

~/.local/lib/python3.6/site-packages/omas/omas_plot.py in contourPaths(x, y, Z, levels, remove_boundary_points, smooth_factor)
     71     [X, Y] = numpy.meshgrid(x, y)
     72     if compare_version(matplotlib.__version__, '2.1') >= 0:
---> 73         contour_generator = _contour.QuadContourGenerator(X, Y, Z, None, True, 0)
     74     else:
     75         Cntr = matplotlib._cntr.Cntr(X, Y, Z)

ValueError: x, y and z must all be 2D arrays with the same dimensions
kripnerl commented 5 years ago

this is linked to #53. There is simply a random order of dimensions...

orso82 commented 5 years ago

@kripnerl please try

ods.physics_equilibrium_transpose_RZ(flip_dims=False)

Also, note that you can use this notation:

ods.plot_equilibrium_summary()
kripnerl commented 5 years ago

Thx.

After ods.physics_equilibrium_transpose_RZ(flip_dims=False) plotting works.

orso82 commented 5 years ago

So, I guess this mean that the data in iter_scenario (pulse=130501, run=1) has the equilibrium data flipped in RZ?

kripnerl commented 5 years ago

True.