Skip to content

Commit 2b50dbb

Browse files
committed
Add standard name metadata to most EAMxx output variables
This commit brings EAMxx into CF-Compliance by adding `standard_name` metadata for a subset of the EAMxx output variables that have one.
1 parent 0af3b66 commit 2b50dbb

File tree

3 files changed

+91
-3
lines changed

3 files changed

+91
-3
lines changed

components/eamxx/src/share/io/scorpio_output.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1044,9 +1044,15 @@ register_variables(const std::string& filename,
10441044

10451045
// Gather longname (if not already in the io: string attributes)
10461046
if (str_atts.count("long_name")==0) {
1047-
auto longname = m_longnames.get_longname(name);
1047+
auto longname = m_default_metadata.get_longname(name);
10481048
scorpio::set_attribute(filename, name, "long_name", longname);
10491049
}
1050+
1051+
// Gather standard name, CF-Compliant (if not already in the io: string attributes)
1052+
if (str_atts.count("standard_name")==0) {
1053+
auto standardname = m_default_metadata.get_standardname(name);
1054+
scorpio::set_attribute(filename, name, "standard_name", standardname);
1055+
}
10501056
}
10511057
}
10521058
// Now register the average count variables

components/eamxx/src/share/io/scorpio_output.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class AtmosphereOutput
206206
std::map<std::string,std::shared_ptr<atm_diag_type>> m_diagnostics;
207207
std::map<std::string,std::vector<std::string>> m_diag_depends_on_diags;
208208
std::map<std::string,bool> m_diag_computed;
209-
LongNames m_longnames;
209+
DefaultMetadata m_default_metadata;
210210

211211
// Use float, so that if output fp_precision=float, this is a representable value.
212212
// Otherwise, you would get an error from Netcdf, like

components/eamxx/src/share/io/scream_io_utils.hpp

Lines changed: 83 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ std::string find_filename_in_rpointer (
7272
const OutputAvgType avg_type = OutputAvgType::Instant,
7373
const IOControl& control = {});
7474

75-
struct LongNames {
75+
struct DefaultMetadata {
7676

7777
std::string get_longname (const std::string& name) {
7878
if (name_2_longname.count(name)>0) {
@@ -83,6 +83,15 @@ struct LongNames {
8383
}
8484
}
8585

86+
std::string get_standardname (const std::string& name) {
87+
if (name_2_standardname.count(name)>0) {
88+
return name_2_standardname.at(name);
89+
} else {
90+
// TODO: Do we want to print a Warning message? I'm not sure if its needed.
91+
return name;
92+
}
93+
}
94+
8695
// Create map of longnames, can be added to as developers see fit.
8796
std::map<std::string,std::string> name_2_longname = {
8897
{"lev","hybrid level at midpoints (1000*(A+B))"},
@@ -92,6 +101,79 @@ struct LongNames {
92101
{"hyam","hybrid A coefficient at layer midpoints"},
93102
{"hybm","hybrid B coefficient at layer midpoints"}
94103
};
104+
105+
// Create map of longnames, can be added to as developers see fit.
106+
std::map<std::string,std::string> name_2_standardname = {
107+
{"p_mid" , "air_pressure"},
108+
{"p_mid_at_cldtop" , "air_pressure_at_cloud_top"},
109+
{"T_2m" , "air_temperature"},
110+
{"T_mid" , "air_temperature"},
111+
{"T_mid_at_cldtop" , "air_temperature_at_cloud_top"},
112+
{"aero_g_sw" , "asymmetry_factor_of_ambient_aerosol_particles"},
113+
{"pbl_height" , "atmosphere_boundary_layer_thickness"},
114+
{"precip_liq_surf_mass" , "atmosphere_mass_content_of_liquid_precipitation"},
115+
{"cldlow" , "cloud_area_fraction"},
116+
{"cldmed" , "cloud_area_fraction"},
117+
{"cldhgh" , "cloud_area_fraction"},
118+
{"cldtot" , "cloud_area_fraction"},
119+
{"cldfrac_tot_at_cldtop" , "cloud_area_fraction"},
120+
{"cldfrac_tot" , "cloud_area_fraction_in_atmosphere_layer"},
121+
{"cldfrac_tot_for_analysis" , "cloud_area_fraction_in_atmosphere_layer"},
122+
{"cldfrac_rad" , "cloud_area_fraction_in_atmosphere_layer"},
123+
{"qi" , "cloud_ice_mixing_ratio"},
124+
{"qc" , "cloud_liquid_water_mixing_ratio"},
125+
{"U" , "eastward_wind"},
126+
{"eff_radius_qi" , "effective_radius_of_cloud_ice_particles"},
127+
{"eff_radius_qc" , "effective_radius_of_cloud_liquid_water_particles"},
128+
{"eff_radius_qc_at_cldtop" , "effective_radius_of_cloud_liquid_water_particles_at_liquid_water_cloud_top"},
129+
{"eff_radius_qr" , "effective_radius_of_cloud_rain_particles"},
130+
{"qv" , "humidity_mixing_ratio"},
131+
{"cldfrac_ice_at_cldtop" , "ice_cloud_area_fraction"},
132+
{"cldfrac_ice" , "ice_cloud_area_fraction_in_atmosphere_layer"},
133+
{"omega" , "lagrangian_tendency_of_air_pressure"},
134+
{"landfrac" , "land_area_fraction"},
135+
{"latitude" , "latitude"},
136+
{"cldfrac_liq_at_cldtop" , "liquid_water_cloud_area_fraction"},
137+
{"cldfrac_liq" , "liquid_water_cloud_area_fraction_in_atmosphere_layer"},
138+
{"longitude" , "longitude"},
139+
{"rainfrac" , "mass_fraction_of_liquid_precipitation_in_air"},
140+
{"V" , "northward_wind"},
141+
{"nc" , "number_concentration_of_cloud_liquid_water_particles_in_air"},
142+
{"cdnc_at_cldtop" , "number_concentration_of_cloud_liquid_water_particles_in_air_at_liquid_water_cloud_top"},
143+
{"ni" , "number_concentration_of_ice_crystals_in_air"},
144+
{"aero_tau_sw" , "optical_thickness_of_atmosphere_layer_due_to_ambient_aerosol_particles"},
145+
{"aero_tau_lw" , "optical_thickness_of_atmosphere_layer_due_to_ambient_aerosol_particles"},
146+
{"aero_ssa_sw" , "single_scattering_albedo_in_air_due_to_ambient_aerosol_particles"},
147+
{"sunlit" , "sunlit_binary_mask"},
148+
{"ps" , "surface_air_pressure"},
149+
{"LW_flux_dn_at_model_bot" , "surface_downwelling_longwave_flux_in_air"},
150+
{"SW_flux_dn_at_model_bot" , "surface_downwelling_shortwave_flux_in_air"},
151+
{"SW_clrsky_flux_dn_at_model_bot" , "surface_downwelling_shortwave_flux_in_air_assuming_clear_sky"},
152+
{"phis" , "surface_geopotential"},
153+
{"surf_radiative_T" , "surface_temperature"},
154+
{"surf_sens_flux" , "surface_upward_sensible_heat_flux"},
155+
{"SW_flux_dn_at_model_top" , "toa_incoming_shortwave_flux"},
156+
{"LW_flux_up_at_model_top" , "toa_outgoing_longwave_flux"},
157+
{"LW_clrsky_flux_up_at_model_top" , "toa_outgoing_longwave_flux_assuming_clear_sky"},
158+
{"surf_evap" , "water_evapotranspiration_flux"},
159+
{"AtmosphereDensity" , "air_density"},
160+
{"PotentialTemperature" , "air_potential_temperature"},
161+
{"SeaLevelPressure" , "air_pressure_at_mean_sea_level"},
162+
{"IceWaterPath" , "atmosphere_mass_content_of_cloud_ice"},
163+
{"LiqWaterPath" , "atmosphere_mass_content_of_cloud_liquid_water"},
164+
{"VapWaterPath" , "atmosphere_mass_content_of_water_vapor"},
165+
{"AerosolOpticalDepth550nm" , "atmosphere_optical_thickness_due_to_ambient_aerosol_particles"},
166+
{"Exner" , "dimensionless_exner_function"},
167+
{"z_mid" , "geopotential_height"},
168+
{"geopotential_mid" , "geopotential_height"},
169+
{"RelativeHumidity" , "relative_humidity"},
170+
{"surface_upward_latent_heat_flux" , "surface_upward_latent_heat_flux"},
171+
{"LongwaveCloudForcing" , "toa_longwave_cloud_radiative_effect"},
172+
{"ShortwaveCloudForcing" , "toa_shortwave_cloud_radiative_effect"},
173+
{"VirtualTemperature" , "virtual_temperature"},
174+
{"VaporFlux" , "water_evapotranspiration_flux"},
175+
{"wind_speed" , "wind_speed"}
176+
};
95177

96178
};
97179

0 commit comments

Comments
 (0)