Skip to content

Commit

Permalink
use CD average
Browse files Browse the repository at this point in the history
  • Loading branch information
juliasloan25 committed Sep 24, 2024
1 parent 7714ff2 commit bab0db5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions experiments/ClimaEarth/user_io/amip_diagnostics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ function amip_diagnostics_setup(fields, artifacts_dir, start_date, t)
schedule_everystep = CD.Schedules.EveryStepSchedule()
schedule_12hour = CD.Schedules.EveryCalendarDtSchedule(Dates.Hour(12), start_date = start_date)
netcdf_writer = CD.Writers.NetCDFWriter(axes(fields.F_turb_energy), artifacts_dir)
average = (x) -> sum(x) / length(x)

# Create the diagnostic for turbulent energy fluxes
F_turb_energy_diag = CD.DiagnosticVariable(;
Expand All @@ -40,11 +39,12 @@ function amip_diagnostics_setup(fields, artifacts_dir, start_date, t)
F_turb_energy_diag_sched = CD.ScheduledDiagnostic(
variable = F_turb_energy_diag,
output_writer = netcdf_writer,
reduction_time_func = average,
reduction_time_func = (+),
compute_schedule_func = schedule_everystep,
output_schedule_func = schedule_12hour,
output_short_name = "F_turb_energy_12hourly",
output_long_name = "Turbulent energy fluxes calculated in the coupler, averaged every 12 hours of simulation",
pre_output_hook! = CD.average_pre_output_hook!,
)

# Create the diagnostics handler containing the scheduled diagnostics
Expand Down

0 comments on commit bab0db5

Please sign in to comment.