Skip to content

Commit

Permalink
EAMxx: add possibility to dump a dictionary of the FieldManager field…
Browse files Browse the repository at this point in the history
…s to a yaml file
  • Loading branch information
bartgol committed Dec 10, 2024
1 parent 94fbcfc commit 0c6eb2b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions components/eamxx/cime_config/namelist_defaults_scream.xml
Original file line number Diff line number Diff line change
Expand Up @@ -717,6 +717,7 @@ be lost if SCREAM_HACK_XML is not enabled.
<!-- driver_options options for scream -->
<driver_options>
<atmosphere_dag_verbosity_level>0</atmosphere_dag_verbosity_level>
<save_field_manager_dictionary type="logical">false</save_field_manager_dictionary>
<atm_log_level type="string"
valid_values="trace,debug,info,warn,error"
doc="Verbosity level for the atm logger">
Expand Down
19 changes: 19 additions & 0 deletions components/eamxx/src/control/atmosphere_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,25 @@ void AtmosphereDriver::create_fields()

m_ad_status |= s_fields_created;

// If the user requested it, we can save a dictionary of the FM fields to file
auto& driver_options_pl = m_atm_params.sublist("driver_options");
if (driver_options_pl.get("save_field_manager_dictionary",false)) {
auto pg = m_grids_manager->get_grid("Physics");
const auto& fm = m_field_mgrs.at(pg->name());
ekat::ParameterList dict;
DefaultMetadata std_names;
for (const auto& it : *fm) {
const auto& fid = it.second->get_header().get_identifier();
auto& pl = dict.sublist(fid.name());

pl.set("units",fid.get_units().to_string());
pl.set("layout",fid.get_layout().names());
pl.set("standard_name",std_names.get_standardname(fid.name()));
}

ekat::write_yaml_file("eamxx_fields.yaml",dict);
}

stop_timer("EAMxx::create_fields");
stop_timer("EAMxx::init");
m_atm_logger->info("[EAMxx] create_fields ... done!");
Expand Down

0 comments on commit 0c6eb2b

Please sign in to comment.