Skip to content

Commit 64bf864

Browse files
authored
Merge pull request #958 from nschloe/h5py-3.0
fix for h5py 3.0
2 parents 62c21bb + 4b12baf commit 64bf864

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

meshio/med/_med.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -406,17 +406,16 @@ def _write_data(
406406

407407
def _component_names(n_components):
408408
"""
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, ...
412411
"""
413412
return "".join(["V%-15d" % (i + 1) for i in range(n_components)])
414413

415414

416415
def _family_name(set_id, name):
417416
"""
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
420419
"""
421420
return "FAM" + "_" + str(set_id) + "_" + "_".join(name)
422421

@@ -432,8 +431,10 @@ def _write_families(fm_group, tags):
432431
group.attrs.create("NBR", len(name)) # number of subsets
433432
dataset = group.create_dataset("NOM", (len(name),), dtype="80int8")
434433
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])
437438

438439

439440
register("med", [".med"], read, {"med": write})

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = meshio
3-
version = 4.3.2
3+
version = 4.3.3
44
author = Nico Schlömer et al.
55
author_email = [email protected]
66
description = I/O for many mesh formats

0 commit comments

Comments
 (0)