Skip to content

Commit

Permalink
Allow dt_rad not in hours
Browse files Browse the repository at this point in the history
If dt_rad contains no units, this commit assumes it is in hours.
Otherwise, it calls ClimaCoupler.Utilities.time_to_seconds, and converts
the output to hours.
  • Loading branch information
imreddyTeja committed Dec 13, 2024
1 parent 5318c3b commit 8bceffa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion experiments/ClimaEarth/run_amip.jl
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,9 @@ update_firstdayofmonth!_cb = TimeManager.MonthlyCallback(
ref_date = [dates.date1[1]],
active = true,
)
dt_water_albedo = parse(FT, filter(x -> !occursin(x, "hours"), dt_rad))
# if no units specified, assume hours. Otherwise parse and read to seconds, and convert to hours
dt_water_albedo =
isnothing(tryparse(FT, dt_rad)) ? FT(Utilities.time_to_seconds(dt_rad) / (60 * 60)) : parse(FT, dt_rad)
albedo_cb = TimeManager.HourlyCallback(
dt = dt_water_albedo,
func = FluxCalculator.water_albedo_from_atmosphere!,
Expand Down
4 changes: 3 additions & 1 deletion experiments/ClimaEarth/run_cloudless_aquaplanet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ update_firstdayofmonth!_cb = TimeManager.MonthlyCallback(
ref_date = [dates.date1[1]],
active = true,
)
dt_water_albedo = parse(FT, filter(x -> !occursin(x, "hours"), dt_rad))
# if no units specified, assume hours. Otherwise parse and read to seconds, and convert to hours
dt_water_albedo =
isnothing(tryparse(FT, dt_rad)) ? FT(Utilities.time_to_seconds(dt_rad) / (60 * 60)) : parse(FT, dt_rad)
albedo_cb = TimeManager.HourlyCallback(
dt = dt_water_albedo,
func = FluxCalculator.water_albedo_from_atmosphere!,
Expand Down
4 changes: 3 additions & 1 deletion experiments/ClimaEarth/run_cloudy_slabplanet.jl
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,9 @@ update_firstdayofmonth!_cb = TimeManager.MonthlyCallback(
ref_date = [dates.date1[1]],
active = true,
)
dt_water_albedo = parse(FT, filter(x -> !occursin(x, "hours"), dt_rad))
# if no units specified, assume hours. Otherwise parse and read to seconds, and convert to hours
dt_water_albedo =
isnothing(tryparse(FT, dt_rad)) ? FT(Utilities.time_to_seconds(dt_rad) / (60 * 60)) : parse(FT, dt_rad)
albedo_cb = TimeManager.HourlyCallback(
dt = dt_water_albedo,
func = FluxCalculator.water_albedo_from_atmosphere!,
Expand Down

0 comments on commit 8bceffa

Please sign in to comment.