Skip to content

Commit 2c6801d

Browse files
committed
Fix reading of fields on Yang grid with hdf output
1 parent 8be740a commit 2c6801d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

stagpy/stagyyparsers.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,11 @@ def _get_field(xdmf_file, data_item):
652652
"""Extract field from data item."""
653653
shp = _get_dim(data_item)
654654
h5file, group = data_item.text.strip().split(':/', 1)
655-
icore = int(group.split('_')[-2]) - 1
655+
# Field on yin is named <var>_XXXXX_YYYYY, on yang is <var>2XXXXX_YYYYY.
656+
# This splitting is done to protect against that and <var> possibly
657+
# containing a 2.
658+
numeral_part = group.split('2')[-1]
659+
icore = int(numeral_part.split('_')[-2]) - 1
656660
fld = None
657661
try:
658662
fld = _read_group_h5(xdmf_file.parent / h5file, group).reshape(shp)

0 commit comments

Comments
 (0)