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

[AMRVAC] bugfix geometry parsing #2541

Merged
merged 3 commits into from
Apr 15, 2020

Conversation

neutrinoceros
Copy link
Member

hotfix a bug in amrvac frontend where 'default' geometry would cause a ValueError to be raised.

@neutrinoceros neutrinoceros added bug code frontends Things related to specific frontends labels Apr 14, 2020
Copy link
Member

@matthewturk matthewturk left a comment

Choose a reason for hiding this comment

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

This looks fine, but I wonder if it would be cleaner to have it be a dict that gets accessed, and then let the KeyError propagate instead. That would push the geometry_yt result back up to the user to see. So for instance:

geometry_yt = {'default': 'cartesian', ...}[geometry_tag.split("_")[0].lower()]

@neutrinoceros
Copy link
Member Author

So... something like this ?

@matthewturk
Copy link
Member

I like it!

Copy link
Member

@munkm munkm left a comment

Choose a reason for hiding this comment

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

I like the dict refactor. This looks good. It might be worth adding a note to the docstring that the default geometry is assumed to be cartesian, unless that's well-known in the AMRVAC community.

@neutrinoceros
Copy link
Member Author

neutrinoceros commented Apr 14, 2020

I don't think it's well known. I just discovered it myself and I think that prior to the yt frontend, almost nobody in the community was using the native data files for analysis anyway... well, I'm adding the note then 😅

edit: whoops, the docstring was also containing a now irrelevant Raises section

@munkm munkm merged commit 4d5a019 into yt-project:master Apr 15, 2020
@neutrinoceros neutrinoceros deleted the hotfix_amrvac_geom_default branch April 18, 2020 18:06
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