From 42fd6a488e939fea636bd3167a68cb3dc468558a Mon Sep 17 00:00:00 2001 From: AlexisRenchon Date: Fri, 15 Nov 2024 10:22:32 -0800 Subject: [PATCH] longruns global seasonal cycle We currently plot global maps for initial and final time steps (months) of the long runs. In this commit, we add a global seasonal plot. This plot takes the monthly global average of each output variables and plot them as a line, the simulation is one year long so there is 12 data points. --- experiments/long_runs/land.jl | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/experiments/long_runs/land.jl b/experiments/long_runs/land.jl index 8fb0daf610..8e69ef35b7 100644 --- a/experiments/long_runs/land.jl +++ b/experiments/long_runs/land.jl @@ -376,7 +376,12 @@ end function setup_and_solve_problem(; greet = false) t0 = 0.0 - tf = 60 * 60.0 * 24 * 365 + seconds = 1.0 + minutes = 60seconds + hours = 60minutes + days = 24hours + years = 365days + tf = 1years Δt = 450.0 nelements = (101, 15) if greet @@ -410,6 +415,17 @@ mktempdir(root_path) do tmpdir for short_name in short_names var = get(simdir; short_name) times = [ClimaAnalysis.times(var)[1], ClimaAnalysis.times(var)[end]] + kwarg_z = ClimaAnalysis.has_altitude(var) ? Dict(:z => 1) : Dict() # if has altitude, take first layer + var_sliced = ClimaAnalysis.slice(var; kwarg_z...) + var_global_average = + ClimaAnalysis.average_lon(ClimaAnalysis.average_lat(var_sliced)) + fig_seasonal_cycle = CairoMakie.Figure(size = (600, 400)) + ax = Axis(fig_seasonal_cycle[1, 1]) + CairoMakie.lines!(ax, 1:1:12, var_global_average.data) + CairoMakie.save( + joinpath(tmpdir, "$(short_name)_global_monthly.pdf"), + fig_seasonal_cycle, + ) for t in times fig = CairoMakie.Figure(size = (600, 400)) kwargs = ClimaAnalysis.has_altitude(var) ? Dict(:z => 1) : Dict()