-
Notifications
You must be signed in to change notification settings - Fork 15
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
add PlotFileData bindings #320
base: development
Are you sure you want to change the base?
Conversation
@BenWibking thanks a lot, looking good! Ping us when you are ready with the unit test and we can include it maybe in this month's release even? |
@ax3l I've added a unit test to read a 3D plotfile with a single level. I put the binary data in the PR, but I can move that to some more appropriate place if needed. When I try to add a test for a 2D plotfile, I get this error:
Do 2D tests need to have some special configuration? |
for more information, see https://pre-commit.ci
@ax3l Aside from the 2D test issue, everything should be working now. |
@@ -0,0 +1,22 @@ | |||
HyperCLaw-V1.1 |
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.
@BenWibking Thanks for the question!
Yes, please do not check in binary files into the repository, to keep it small. We clone pyAMReX in many workflows, e.g., superbuilds and a slick repo size is important.
Could you potentially for the test generate the data on the fly, e.g., by running a generating function first that you read back?
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 am surprised the pre-commit.ci check check-added-large-files
that we run on CI does not fail on the 6 MB binary file... concerning :-o
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.
My concern is that I don't know how to independently verify that the plotfile generation was correct if it's generated on the fly. Would it be possible to upload the test files as an extra .tar.gz file in a GitHub release, or to re-use the test data on the yt website under "boxlib frontend"?
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.
Downloading the test data on the fly is ok.
There is a downside to this, making some test runs slow and others impossible (w/o internet).
My concern is that I don't know how to independently verify that the plotfile generation was correct if it's generated on the fly.
I think this can be verified once manually or in a separate test. (We also do not verify a downloaded files continuously, unless I misunderstand something 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.
Ok, that makes sense. I think verifying the checksum for the generated plotfile would work instead of downloading a file (since that should be checksummed anyway).
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.
@BenWibking when you have the time, can you still update this? I would merge the PR once the large files are not checked in anymore :)
Co-authored-by: Axel Huebl <axel.huebl@plasma.ninja>
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
|
||
@pytest.mark.skipif(amr.Config.spacedim != 2, reason="Requires AMREX_SPACEDIM = 2") | ||
def plot_plotfile_2d(filename, level=0): | ||
import amrex.space2d as amr |
Check notice
Code scanning / CodeQL
Module is imported more than once Note
on line 51
|
||
@pytest.mark.skipif(amr.Config.spacedim != 3, reason="Requires AMREX_SPACEDIM = 3") | ||
def test_plotfiledata_read(): | ||
import amrex.space3d as amr |
Check notice
Code scanning / CodeQL
Module is imported more than once Note
on line 8
This is awesome! I was hoping for this capability. In general, to use pyamrex for pre/postprocessing workflows having as much I/O capability as possible is super helpful. Another example would be reading/writing individual FAB data (appears to be commented out here: pyamrex/src/Base/FArrayBox.cpp Line 38 in 63cae48
|
That would be useful. I'm not sure why that's commented out. Maybe @ax3l knows? In the future, I would like to add the ability to lazy-load FABs for out-of-core analysis, but that might require additional changes in AMReX. |
Awesome, yes those function should be added, too, but maybe in a separate PR. There are some comments in #82 and |
Enable reading plotfiles with pyAMReX. Also adds a script in
tools/
to create images from plotfiles.Example use-case: https://github.com/BenWibking/plotfile-viewer.
Closes #317.