Skip to content

Commit 8c3808e

Browse files
committed
Fix indexing in xdmf jinja template
1 parent 0d5a765 commit 8c3808e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

conda_package/mpas_tools/viz/mpas_to_xdmf/templates/xdmf_template.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
<Domain>
44
<Grid Name="TimeSeries" GridType="Collection" CollectionType="Temporal">
55
{% if times|length > 0 %}
6-
{% set t_index = 0 %}
7-
{% for t_val in times %}
8-
<Grid Name="Step{{ t_index }}" GridType="Uniform">
6+
{% for t_val in times %}
7+
{% set t_index = loop.index0 %}
8+
<Grid Name="Step{{ t_index }}" GridType="Uniform">
99
<Time Value="{{ t_val }}"/>
1010
<Topology TopologyType="Polygon" NumberOfElements="{{ num_elements }}" NodesPerElement="{{ num_verts }}">
1111
<DataItem Format="HDF" Dimensions="{{ num_elements }} {{ num_verts }}">{{ h5_basename }}:/Cells</DataItem>
@@ -16,7 +16,7 @@
1616
{% for var in variables %}
1717
{% if var.has_time %}
1818
<Attribute Name="{{ var.name }}" AttributeType="Scalar" Center="Cell">
19-
<DataItem Format="HDF" Dimensions="{{ num_elements }}">{{ h5_basename }}:/{{ var.name }}_t{{ t_index }}</DataItem>
19+
<DataItem Format="HDF" Dimensions="{{ num_elements }}">{{ h5_basename }}:/{{ var.name }}_t{{ t_index }}</DataItem>
2020
</Attribute>
2121
{% else %}
2222
<Attribute Name="{{ var.name }}" AttributeType="Scalar" Center="Cell">
@@ -25,7 +25,6 @@
2525
{% endif %}
2626
{% endfor %}
2727
</Grid>
28-
{% set t_index = t_index + 1 %}
2928
{% endfor %}
3029
{% else %}
3130
<Grid Name="Static" GridType="Uniform">

0 commit comments

Comments
 (0)