-
Notifications
You must be signed in to change notification settings - Fork 15
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
Use semeio for parameter parsing, make nesting explicit #102
Conversation
d8e99db
to
a8036aa
Compare
The nesting of parameters dictionary is specific to fmu-dataio. Make it more explicit by putting it in a different function
a8036aa
to
03486e3
Compare
|
||
ptext = "tests/data/drogon/ertrun1/realization-0/iter-0/parameters_justified.txt" | ||
|
||
res = _utils.read_parameters_txt(ptext) | ||
res = _utils.nested_parameters_dict(_utils.read_parameters_txt(ptext)) | ||
|
||
assert res["SENSNAME"] == "rms_seed" | ||
assert res["GLOBVAR"]["VOLON_PERMH_CHANNEL"] == 1100 |
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.
Further up the form is now res["GLOBVAR:VOLON_PERMH_CHANNEL"]
. Put here is res["GLOBVAR"]["VOLON_PERMH_CHANNEL"]
?
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.
Yes, that is what the nested_parameters_dict()
function does, splitting by colons.
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.
LGTM
This PR maybe changes some behaviour of dict ordering, as the previous code used |
There may actually be no need for OrderedDict() when >= python 3.6. cf. https://softwaremaniacs.org/blog/2020/02/05/dicts-ordered/ |
Regardless, I cannot see that dict ordering should be important to preserve, other than for readability. |
The nesting of parameters dictionary is specific to fmu-dataio. Make it more explicit
by putting it in a different function