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

Avoiding issue for CHOLLA LightRay datasets #4389

Merged
merged 3 commits into from
Mar 29, 2023

Conversation

chummels
Copy link
Member

The CHOLLA frontend identifies its dataset based on the presence of a couple of HDF5 attributes. When a yt LightRay dataset is created from any frontend, it inherits all of the attributes from that frontend. So when someone tries to load a LightRay dataset created from a CHOLLA frontend, yt gets confused as it thinks it's both a CHOLLA frontend as well as a LightRay dataset and it barfs. This removes that degeneracy by specifically looking for the LightRay attribute in the HDF5 file and not counting it as a CHOLLA dataset when it finds it. Bug reported by @evaneschneider .

@chummels chummels added the code frontends Things related to specific frontends label Mar 29, 2023
@@ -157,6 +157,10 @@ def _is_valid(cls, filename, *args, **kwargs):
except AttributeError:
return False
else:
return "bounds" in attrs and "domain" in attrs
# Avoiding issue where CHOLLA LightRay datasets get selected
if attrs["data_type"] == "yt_light_ray":
Copy link
Member

Choose a reason for hiding this comment

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

What happens if attrs doesn't have data_type? How about making this part of the below statement, with something like return attrs.get("data_type", None) != "yt_light_ray" or something?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call! I'm not thinking this morning.

neutrinoceros
neutrinoceros previously approved these changes Mar 29, 2023
yt/frontends/cholla/data_structures.py Outdated Show resolved Hide resolved
Co-authored-by: Clément Robert <cr52@protonmail.com>
@chummels
Copy link
Member Author

Thanks for the feedback, team!

@neutrinoceros neutrinoceros enabled auto-merge March 29, 2023 20:22
@neutrinoceros neutrinoceros merged commit b209c2a into yt-project:main Mar 29, 2023
@chummels chummels deleted the chollafix branch March 29, 2023 23:42
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.

3 participants