@@ -198,24 +198,23 @@ def read_field_circ( filename, iteration, field, coord,
198198 field_path = join_infile_path ( field , coord )
199199 group , dset = find_dataset ( dfile , iteration , field_path )
200200
201+ # Current simulation time
202+ time = (it .attrs ['time' ] + group .attrs ['timeOffset' ]) * it .attrs ['timeUnitSI' ]
203+
201204 # Extract the metainformation
202205 coord_labels = {ii : coord .decode () for (ii ,coord ) in
203206 enumerate (group .attrs ['axisLabels' ])}
204- coord_label_str = '' .join (coord_labels .values ())
205- coord_label_str = 'm' + coord_label_str
206- coord_order = RZorder [coord_label_str ]
207-
208- # Current simulation time
209- time = (it .attrs ['time' ] + group .attrs ['timeOffset' ]) * it .attrs ['timeUnitSI' ]
210-
211- if coord_order == RZorder .mrz :
207+ if coord_labels [0 ] == 'r' :
208+ coord_order = RZorder .mrz
212209 Nm , Nr , Nz = get_shape ( dset )
213210 N_pair = (Nr , Nz )
214- elif coord_order == RZorder . mzr :
211+ elif coord_labels [ 1 ] == 'r' :
215212 Nm , Nz , Nr = get_shape ( dset )
216213 N_pair = (Nz , Nr )
214+ coord_order = RZorder .mzr
217215 else :
218216 raise Exception (order_error_msg )
217+
219218 info = FieldMetaInformation ( coord_labels , N_pair ,
220219 group .attrs ['gridSpacing' ], group .attrs ['gridGlobalOffset' ],
221220 group .attrs ['gridUnitSI' ], dset .attrs ['position' ], time ,
@@ -287,12 +286,6 @@ def read_field_circ( filename, iteration, field, coord,
287286 else :
288287
289288 # Extract the modes and recombine them properly
290- if coord_order is RZorder .mrz :
291- F_total = np .zeros ( (2 * Nr , Nz ), dtype = dset .dtype )
292- elif coord_order is RZorder .mzr :
293- F_total = np .zeros ( (Nz , 2 * Nr ), dtype = dset .dtype )
294- else :
295- raise Exception (order_error_msg )
296289 if m == 'all' :
297290 # Sum of all the modes
298291 # - Prepare the multiplier arrays
@@ -308,11 +301,13 @@ def read_field_circ( filename, iteration, field, coord,
308301 # - Sum the modes
309302 F = get_data ( dset ) # (Extracts all modes)
310303 if coord_order is RZorder .mrz :
304+ F_total = np .zeros ( (2 * Nr , Nz ), dtype = F .dtype )
311305 F_total [Nr :, :] = np .tensordot ( mult_above_axis ,
312306 F , axes = (0 , 0 ) )[:, :]
313307 F_total [:Nr , :] = np .tensordot ( mult_below_axis ,
314308 F , axes = (0 , 0 ) )[::- 1 , :]
315309 elif coord_order is RZorder .mzr :
310+ F_total = np .zeros ( (Nz , 2 * Nr ), dtype = F .dtype )
316311 F_total [:, Nr :] = np .tensordot ( mult_above_axis ,
317312 F , axes = (0 , 0 ) )[:, :]
318313 F_total [:, :Nr ] = np .tensordot ( mult_below_axis ,
@@ -321,9 +316,11 @@ def read_field_circ( filename, iteration, field, coord,
321316 # Extract mode 0
322317 F = get_data ( dset , 0 , 0 )
323318 if coord_order is RZorder .mrz :
319+ F_total = np .zeros ( (2 * Nr , Nz ), dtype = F .dtype )
324320 F_total [Nr :, :] = F [:, :]
325321 F_total [:Nr , :] = F [::- 1 , :]
326322 elif coord_order is RZorder .mzr :
323+ F_total = np .zeros ( (Nz , 2 * Nr ), dtype = F .dtype )
327324 F_total [:, Nr :] = F [:, :]
328325 F_total [:, :Nr ] = F [:, ::- 1 ]
329326 else :
@@ -337,9 +334,11 @@ def read_field_circ( filename, iteration, field, coord,
337334 F_sin = get_data ( dset , 2 * m , 0 )
338335 F = cos * F_cos + sin * F_sin
339336 if coord_order is RZorder .mrz :
337+ F_total = np .zeros ( (2 * Nr , Nz ), dtype = F .dtype )
340338 F_total [Nr :, :] = F [:, :]
341339 F_total [:Nr , :] = (- 1 ) ** m * F [::- 1 , :]
342340 elif coord_order is RZorder .mzr :
341+ F_total = np .zeros ( (Nz , 2 * Nr ), dtype = F .dtype )
343342 F_total [:, Nr :] = F [:, :]
344343 F_total [:, :Nr ] = (- 1 ) ** m * F [:, ::- 1 ]
345344 else :
0 commit comments