Skip to content

Commit e8f87bc

Browse files
committed
Replace NaNs with global mean
1 parent 818afc1 commit e8f87bc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

experiments/calibration/coarse_amip/observation_map.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,13 @@ function preprocess_monthly_averages(simdir, name)
9191
monthly_avgs = ClimaAnalysis.Atmos.to_pressure_coordinates(monthly_avgs, pressure)
9292
monthly_avgs = limit_pressure_dim_to_era5_range(monthly_avgs)
9393
end
94-
# TODO: Replace NaNs with global mean
95-
monthly_avgs = ClimaAnalysis.replace(monthly_avgs, NaN => 0.0)
94+
# Line up dates for monthly averages
9695
monthly_avgs = ClimaAnalysis.shift_to_start_of_previous_month(monthly_avgs)
9796
# Remove spinup time
9897
monthly_avgs = window(monthly_avgs, "time"; left = spinup_time)
98+
global_mean = monthly_avgs |> average_lat |> average_lon |> average_time
99+
# Replace NaNs with global mean
100+
monthly_avgs = ClimaAnalysis.replace(monthly_avgs, NaN => global_mean)
99101
return monthly_avgs
100102
end
101103

0 commit comments

Comments
 (0)