-
Notifications
You must be signed in to change notification settings - Fork 48
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
Main input Class #352
Main input Class #352
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great @feathern !
Just one possible fix in the code and one comment.
One other quick thought... Since dictionaries aren't ordered is there a risk here of making main_input files hard to diff if the output order changes. Would it be worth considering using OrderedDicts instead? On the namelist level this could also be achieved by keeping the order of the namelists fixed from the time of input but this is currently overridden when a new option is force set.
" mi.vals['problemsize']['n_theta'] = ra_res_ntheta[i]\n", | ||
" mi.vals['reference']['rayleigh_number'] = ra\n", | ||
" mi.vals['reference']['ekman_number'] = ek\n", | ||
"\n", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you mean to call:
mi.write(file=input_file)
in this loop?
nml_line="&"+nml+"_namelist"+endl | ||
lprint(nml_line) | ||
|
||
for var in self.vals[nml].keys(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could save a marginal amount of effort here by iterating using:
for val, var in self.vals[nml].items():
Added missing write statement to end of main_input_demo notebook.
Thanks Cian, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great!
This commit adds a main_input class to rayleigh_diagnostics.py. I have found this useful when designing parameter space sweeps. A notebook describing how to use the class has been included in this commit.