Make .recalculate_xyz() optional, fix grid name parsing#145
Open
mikekryjak wants to merge 2 commits intomasterfrom
Open
Make .recalculate_xyz() optional, fix grid name parsing#145mikekryjak wants to merge 2 commits intomasterfrom
mikekryjak wants to merge 2 commits intomasterfrom
Conversation
If passed with quotation marks, these are stripped in BOUT++ but not here, causing issues on load
This is rarely needed, but requires either grid size data or the grid file, making it expensive and cause warnings if neither are available.
Contributor
Author
|
Peter: change so that if you don't have a grid, and don't have nx/ny, then this doesn't do anything. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
BoutOptionsFilehas a method called.recalculate_xyzwhich is for evaluating input file expressions. It needs the coordinates, which it infers from the input file if nx/ny/nz are specified, or from the grid file if it's provided. In my use case, I never specify nx/ny/nz in the input file, and I don't supply a grid file when I just want to read a single setting. This causes a warning that recalculate_xyz didn't work.I would honestly prefer that recalculate_xyz was not even done at the init stage, unless someone actually uses it actively? It seems like a more niche use case than just reading input settings which is very common....
This PR makes the method call optional, but
Trueby default. But I would prefer to just get rid of it and make users call it separately if needed.I also found a grid name parsing issue:
boutdata/src/boutdata/data.py
Lines 745 to 747 in 11f5d0a
If the user leaves quotation marks around the grid name, then BOUT++ will parse them out, but BoutOptionsFile will not, causing an error on reading. this PR strips the quotes.