Skip to content
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

979 cloudfeedback xcdat #985

Merged
merged 6 commits into from
Oct 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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