-
Notifications
You must be signed in to change notification settings - Fork 312
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
add ability to specify namelist requirements via xml #26
Comments
Bill Sacks < sacks@ucar.edu > - 2016-09-21 15:02:58 -0600 Mariana is working on a cime feature that accomplishes most or all of what we wanted here: You can add an element in namelist_definition like this: <unmodifiable_via_user_nl>ERROR TEXT</unmodifiable_via_user_nl> Then if the given variable appears in the user_nl file, build_namelist will die with an error (printing the given ERROR TEXT). This relies on the python version of the namelist utilities - so we'll be able to use it in CLM once CLM's build namelist is rewritten in python. If I understand the original comment correctly, this mechanism wouldn't handle case (3) - which I think is dealing with the possibility that a given variable might be modifiable via the user_nl file in some circumstances but not in others. But I don't know how many (if any) cases we have of this... if it turns out we have a lot, I imagine we could extend the new code somehow to handle that case. |
One thing we do a lot is have error-checking code saying something like "foo should only be specified if bar = X", or maybe "having foo = Y is only possible if bar = X". I could imagine encoding this in the xml if we allow arbitrary python code in the xml. For example, we could have elements like <can_only_be_specified_if> (in the above case, that would have the value "bar == X") and/or <value_requirements> (off-hand, I'm not sure what the python code would look like for that, but I imagine we could come up with something). |
For this to work, together with the more data-driven capabilities that I think are possible in python - where we don't need explicit add_default calls: I think we'd need a way to specify that one namelist group be handled before another. For example, we could put the high-level control logic (selecting which parameterizations we use, etc.) in the main clm_inparm. Then we'd want to ensure that is dealt with first, before trying to do any error checking on namelist variables in other groups (for example: nothing should be specified in user_nl_clm from group 'foo', unless variable 'bar' in clm_inparm has value 'baz'). |
I needed to move it out of SnowHydrologyMod because it will now be used in SnowCoverFractionMod. I thought about reading it in in the factory method in SnowCoverFractionMod, but I prefer having this (and other similar control flags that we might need in the future) in clm_varctl for a few reasons: - It avoids introducing a whole new namelist group and a new namelist read routine just to hold and read this one variable - It makes the interface of the factory method more clear, in that we'll pass in the method directly - I like the idea of having these big controls (determining relatively big parameterizations) all be in one namelist group for the sake of build-namelist: we can ensure that we read this namelist group first, then do some other logic based on things set there (see also ESCOMP#26 (comment))
Making modifications for double precision time bounds in cice history…
updated README.md with information on two latest releases
This is something that can likely happen now with ParamGen which is in cime now, and has a syntax that should work for these type of things. |
This goes in the context of #585 |
Bill Sacks < sacks@ucar.edu > - 2014-06-06 15:27:44 -0600
Bugzilla Id: 1989
Bugzilla CC: andre@ucar.edu, muszala@ucar.edu, mvertens@ucar.edu, rfisher@ucar.edu,
Erik and I were talking about how it would be nice to be able to specify namelist requirements via an xml file, in order to simplify the error-checking that we currently do in build_namelist.
We could see three possible ways to do this:
(1) Specify requirements (somehow) in the namelist definition xml file
(2) Have a file similar to namelist_defaults, but giving requirements rather than defaults
(3) If a lot of our error-checking is along the lines of:
If variable X=xxx, then variable Y should be yyy, which is its default value
e.g., rather than
yyy
instead, have:
yyy
If the unmodifiable attribute is set, that means that, not only is this its default value, but also it cannot be modified from this value by the user.
This could possibly be implemented in the add_default call.
The text was updated successfully, but these errors were encountered: