-
Notifications
You must be signed in to change notification settings - Fork 42
Code fix to driver.py #380
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
base: develop
Are you sure you want to change the base?
Conversation
|
Can you upload an example of how users would do this with their yaml file since it is different from what is typically done? Not sure if this is useful, but we had been linking files like the scripts here for more complex workflows too. https://github.com/NCAR/MELODIES-MONET/blob/main/examples/submit_jobs/link_files_wrf.sh |
|
Hi. An example of the YAML file can be seen here, under models: https://github.com/noribeth-m/pair_tempo/blob/main/yaml/control_tempo_l2_no2_cesm_fv_20240701.yaml When I added this change to my code base initially, it was because I was getting a TypeError as "TypeError: expected str, bytes or os.PathLike object, not list", when I tried to input a list to the MELODIES-MONET YAML file, whether in brackets or as is in the linked YAML file. I was specifically testing a way to pair TEMPO data with model output in a quicker way and needed to have the previous and current day as a list for the model: https://github.com/noribeth-m/pair_tempo |
| _, extension = os.path.splitext(self.file_str) | ||
| if extension.lower() == '.txt': | ||
| with open(self.file_str,'r') as f: | ||
| self.files = f.read().split() |
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.
Is this as a guard to avoid trying to .split() lists? In that case, should we be able to split list elements, or is that overkill?
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.
No, this snippet is meant to generate a list of strings from a text file, if that is what's provided. It would split the content of the text file by whitespaces.
Co-authored-by: Pablo Lichtig <[email protected]>
|
Is there anything missing? I think this could be merged into develop. @noribeth-m, can you change the target branch? We should not merge this into main until the next develop to main is done. |
|
@blychs I just changed the target branch to develop. I don't think there is anything else missing. |
|
This needs approval by someone with write access. @rschwant, since you were the one looking at this before, what do you think? |
I added in a code fix to driver.py to be able to read in a list of multiple sorted model output files from the YAML file.
Essentially, when reading the files from the YAML file, there are four different scenarios:
The last code change reads the list of model files given and prepares them for use in MELODIES-MONET.