@@ -406,17 +406,16 @@ def _write_data(
406
406
407
407
def _component_names (n_components ):
408
408
"""
409
- To be correctly read in a MED viewer, each component must be a
410
- string of width 16. Since we do not know the physical nature of
411
- the data, we just use V1, V2, ...
409
+ To be correctly read in a MED viewer, each component must be a string of width 16.
410
+ Since we do not know the physical nature of the data, we just use V1, V2, ...
412
411
"""
413
412
return "" .join (["V%-15d" % (i + 1 ) for i in range (n_components )])
414
413
415
414
416
415
def _family_name (set_id , name ):
417
416
"""
418
- Return the FAM object name corresponding to
419
- the unique set id and a list of subset names
417
+ Return the FAM object name corresponding to the unique set id and a list of subset
418
+ names
420
419
"""
421
420
return "FAM" + "_" + str (set_id ) + "_" + "_" .join (name )
422
421
@@ -432,8 +431,10 @@ def _write_families(fm_group, tags):
432
431
group .attrs .create ("NBR" , len (name )) # number of subsets
433
432
dataset = group .create_dataset ("NOM" , (len (name ),), dtype = "80int8" )
434
433
for i in range (len (name )):
435
- name_80 = name [i ] + "\x00 " * (80 - len (name [i ])) # make name 80 characters
436
- dataset [i ] = [ord (x ) for x in name_80 ]
434
+ # make name 80 characters
435
+ name_80 = name [i ] + "\x00 " * (80 - len (name [i ]))
436
+ # Needs numpy array, see <https://github.com/h5py/h5py/issues/1735>
437
+ dataset [i ] = numpy .array ([ord (x ) for x in name_80 ])
437
438
438
439
439
440
register ("med" , [".med" ], read , {"med" : write })
0 commit comments