[BUG] Better logic for detection of particle handle for checkpoint files #5019
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Summary
We do not support particle data in FLASH data before version 3, but we do support reading in FLASH 2.x datasets.
The current logic for detecting a FLASH particle file which corresponds to a FLASH plotfile checks the filename for the string
"hdf5_plt"
and replaces it with"hdf5_part"
. It then generates a file handler for the particle file:yt/yt/frontends/flash/data_structures.py
Lines 192 to 206 in 7ebe857
This works just fine for plot and particle files that match, but this logic completely misses checkpoint files with the string
"hdf5_chk"
. But this falls through silently, because it will not change the filename at all in line 196 above and will open a separate file handler for the same input file.Then shortly after there is a check for the equality of the two file handles (which will fail because the same file has been opened two different times):
yt/yt/frontends/flash/data_structures.py
Lines 208 to 219 in 7ebe857
This does not create a problem for FLASH 3 files (aside from the extra and unnecessary file handle), but for FLASH 2.5 files we fail here because they do not have the
"real scalars"
HDF5 dataset:This PR addresses this problem by 1) Making sure that files with
"hdf5_chk"
in the filename are properly handled and 2) checking explicitly for files without"real scalars"
.PR Checklist