Skip to content

Commit

Permalink
Fix erroneous file_type handling in certain NCL diagnostics (#3474)
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Zimmermann authored Dec 14, 2023
1 parent b3e73c9 commit 4cbb246
Show file tree
Hide file tree
Showing 22 changed files with 22 additions and 185 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
12 changes: 2 additions & 10 deletions esmvaltool/diag_scripts/ipcc_ar5/ch12_plot_ts_line_mean_spread.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ end


begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down Expand Up @@ -251,11 +244,10 @@ begin
draw(wks)
frame(wks)

log_info(" Wrote " + plot_dir + "/" + outfile + "." + file_type)
log_info(" Wrote " + wks@fullname)

; collect meta-data
nc_file = datapath
plot_file = plot_dir + "/" + outfile + "." + file_type

if (isatt(diag_script_info, "spread")) then
spread_str = diag_script_info@spread
Expand All @@ -279,7 +271,7 @@ begin
authors = (/"lorenz_ruth"/)
references = (/"collins13ipcc"/)
infiles = metadata_att_as_array(info_items, "filename")
log_provenance(nc_file, plot_file, caption, statistics, domains, \
log_provenance(nc_file, wks@fullname, caption, statistics, domains, \
plot_types, authors, references, infiles)

leave_msg(DIAG_SCRIPT, "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if
; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
7 changes: 0 additions & 7 deletions esmvaltool/diag_scripts/ipcc_ar5/ch12_ts_line_mean_spread.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
7 changes: 0 additions & 7 deletions esmvaltool/diag_scripts/tebaldi21esd/calc_table_changes.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
7 changes: 0 additions & 7 deletions esmvaltool/diag_scripts/tebaldi21esd/plot_pattern.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down
12 changes: 2 additions & 10 deletions esmvaltool/diag_scripts/tebaldi21esd/plot_table_changes.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down Expand Up @@ -159,13 +152,12 @@ begin
gsn_table(wks, ncr4, x4, y4, text4, res4)
draw(wks)
frame(wks)
log_info(" Wrote " + plot_dir + "/" + outfile + "." + file_type)
log_info(" Wrote " + wks@fullname)

; Collect meta-data
netcdf_dir = diag_script_info@input_files(1)
datapath = netcdf_dir + "/" + variable_info[0]@diagnostic + ".nc"
nc_file = datapath
plot_file = plot_dir + "/" + outfile + "." + file_type
caption = "Table of global annual mean" + \
variable_info[0]@long_name + " anomalies (relative to " + \
diag_script_info@begin_ref_year + "-" + diag_script_info@end_ref_year + \
Expand All @@ -177,7 +169,7 @@ begin
authors = (/"debeire_kevin"/)
references = (/"tebaldi21esd"/)
infiles = metadata_att_as_array(info_items, "filename")
log_provenance(nc_file, plot_file, caption, statistics, domains, \
log_provenance(nc_file, wks@fullname, caption, statistics, domains, \
plot_types, authors, references, infiles)
leave_msg(DIAG_SCRIPT, "")
end
12 changes: 2 additions & 10 deletions esmvaltool/diag_scripts/tebaldi21esd/plot_table_warming_level.ncl
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ begin
end

begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down Expand Up @@ -160,21 +153,20 @@ begin
gsn_table(wks, ncr4, x4, y4, text4, res4)
draw(wks)
frame(wks)
log_info(" Wrote " + plot_dir + "/" + outfile + "." + file_type)
log_info(" Wrote " + wks@fullname)

; Collect meta-data
netcdf_dir = diag_script_info@input_files(1)
datapath = netcdf_dir + "/" + variable_info[0]@diagnostic + ".nc"
nc_file = datapath
plot_file = plot_dir + "/" + outfile + "." + file_type
caption = text4
statistics = ("mean")
domains = ("global")
plot_types = ("portrait")
authors = (/"debeire_kevin"/)
references = (/"tebaldi21esd"/)
infiles = metadata_att_as_array(info_items, "filename")
log_provenance(nc_file, plot_file, caption, statistics, domains, \
log_provenance(nc_file, wks@fullname, caption, statistics, domains, \
plot_types, authors, references, infiles)
leave_msg(DIAG_SCRIPT, "")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,6 @@ end


begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down Expand Up @@ -108,9 +101,9 @@ begin
; *********** PLOTTING ************
; Create plot variables
outfile = var0 + "_ts_line_" + syears(0) + "_" + eyears(nperiods - 1)
wks_type = file_type
wks_type = 0
wks_type@wkPaperSize = "A4"
wks = gsn_open_wks(wks_type, plot_dir + outfile)
wks = get_wks(wks_type, DIAG_SCRIPT, outfile)
if(isatt(diag_script_info, "colormap")) then
colormap = RGBtoCmap(diag_script_info@colormap)
else
Expand Down Expand Up @@ -229,18 +222,17 @@ begin
draw(wks)
frame(wks)

log_info(" Wrote " + plot_dir + "/" + outfile + "." + file_type)
log_info(" Wrote " + wks@fullname)

; collect meta-data
nc_file = datapath
plot_file = plot_dir + "/" + outfile + "." + file_type
statistics = ("stddev")
domains = ("global")
plot_types = ("times")
authors = (/"debeire_kevin"/)
references = (/"tebaldi21esd"/)
infiles = metadata_att_as_array(info_items, "filename")
log_provenance(nc_file, plot_file, caption, statistics, domains, \
log_provenance(nc_file, wks@fullname, caption, statistics, domains, \
plot_types, authors, references, infiles)

leave_msg(DIAG_SCRIPT, "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ end


begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down Expand Up @@ -265,11 +258,10 @@ begin
draw(wks)
frame(wks)

log_info(" Wrote " + plot_dir + "/" + outfile + "." + file_type)
log_info(" Wrote " + wks@fullname)

; collect meta-data
nc_file = datapath
plot_file = plot_dir + "/" + outfile + "." + file_type

if (isatt(diag_script_info, "spread")) then
spread_str = diag_script_info@spread
Expand All @@ -282,7 +274,7 @@ begin
authors = (/"debeire_kevin"/)
references = (/"tebaldi21esd"/)
infiles = metadata_att_as_array(info_items, "filename")
log_provenance(nc_file, plot_file, caption, statistics, domains, \
log_provenance(nc_file, wks@fullname, caption, statistics, domains, \
plot_types, authors, references, infiles)

leave_msg(DIAG_SCRIPT, "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,6 @@ end


begin
; Get environment variables
if (isatt(diag_script_info, "plot_type")) then
file_type = diag_script_info@plot_type
else
file_type = "pdf"
end if

; Output netcdf directory
work_dir = config_user_info@work_dir
system("mkdir -p " + work_dir)
Expand Down Expand Up @@ -261,11 +254,10 @@ begin
draw(wks)
frame(wks)

log_info(" Wrote " + plot_dir + "/" + outfile + "." + file_type)
log_info(" Wrote " + wks@fullname)

; collect meta-data
nc_file = datapath
plot_file = plot_dir + "/" + outfile + "." + file_type

if (isatt(diag_script_info, "spread")) then
spread_str = diag_script_info@spread
Expand All @@ -278,7 +270,7 @@ begin
authors = (/"debeire_kevin"/)
references = (/"tebaldi21esd"/)
infiles = metadata_att_as_array(info_items, "filename")
log_provenance(nc_file, plot_file, caption, statistics, domains, \
log_provenance(nc_file, wks@fullname, caption, statistics, domains, \
plot_types, authors, references, infiles)

leave_msg(DIAG_SCRIPT, "")
Expand Down
Loading

0 comments on commit 4cbb246

Please sign in to comment.