Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
… into aj/test_freezing
  • Loading branch information
trontrytel committed Oct 20, 2021
2 parents 9415015 + 43aa515 commit 1a663a0
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 38 deletions.
4 changes: 2 additions & 2 deletions docs/src/PlotReferenceStates.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ tc_dir = dirname(dirname(pathof(TurbulenceConvection)))
include(joinpath(tc_dir, "integration_tests", "utils", "generate_namelist.jl"))
include(joinpath(tc_dir, "integration_tests", "utils", "Cases.jl"))
include(joinpath(tc_dir, "integration_tests", "utils", "parameter_set.jl"))
using .NameList
import .NameList
import .Cases
function export_ref_profile(case_name::String)
TC = TurbulenceConvection
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
param_set = create_parameter_set(namelist)
namelist["meta"]["uuid"] = "01"

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/ARM_SGP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["ARM_SGP"]

@testset "ARM_SGP" begin
case_name = "ARM_SGP"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/Bomex.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["Bomex"]

@testset "Bomex" begin
case_name = "Bomex"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/DYCOMS_RF01.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["DYCOMS_RF01"]

@testset "DYCOMS_RF01" begin
case_name = "DYCOMS_RF01"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/DryBubble.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["DryBubble"]

@testset "DryBubble" begin
case_name = "DryBubble"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/GABLS.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["GABLS"]

@testset "GABLS" begin
case_name = "GABLS"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
2 changes: 1 addition & 1 deletion integration_tests/GATE_III.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using Test
include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
using .NameList
import .NameList

# TODO - waiting for a better root solver
CLIMAParameters.Planet.T_freeze(::EarthParameterSet) = 100.0
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/LES_driven_SCM.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["LES_driven_SCM"]

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/Nieuwstadt.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["Nieuwstadt"]

@testset "Nieuwstadt" begin
case_name = "Nieuwstadt"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/Rico.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["Rico"]

@testset "Rico" begin
case_name = "Rico"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/SP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["SP"]

@testset "SP" begin
case_name = "SP"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/Soares.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["Soares"]

@testset "Soares" begin
case_name = "Soares"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/TRMM_LBA.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

# TODO - waiting for a better root solver
CLIMAParameters.Planet.T_freeze(::EarthParameterSet) = 100.0
Expand All @@ -19,7 +19,7 @@ best_mse = all_best_mse["TRMM_LBA"]
@testset "TRMM_LBA" begin
case_name = "TRMM_LBA"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
4 changes: 2 additions & 2 deletions integration_tests/life_cycle_Tan2018.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ include(joinpath("utils", "main.jl"))
include(joinpath("utils", "generate_namelist.jl"))
include(joinpath("utils", "compute_mse.jl"))
include(joinpath("utils", "mse_tables.jl"))
using .NameList
import .NameList

best_mse = all_best_mse["life_cycle_Tan2018"]

@testset "life_cycle_Tan2018" begin
case_name = "life_cycle_Tan2018"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down
19 changes: 11 additions & 8 deletions integration_tests/utils/compute_mse.jl
Original file line number Diff line number Diff line change
Expand Up @@ -222,15 +222,18 @@ function compute_mse(case_name, best_mse, plot_dir; ds_dict, plot_comparison = t
missing_tcc_var = data_tcc_arr == nothing
missing_scm_var = data_scm_arr == nothing

if TC.is_face_field(tc_var)
coord_name = first(NC.dimnames(data_tcc_arr))
coord_name == "zf" || coord_name == "zc" || error("Bad coord_name")

if coord_name == "zf"
z_tcc = z_tcc_f
else
elseif coord_name == "zc"
z_tcc = z_tcc_c
end
if have_tc_main
if TC.is_face_field(tc_var)
if coord_name == "zf"
z_tcm = z_tcm_f
else
elseif coord_name == "zc"
z_tcm = z_tcm_c
end
else
Expand All @@ -244,28 +247,28 @@ function compute_mse(case_name, best_mse, plot_dir; ds_dict, plot_comparison = t
end

if missing_les_var
@warn "Missing data for variable $tc_var, filling with zeros"
@warn "les missing data for variable $tc_var, filling with zeros"
data_les_arr = zeros(length(z_les), length(time_les))
warn_msg_les = " Warning: missing data"
else
warn_msg_les = ""
end
if missing_tcm_var
@warn "Missing data for variable $tc_var, filling with zeros"
@warn "tcm missing data for variable $tc_var, filling with zeros"
data_tcm_arr = zeros(length(z_tcm), length(time_tcm))
warn_msg_tcm = " Warning: missing data"
else
warn_msg_tcm = ""
end
if missing_tcc_var
@warn "Missing data for variable $tc_var, filling with zeros"
@warn "tcc missing data for variable $tc_var, filling with zeros"
data_tcc_arr = zeros(length(z_tcc), length(time_tcc))
warn_msg_tcc = " Warning: missing data"
else
warn_msg_tcc = ""
end
if missing_scm_var
@warn "Missing data for variable $tc_var, filling with zeros"
@warn "scm missing data for variable $tc_var, filling with zeros"
data_scm_arr = zeros(length(z_scm), length(time_scm))
warn_msg_scm = " Warning: missing data"
else
Expand Down
2 changes: 1 addition & 1 deletion test/perf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using Profile
include(joinpath("integration_tests", "utils", "Cases.jl"))
include(joinpath("integration_tests", "utils", "generate_namelist.jl"))
using .Cases
using .NameList
import .NameList

include(joinpath("integration_tests", "utils", "main.jl"))

Expand Down
2 changes: 1 addition & 1 deletion test/profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ using Profile
include(joinpath("integration_tests", "utils", "Cases.jl"))
include(joinpath("integration_tests", "utils", "generate_namelist.jl"))
using .Cases
using .NameList
import .NameList

include(joinpath("integration_tests", "utils", "main.jl"))

Expand Down
4 changes: 2 additions & 2 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ include(joinpath(tc_dir, "integration_tests", "utils", "main.jl"))
include(joinpath(tc_dir, "integration_tests", "utils", "generate_namelist.jl"))
include(joinpath(tc_dir, "integration_tests", "utils", "compute_mse.jl"))
include(joinpath(tc_dir, "integration_tests", "utils", "mse_tables.jl"))
using .NameList
import .NameList
best_mse = all_best_mse["Bomex"]

@testset "Unit tests" begin
Expand All @@ -21,7 +21,7 @@ end

case_name = "Bomex"
println("Running $case_name...")
namelist = default_namelist(case_name)
namelist = NameList.default_namelist(case_name)
namelist["meta"]["uuid"] = "01"
ds_tc_filename = @time main(namelist)

Expand Down

0 comments on commit 1a663a0

Please sign in to comment.