@@ -739,7 +739,7 @@ def _maybe_get(elt: Element, item: str, info: str,
739739
740740def read_geom_h5 (
741741 xdmf_file : Path , snapshot : Optional [int ]
742- ) -> Tuple [Optional [ Dict [str , Any ] ], Element ]:
742+ ) -> Tuple [Dict [str , Any ], Element ]:
743743 """Extract geometry information from hdf5 files.
744744
745745 Args:
@@ -751,7 +751,7 @@ def read_geom_h5(
751751 header : Dict [str , Any ] = {}
752752 xdmf_root = xmlET .parse (str (xdmf_file )).getroot ()
753753 if snapshot is None :
754- return None , xdmf_root
754+ return {} , xdmf_root
755755
756756 # Domain, Temporal Collection, Snapshot
757757 # should check that this is indeed the required snapshot
@@ -922,7 +922,7 @@ def read_tracers_h5(xdmf_file: Path, infoname: str, snapshot: int,
922922 Tracers data organized by attribute and block.
923923 """
924924 xdmf_root = xmlET .parse (str (xdmf_file )).getroot ()
925- tra : Dict [str , List [ndarray ]] = {}
925+ tra : Dict [str , List [Dict [ int , ndarray ] ]] = {}
926926 tra [infoname ] = [{}, {}] # two blocks, ordered by cores
927927 if position :
928928 for axis in 'xyz' :
@@ -942,12 +942,14 @@ def read_tracers_h5(xdmf_file: Path, infoname: str, snapshot: int,
942942 icore , data = _get_field (
943943 xdmf_file , _try_find (xdmf_file , data_attr , 'DataItem' ))
944944 tra [infoname ][ibk ][icore ] = data
945+ tra_concat : Dict [str , List [ndarray ]] = {}
945946 for info in tra :
946947 tra [info ] = [trab for trab in tra [info ] if trab ] # remove empty blocks
947- for iblk , trab in enumerate (tra [info ]):
948- tra [info ][iblk ] = np .concatenate ([trab [icore ]
949- for icore in range (len (trab ))])
950- return tra
948+ tra_concat [info ] = []
949+ for trab in tra [info ]:
950+ tra_concat [info ].append (
951+ np .concatenate ([trab [icore ] for icore in range (len (trab ))]))
952+ return tra_concat
951953
952954
953955def read_time_h5 (h5folder : Path ) -> Iterator [Tuple [int , int ]]:
0 commit comments