@@ -614,9 +614,14 @@ def _read_coord_h5(files, shapes, header, twod):
614614 meshes = _conglomerate_meshes (meshes , header )
615615 if np .any (meshes ['Z' ][:, :, 0 ] != 0 ):
616616 # spherical
617- header ['x_mesh' ] = np .copy (meshes ['Y' ]) # annulus geometry...
618- header ['y_mesh' ] = np .copy (meshes ['Z' ])
619- header ['z_mesh' ] = np .copy (meshes ['X' ])
617+ if twod is not None : # annulus geometry...
618+ header ['x_mesh' ] = np .copy (meshes ['Y' ])
619+ header ['y_mesh' ] = np .copy (meshes ['Z' ])
620+ header ['z_mesh' ] = np .copy (meshes ['X' ])
621+ else : # YinYang, here only yin
622+ header ['x_mesh' ] = np .copy (meshes ['X' ])
623+ header ['y_mesh' ] = np .copy (meshes ['Y' ])
624+ header ['z_mesh' ] = np .copy (meshes ['Z' ])
620625 header ['r_mesh' ] = np .sqrt (header ['x_mesh' ]** 2 + header ['y_mesh' ]** 2 +
621626 header ['z_mesh' ]** 2 )
622627 header ['t_mesh' ] = np .arccos (header ['z_mesh' ] / header ['r_mesh' ])
@@ -842,6 +847,12 @@ def read_field_h5(xdmf_file, fieldname, snapshot, header=None):
842847 ibk ] = fld
843848 data_found = True
844849
850+ if flds .shape [0 ] == 3 and flds .shape [- 1 ] == 2 : # YinYang vector
851+ # Yang grid is rotated compared to Yin grid
852+ flds [0 , ..., 1 ] = - flds [0 , ..., 1 ]
853+ vt = flds [1 , ..., 1 ].copy ()
854+ flds [1 , ..., 1 ] = flds [2 , ..., 1 ]
855+ flds [2 , ..., 1 ] = vt
845856 flds = _post_read_flds (flds , header )
846857
847858 if fieldname in SFIELD_FILES_H5 :
0 commit comments