-
I have an MPAS output file with a number of variables with a variety of dimensions. Some have dimensions The first example (dimensions
While I do get a 1-D array with length
My expectation is that the first print would give me a single data point (since the first dimension, Clearly I am doing something wrong and/or not understanding how to properly address these data structures. I have also tried using the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi @mkavulich To use our plotting routines, you want your data to only have a The typically way to achieve this would be to use # same as uxds["surface_pressure"][0]
uxds["surface_pressure"].isel(Time=0)
# same as uxds["theta"][0, :, 0]
uxds["theta"].isel(Time=0, nVertLevels=0) The reason you are getting strange results is that when you are indexing the array, you have separate brackets (i.e. uxds["surface_pressure"][:][0]The leading uxds["surface_pressure"][0][:]This does the same steps but in reverse:
The same thing happens for the others. If you replace the individual brackets with a single multidimensional index, that should do the trick. A nice read on this can be found here: https://www.hpc-carpentry.org/hpc-python/03-lists/index.html Let me know if this works! |
Beta Was this translation helpful? Give feedback.
Hi @mkavulich
To use our plotting routines, you want your data to only have a
n_edge
,n_face
orn_node
dimension, with no leading dimensions (i.e. a 1D slide of unstructured data) like you mentioned.The typically way to achieve this would be to use
isel()
to select a slice from the other dimensions. This would look like the following:The reason you are getting strange results is that when you are indexing the array, you have separate brackets (i.e.
[][][]
) instead of doing a single multidimensional index when you use the colon (which is …