Skip to content

Commit

Permalink
Fix ITime issue with saveat
Browse files Browse the repository at this point in the history
  • Loading branch information
ph-kev committed Feb 26, 2025
1 parent 9839b78 commit a63b59e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions experiments/ClimaEarth/user_io/arg_parsing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,24 @@ function get_coupler_args(config_dict::Dict)
date0 = date = Dates.DateTime(config_dict["start_date"], Dates.dateformat"yyyymmdd")
Δt_cpl = Float64(Utilities.time_to_seconds(config_dict["dt_cpl"]))
saveat = Float64(Utilities.time_to_seconds(config_dict["dt_save_to_sol"]))
saveat = promote(t_start:saveat:t_end..., t_end)
if use_itime
t_end = ITime(t_end, epoch = date0)
t_start = ITime(t_start, epoch = date0)
Δt_cpl = ITime(Δt_cpl, epoch = date0)
times = promote(t_end, t_start, Δt_cpl, ITime.(values(config_dict["component_dt_dict"]))...)
t_end, t_start, Δt_cpl = (times[1], times[2], times[3])
saveat = ITime(Float64(Utilities.time_to_seconds(config_dict["dt_save_to_sol"])))
saveat = [promote([t_start:saveat:t_end..., t_end]...)...]
component_dt_dict =
Dict(component => first(promote(ITime(dt), t_end)) for (component, dt) in config_dict["component_dt_dict"])
else
component_dt_dict = config_dict["component_dt_dict"]
end
if saveat != Inf
use_itime && (saveat = ITime(saveat))
saveat = [promote([t_start:saveat:t_end..., t_end]...)...]
else
saveat = typeof(t_start)[]
end

# Checkpointing information
checkpoint_dt = config_dict["checkpoint_dt"]

Expand Down

0 comments on commit a63b59e

Please sign in to comment.