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

BUG: fix compatibility with gadget 2 files using '*.gad.*' template #3899

Merged
merged 1 commit into from
Apr 27, 2022

Conversation

neutrinoceros
Copy link
Member

@neutrinoceros neutrinoceros commented Apr 19, 2022

PR Summary

This fixes an issue where some Gadget2 files can't be loaded because their names aren't compatible with the filename template we have.
This problem was reported on Slack by @Gustav-Madsen. Here's an example dataset to test this on http://skun.iaa.es/SUsimulations/UchuuDR1/ShinUchuu/SamplingParticle/snapdir_070/
I was able to make a simple plot of this dataset, only downloading the first 3 files

import yt

ds = yt.load("snapdir_070")
yt.ParticleProjectionPlot(ds, "z", ("all", "Mass")).save("/tmp/")

SU140_070_samp0p015625_Particle_z_Mass

@neutrinoceros neutrinoceros added bug code frontends Things related to specific frontends labels Apr 19, 2022
Copy link
Contributor

@chrishavlin chrishavlin left a comment

Choose a reason for hiding this comment

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

Looks great! A couple of questions, but don't think they should hold up this PR, even if you agree:

GadgetHDF5Dataset._set_owls_eagle does something similar with filename_template -- is it worth moving your change into its own method at the GadgetDataset level (e.g., GadgetDataset.set_filename_template()) to use in both spots?

Related -- do you think there's any benefit to adding an explicit way to set the filename_template (maybe a kwarg)?

@neutrinoceros
Copy link
Member Author

GadgetHDF5Dataset._set_owls_eagle does something similar with filename_template -- is it worth moving your change into its own method at the GadgetDataset level (e.g., GadgetDataset.set_filename_template()) to use in both spots?

I wasn't aware ! Yes, I think this is worth including in the present PR, thank you !

do you think there's any benefit to adding an explicit way to set the filename_template (maybe a kwarg)?

Clearly it would have a benefit that users that need such patches wouldn't need to either wait for a new release or install from source. On the other hand such changes should hopefully be extremely rare so I don't think it's worth the additional maintenance weight.

@neutrinoceros
Copy link
Member Author

I spoke too soon. I don't feel confortable to change the _set_owls_eagle method after all

  1. I'm not sure such a change is needed or makes sense
  2. I don't think the _set_owls_eagle method belongs in the Gadget frontend in the first place (should probably be in owls, or eagle !).

Any way I don't understand these formats well enough to make further changes in that direction.

@chrishavlin
Copy link
Contributor

Ya, totally fair. I obviously don't fully understand these formats either :) These are also simple enough to fix down the line if there is need. I'll go ahead and merge since this is a bug fix.

@chrishavlin chrishavlin merged commit 528465f into yt-project:main Apr 27, 2022
@neutrinoceros neutrinoceros deleted the gadget2-support branch April 28, 2022 04:29
neutrinoceros pushed a commit to neutrinoceros/yt that referenced this pull request May 6, 2022
BUG: fix compatibility with gadget 2 files using '*.gad.*' template
@neutrinoceros neutrinoceros added this to the 4.0.4 milestone May 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug code frontends Things related to specific frontends
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants