Skip to content
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

Merged
merged 8 commits into from
Mar 7, 2024

Conversation

Thomas-Ulrich
Copy link
Contributor

@Thomas-Ulrich Thomas-Ulrich commented Feb 28, 2024

  • 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.

@Thomas-Ulrich Thomas-Ulrich changed the title seissolxdmfwriter: bugfixes seissolxdm/seissolxdmfwriter: bugfixes Mar 1, 2024
@@ -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)
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Thomas-Ulrich Thomas-Ulrich force-pushed the thomas/seissolxdmfwriter_bugfixes branch from b36106c to 86a892d Compare March 6, 2024 09:52
@davschneller davschneller merged commit 1a2c811 into master Mar 7, 2024
@davschneller davschneller deleted the thomas/seissolxdmfwriter_bugfixes branch March 7, 2024 11:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants