-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
major check_input_data_list.py refactor and introduction of check_inp…
…ut_data_repo.py
- Loading branch information
1 parent
5a3fe85
commit e70f6e1
Showing
3 changed files
with
178 additions
and
69 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env python | ||
|
||
import yaml | ||
import svn.remote as sr | ||
from check_input_data_list import ( | ||
get_input_files_in_MOM_input, | ||
get_input_data_list_files, | ||
) | ||
|
||
if __name__ == "__main__": | ||
|
||
# Read in the MOM_input.yaml file and extract all input file names | ||
MOM_input_yaml = yaml.safe_load(open("./param_templates/MOM_input.yaml", "r")) | ||
MOM_input_files = get_input_files_in_MOM_input(MOM_input_yaml) | ||
|
||
# Read in the input_data_list.yaml file and extract all input file names | ||
input_data_list_yaml = yaml.safe_load( | ||
open("./param_templates/input_data_list.yaml", "r") | ||
) | ||
input_data_list_files = get_input_data_list_files( | ||
input_data_list_yaml, MOM_input_files | ||
) | ||
|
||
# all mom input file names in svn inputdata repository | ||
r = sr.RemoteClient( | ||
"https://svn-ccsm-inputdata.cgd.ucar.edu/trunk/inputdata/ocn/mom/" | ||
) | ||
repo_files = {f["name"] for relpath, f in r.list_recursive() if f["kind"] == "file"} | ||
|
||
# File names missing in the svn repository | ||
missing_files = ( | ||
set( | ||
filename | ||
for filelist in input_data_list_files.values() | ||
for filename in filelist | ||
) | ||
- repo_files | ||
) | ||
if missing_files: | ||
raise ValueError( | ||
"Below file names are listed in input_data_list.yaml but are missing " | ||
"in the svn inputdata repository. If these files are not needed, " | ||
"please remove them from input_data_list.yaml. If they are needed, " | ||
"please import them to the svn repository.\n\n " | ||
+ "\n ".join(missing_files) | ||
) | ||
else: | ||
print("All files in input_data_list.yaml are present in the svn repository.") |