-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
seissolxdm/seissolxdmfwriter: bugfixes #15
Conversation
Thomas-Ulrich
commented
Feb 28, 2024
•
edited
Loading
edited
- The extractor was not working with SR (computed from SRs and SRd), because the derived seissolxdmf was not passed to seissolxdmdwriter (and GetDataLocationPrecisionMemDimension needed to be specialized as well but was not). This required a change of the interface, so I increased version number of 0.4.0.
- seissolxdmf was not able to read a 1D array (e.g. partition, fault-tag) when the array was padded.
- seissolxdmfwriter was not working properly when specifiying a path in the prefix (in this case the basename should be written in the xdmf, to allow opening the file from any directory).
- dependency to tqdm is added.
- other bug fixes.
@@ -238,7 +238,7 @@ def Read1dData(self, dataName, nElements, isInt=False): | |||
myData = self.ReadHdf5DatasetChunk(path + filename, hdf5var, 0, MemDimension) | |||
else: | |||
filename = dataLocation | |||
myData = self.ReadSimpleBinaryFile(path + dataLocation, nElements, data_prec, isInt) | |||
myData = self.ReadSimpleBinaryFile(path + dataLocation, nElements, data_prec, isInt, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quick question: what does the 0 do here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good question!
It turns out that there is a bug in the xdmfwriter of seissol (not the python module!), as partition or fault-tags are padded, but the size written in the xdmf file in the unpadded one.
Here is an example of output:
</Geometry>
<Time Value="0"/>
<Attribute Name="partition" Center="Cell">
<DataItem NumberType="Int" Precision="4" Format="Binary" Dimensions="4368">tpv5-fault_cell/mesh0/partition.bin</DataItem>
</Attribute>
<Attribute Name="fault-tag" Center="Cell">
<DataItem NumberType="Int" Precision="4" Format="Binary" Dimensions="4368">tpv5-fault_cell/mesh0/fault-tag.bin</DataItem>
</Attribute>
<Attribute Name="SRs" Center="Cell">
<DataItem ItemType="HyperSlab" Dimensions="4368">
<DataItem NumberType="UInt" Precision="4" Format="XML" Dimensions="3 2">0 0 1 1 1 4368</DataItem>
<DataItem NumberType="Float" Precision="4" Format="Binary" Dimensions="1 2097152">tpv5-fault_cell/mesh0/SRs.bin</DataItem>
</DataItem>
</Attribute>
<Attribute Name="SRd" Center="Cell">
<DataItem ItemType="HyperSlab" Dimensions="4368">
<DataItem NumberType="UInt" Precision="4" Format="XML" Dimensions="3 2">0 0 1 1 1 4368</DataItem>
<DataItem NumberType="Float" Precision="4" Format="Binary" Dimensions="1 2097152">tpv5-fault_cell/mesh0/SRd.bin</DataItem>
</DataItem>
</Attribute>
Therefore if we read with idt=-1, we read a much larger array than expected (and the inferred ndt is very large in the case above and myData cannot be reshaped).
As a work-around, I set idt=0 so that just the first chunk of size nElements get read.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a comment (but it would also make sense to fix the xdmfwriter)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b36106c
to
86a892d
Compare