Skip to content

Commit

Permalink
Merge pull request #985 from PCMDI/979_cloudfeedback_xcdat
Browse files Browse the repository at this point in the history
979 cloudfeedback xcdat
  • Loading branch information
lee1043 committed Oct 22, 2023
2 parents bbbee3e + 2096d44 commit 43c2808
Show file tree
Hide file tree
Showing 14 changed files with 1,722 additions and 63,195 deletions.
15 changes: 4 additions & 11 deletions pcmdi_metrics/cloud_feedback/cloud_feedback_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
version = param.version
input_files_json = param.input_files_json
path = param.path
xml_path = param.xml_path
data_path = param.data_path
figure_path = param.figure_path
output_path = param.output_path
Expand All @@ -45,7 +44,6 @@
print("version:", version)
print("path:", path)
print("input_files_json:", input_files_json)
print("xml_path:", xml_path)
print("figure_path:", figure_path)
print("output_path:", output_path)
print("output_json_filename:", output_json_filename)
Expand All @@ -57,9 +55,6 @@
else:
exps = ["amip", "amip-p4K"]

# generate xmls pointing to the cmorized netcdf files
os.makedirs(xml_path, exist_ok=True)

filenames = dict()

if input_files_json is not None:
Expand Down Expand Up @@ -108,9 +103,7 @@
searchstring = os.path.join(
ncfiles[exp][field]["path"], ncfiles[exp][field]["file"]
)
xmlname = os.path.join(xml_path, ".".join([exp, model, variant, field, "xml"]))
os.system("cdscan -x " + xmlname + " " + searchstring)
filenames[exp][field] = xmlname
filenames[exp][field] = searchstring

if debug:
with open(os.path.join(output_path, "filenames.json"), "w") as f:
Expand All @@ -123,17 +116,17 @@

# add this model's results to the pre-existing json file containing other models' results:
updated_fbk_dict, updated_obsc_fbk_dict = organize_fbk_jsons(
fbk_dict, obsc_fbk_dict, model, variant, datadir=data_path
fbk_dict, obsc_fbk_dict, model, variant
)
updated_err_dict = organize_err_jsons(err_dict, model, variant, datadir=data_path)
updated_err_dict = organize_err_jsons(err_dict, model, variant)

ecs = None
if get_ecs:
# calculate ECS and add it to the pre-existing json file containing other models' results:
ecs = compute_ECS(filenames)
print("calc ECS done")
print("ecs: ", ecs)
updated_ecs_dict = organize_ecs_jsons(ecs, model, variant, datadir=data_path)
updated_ecs_dict = organize_ecs_jsons(ecs, model, variant)

os.makedirs(output_path, exist_ok=True)
if debug:
Expand Down

0 comments on commit 43c2808

Please sign in to comment.