Closed thelampire closed 5 years ago
Hmmm, I am not sure about this. Please consider: flap.coordinate('Device R')[0] will return the Device R coordinate for all points in the 3D array. To get only those which change along the R dimension add index=... to the call. For R the dimension list contains 1 if I understand well therefore index could be index=[0,...,0]. The returned coordinate values will still be 3D but the first and last dimension will have 1 element. Doing .flatten() on the returned data should give you the correct R coordinate. Does this work? If not please make a flap.list_data_objects() on the data object so as I can see what is there.
There might be more clever way to do this and I was thinking about it. E.g. there could be a change_only boolean input so as the call generates the appropriate index.
FLAP is working fine, the problem is with matplotlib.pyplot.contour. I close this one as it is unrelated to FLAP. I am sorry for not figuring this out earlier.
I am trying the following:
I am adding these elements to the flap.Coordinate object as follows:
Here the spatial_data=R_coords if dim_ind=0 and spatial_data=z_coords if dim_ind=1. The dimension_list=[0] element is time and it is already filled up. Now, if I access the flap.coordinates[1].values or flap.coordinates[2].values I get back the same values as appended to the coord object list. If do a plt.contour(R_coords,z_coords,psiRZ) contourplot, I get the correct contour. However, this is not the correct way as flap.coordinate('Device R')[0] and flap.coordinate('Device z')[0] should be used. However, if I use these the returned coordinates are not good, at all. I understand that a 128 x 64 x 64 array is returned corresponding to the psiRZ data shape. But the returned coordinates are 90 degrees shifted and I believe they are mixed in a weird way. I attached two images, which show the descrepancy.
The wrong coordinates with flap.coordinate('Device R')[0] and flap.coordinate('Device z')[0]:
The right coordinates with flap.coordinates[1].values and flap.coordinates[2].values: