Skip to content

Commit

Permalink
output debug plots to artifacts dir
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Mar 19, 2024
1 parent 5896f4f commit 75c244f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion experiments/AMIP/coupler_driver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ The data files are downloaded from the `ClimaCoupler` artifacts directory. If th
original sources.
=#

debug_dir = joinpath(COUPLER_ARTIFACTS_DIR, "debug_output/")
debug_dir = COUPLER_ARTIFACTS_DIR
isdir(debug_dir) ? nothing : mkpath(debug_dir)

# get the paths to the necessary data files: land-sea mask, sst map, sea ice concentration
Expand Down
10 changes: 5 additions & 5 deletions experiments/AMIP/user_io/debug_plots.jl
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ using ClimaCore
Plot the fields of a coupled simulation and save plots to a directory.
"""
function debug(cs::CoupledSimulation, dir = "debug", cs_fields_ref = nothing)
mkpath(dir)
@info "plotting debug in " * dir
# mkpath(dir)
# @info "plotting debug in " * dir
for sim in cs.model_sims
debug(sim, dir)
end
Expand Down Expand Up @@ -80,7 +80,7 @@ function debug(cs_fields::NamedTuple, dir, cs_fields_ref = nothing)
end
end
Plots.plot(all_plots..., size = (1500, 800))
Plots.png(joinpath(dir, "debug_coupler"))
Plots.png(dir * "debug_coupler")

# plot anomalies if a reference cs.fields, `cs_fields_ref`, are provided
if !isnothing(cs_fields_ref)
Expand All @@ -99,7 +99,7 @@ function debug(cs_fields::NamedTuple, dir, cs_fields_ref = nothing)
)
end
Plots.plot(all_plots..., size = (1500, 800))
Plots.png(joinpath(dir, "debug_coupler_amomalies"))
Plots.png(dir * "debug_coupler_amomalies")
end
end

Expand Down Expand Up @@ -156,7 +156,7 @@ function debug(sim::ComponentModelSimulation, dir)
push!(all_plots, Plots.plot(cpu_field, title = string(field_name) * print_extrema(field)))
end
fig = Plots.plot(all_plots..., size = (1500, 800))
Plots.png(joinpath(dir, "debug_$(name(sim))"))
Plots.png(dir * "debug_$(name(sim))")

end

Expand Down

0 comments on commit 75c244f

Please sign in to comment.