@@ -2,7 +2,7 @@ import ClimaAnalysis
22import ClimaUtilities. ClimaArtifacts: @clima_artifact
33
44# Tuple of short names for loading simulation and observational data
5- sim_obs_short_names_no_pr = [
5+ sim_obs_short_names_rad = [
66 (" rsdt" , " solar_mon" ),
77 (" rsut" , " toa_sw_all_mon" ),
88 (" rlut" , " toa_lw_all_mon" ),
@@ -17,6 +17,8 @@ sim_obs_short_names_no_pr = [
1717 (" rldscs" , " sfc_lw_down_clr_t_mon" ),
1818]
1919
20+ sim_obs_short_names_sf = [(" hfss" , " msshf" ), (" hfls" , " mslhf" )]
21+
2022"""
2123 get_compare_vars_biases_groups()
2224
@@ -29,6 +31,7 @@ function get_compare_vars_biases_groups()
2931 [" pr" , " rsdt" , " rsut" , " rlut" ],
3032 [" rsds" , " rsus" , " rlds" , " rlus" ],
3133 [" rsutcs" , " rlutcs" , " rsdscs" , " rsuscs" , " rldscs" ],
34+ [" hfss" , " hfls" ],
3235 ]
3336 return compare_vars_biases_groups
3437end
@@ -59,6 +62,8 @@ function get_compare_vars_biases_plot_extrema()
5962 " rsdscs" => (- 10.0 , 10.0 ),
6063 " rsuscs" => (- 10.0 , 10.0 ),
6164 " rldscs" => (- 20.0 , 20.0 ),
65+ " hfss" => (- 50.0 , 50.0 ),
66+ " hfls" => (- 50.0 , 50.0 ),
6267 )
6368 return compare_vars_biases_plot_extrema
6469end
@@ -79,8 +84,9 @@ The variable should have only three dimensions: latitude, longitude, and time.
7984"""
8085function get_sim_var_dict (diagnostics_folder_path)
8186 available_short_names = get_short_names_monthly_averages (diagnostics_folder_path)
82- sim_var_dict = Dict {String, Any} ()
8387 # Dict for loading in simulation data
88+ sim_var_dict = Dict {String, Any} ()
89+ # Add "pr" and the necessary preprocessing
8490 " pr" in available_short_names && (
8591 sim_var_dict[" pr" ] =
8692 () -> begin
@@ -100,8 +106,7 @@ function get_sim_var_dict(diagnostics_folder_path)
100106 end
101107 )
102108
103- # Add "pr" and the necessary preprocessing
104- for (short_name, _) in sim_obs_short_names_no_pr
109+ for (short_name, _) in vcat (sim_obs_short_names_rad, sim_obs_short_names_sf)
105110 short_name in available_short_names && (
106111 sim_var_dict[short_name] =
107112 () -> begin
@@ -137,22 +142,44 @@ dates.
137142The variable should have only three dimensions: latitude, longitude, and time.
138143"""
139144function get_obs_var_dict ()
140- # Add "pr" and the necessary preprocessing
141- obs_var_dict = Dict {String, Any} (
142- " pr" =>
145+ obs_var_dict = Dict {String, Any} ()
146+ obs_var_dict[" pr" ] =
147+ (start_date) -> begin
148+ obs_var = ClimaAnalysis. OutputVar (
149+ joinpath (@clima_artifact (" precipitation_obs" ), " precip.mon.mean.nc" ),
150+ " precip" ,
151+ new_start_date = start_date,
152+ shift_by = Dates. firstdayofmonth,
153+ )
154+ return obs_var
155+ end
156+
157+ for (sim_name, obs_name) in sim_obs_short_names_sf
158+ obs_var_dict[sim_name] =
143159 (start_date) -> begin
144160 obs_var = ClimaAnalysis. OutputVar (
145- joinpath (@clima_artifact (" precipitation_obs" ), " precip.mon.mean.nc" ),
146- " precip" ,
161+ joinpath (
162+ @clima_artifact (
163+ " era5_monthly_averages_surface_single_level_1979_2024"
164+ ),
165+ " era5_monthly_averages_surface_single_level_197901-202410.nc" ,
166+ ),
167+ obs_name,
147168 new_start_date = start_date,
148169 shift_by = Dates. firstdayofmonth,
149170 )
171+ (ClimaAnalysis. units (obs_var) == " W m**-2" ) && (
172+ obs_var = ClimaAnalysis. convert_units (
173+ obs_var,
174+ " W m^-2" ,
175+ conversion_function = units -> units * - 1.0 ,
176+ )
177+ )
150178 return obs_var
151- end ,
152- )
179+ end
180+ end
153181
154- # Loop to load the rest of the observational data and the necessary preprocessing
155- for (sim_name, obs_name) in sim_obs_short_names_no_pr
182+ for (sim_name, obs_name) in sim_obs_short_names_rad
156183 obs_var_dict[sim_name] =
157184 (start_date) -> begin
158185 obs_var = ClimaAnalysis. OutputVar (
0 commit comments