-
Notifications
You must be signed in to change notification settings - Fork 90
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
Support writing gauge binary output #537
Conversation
note that pyclaw.gauges changes are required to read binary file
…ived ascii data for portability
Update: I modified the regression test so that the gauge 2 files are not saved, and the gauge 2 binary data is compared against the gauge 1 ascii data saved in This required a modified |
Looks good and works for me. This looks like it does not include the serialization of gauge writing (#536), correct? |
If we decide not to merge #536 then this PR needs some work. |
This part is still WIP, see discussion at clawpack#536
I reverted the code from #536, we are still considering on the best way to write out the gauges when using OpenMP. I also added capability to choose either 8-byte or 4-byte format for the binary output (i.e. float64 or float32 when reading into Python). This can be specified in
while either There's a new line in the gauge header file to indicate the format, needed in order to load it properly. In the binary output case a file like
and the data is in In the ascii case it contains the header followed by the data, as before:
This is ready for others to test. |
Note: This is based on the branch in #536, so there are some replicated commits until that's merged in.
This adds the previously NotImplemented option of binary output for gauges, indicated in setrun.py by setting
to take effect for all gauges, or selectively by setting this to a dictionary, see http://www.clawpack.org/gauges.html
For binary gauges, an output file of the form
gauge00000N.txt
is still created with the header, containing the gauge location, description of the columns, and indication for Lagrangian gauges. But the gauge data itself is written to the corresponding filegauge00000N.bin
(analogous tofort.q
andfort.b
files for the time frames).I will do a PR on pyclaw for a modified
gauges.py
that can read in the binary files.I modified the unit test in
tests/dtopo1
to write one ascii gauge and one binary gauge (at the same location).I tested that restarts still work, it will append new data to the binary file created in the initial run. (Although if you try to change the gauge's
file_format
from one run to the next, confusion will result. Maybe we should add a test for that.)This capability should eventually be added to
amrclaw
in 1d, 2d, 3d as well.