Skip to content

Commit 865f0bc

Browse files
Merge remote-tracking branch 'odiazib/oscar/eamxx/fix_remap_test_mam4xx'(PR #7863)
EAMxx: Fixing the grid for LINOZ and OXID files. We are using ne30pg2 files for linoz and oxid instead of ne4pg2, which produces an error in the DataInterpolation class because we also provide a remap file. Another piece of code is added to fix the following error: Error! Layout mismatch for input file variable. 26: - filename: /compyfs/inputdata//atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_bc_a4_elev_1x1_2010_clim_ne4pg2_c20250701.nc 26: - varname : BB 26: - expected dims : ncol,lev 26: - dims from file: ncol,altitude It should fix these tests: REP_Ln5.ne30pg2_oECv3.F2010-EAMxx-MAM4xx.pm-gpu_gnugpu.eamxx-mam4xx-remap_emiss_ne4_ne30--eamxx-L72 SMS_Ln5.ne30pg2_oECv3.F2010-EAMxx-MAM4xx.frontier_craygnu-mphipcc.eamxx-mam4xx-remap_emiss_ne4_ne30--eamxx-L72 [BFB] * odiazib/oscar/eamxx/fix_remap_test_mam4xx: EAMxx: Updating files for remap unit test. EAMxx: Using a clone grid to allow reading data from an NC file that does not use the same field tags as eamxx. EAMxx: We must use ne4pg2 files for oxid and LINOZ.
2 parents 021660a + c97d0db commit 865f0bc

File tree

3 files changed

+30
-17
lines changed

3 files changed

+30
-17
lines changed

components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/mam4xx/remap_emiss_ne4_ne30/shell_commands

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,15 @@ $CIMEROOT/../components/eamxx/cime_config/testdefs/testmods_dirs/eamxx/mam4xx/se
1717
#------------------------------------------------------
1818
# Files for ne4pg2 emissions
1919
#------------------------------------------------------
20-
21-
ATMCHANGE mam4_aero_microphys::mam4_so2_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so2_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b
22-
ATMCHANGE mam4_aero_microphys::mam4_so4_a1_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so4_a1_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b
23-
ATMCHANGE mam4_aero_microphys::mam4_so4_a2_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so4_a2_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b
24-
ATMCHANGE mam4_aero_microphys::mam4_pom_a4_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_pom_a4_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b
25-
ATMCHANGE mam4_aero_microphys::mam4_bc_a4_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_bc_a4_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b
26-
ATMCHANGE mam4_aero_microphys::mam4_num_a1_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a1_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b
27-
ATMCHANGE mam4_aero_microphys::mam4_num_a2_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a2_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b
28-
ATMCHANGE mam4_aero_microphys::mam4_num_a4_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a4_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b
29-
ATMCHANGE mam4_aero_microphys::mam4_soag_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_soag_elev_1x1_2010_clim_ne4pg2_c20241008.nc' -b
30-
ATMCHANGE mam4_aero_microphys::aero_microphys_remap_file='${DIN_LOC_ROOT}/atm/scream/maps/map_ne4pg2_to_ne30pg2_nco_c20241108.nc' -b
20+
ATMCHANGE mam4_aero_microphys::mam4_linoz_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/linoz/ne4pg2/linoz2010_2010JPL_CMIP6_10deg_58km_ne4pg2_c20250826.nc' -b
21+
ATMCHANGE mam4_aero_microphys::mam4_oxid_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/invariants/ne4pg2/oxid_1.9x2.5_L26_2015_ne4pg2_c20250813.nc' -b
22+
ATMCHANGE mam4_aero_microphys::mam4_so2_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so2_elev_1x1_2010_clim_ne4pg2_c20250701.nc' -b
23+
ATMCHANGE mam4_aero_microphys::mam4_so4_a1_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so4_a1_elev_1x1_2010_clim_ne4pg2_c20250701.nc' -b
24+
ATMCHANGE mam4_aero_microphys::mam4_so4_a2_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_so4_a2_elev_1x1_2010_clim_ne4pg2_c20250701.nc' -b
25+
ATMCHANGE mam4_aero_microphys::mam4_pom_a4_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_pom_a4_elev_1x1_2010_clim_ne4pg2_c20250701.nc' -b
26+
ATMCHANGE mam4_aero_microphys::mam4_bc_a4_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_bc_a4_elev_1x1_2010_clim_ne4pg2_c20250701.nc' -b
27+
ATMCHANGE mam4_aero_microphys::mam4_num_a1_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a1_elev_1x1_2010_clim_ne4pg2_c20250701.nc' -b
28+
ATMCHANGE mam4_aero_microphys::mam4_num_a2_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a2_elev_1x1_2010_clim_ne4pg2_c20250701.nc' -b
29+
ATMCHANGE mam4_aero_microphys::mam4_num_a4_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_num_a4_elev_1x1_2010_clim_ne4pg2_c20250701.nc' -b
30+
ATMCHANGE mam4_aero_microphys::mam4_soag_elevated_emiss_file_name='${DIN_LOC_ROOT}/atm/scream/mam4xx/emissions/ne4pg2/elevated/cmip6_mam4_soag_elev_1x1_2010_clim_ne4pg2_c20250701.nc' -b
31+
ATMCHANGE mam4_aero_microphys::aero_microphys_remap_file='${DIN_LOC_ROOT}/atm/scream/maps/map_ne4pg2_to_ne30pg2_nco_c20241108.nc' -b

components/eamxx/src/physics/mam/eamxx_mam_microphysics_process_interface.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ void MAMMicrophysics::set_oxid_reader()
407407
data_interp_oxid_ = std::make_shared<DataInterpolation>(grid_,oxid_fields);
408408
data_interp_oxid_->setup_time_database ({oxid_file_name},util::TimeLine::YearlyPeriodic, ref_ts_oxid);
409409
data_interp_oxid_->create_horiz_remappers (oxid_map_file=="none" ? "" : oxid_map_file);
410-
data_interp_oxid_->set_logger(m_atm_logger);
410+
data_interp_oxid_->set_logger(m_atm_logger);
411411
DataInterpolation::VertRemapData remap_data_oxid;
412412
remap_data_oxid.vr_type = DataInterpolation::Dynamic3DRef;
413413
remap_data_oxid.pname = "PS";
@@ -443,7 +443,7 @@ void MAMMicrophysics::set_linoz_reader(){
443443
data_interp_linoz_ = std::make_shared<DataInterpolation>(grid_,linoz_fields);
444444
data_interp_linoz_->setup_time_database ({m_linoz_file_name},util::TimeLine::YearlyPeriodic, ref_ts_linoz);
445445
data_interp_linoz_->create_horiz_remappers (linoz_map_file=="none" ? "" : linoz_map_file);
446-
data_interp_linoz_->set_logger(m_atm_logger);
446+
data_interp_linoz_->set_logger(m_atm_logger);
447447

448448
DataInterpolation::VertRemapData remap_data_linoz;
449449
remap_data_linoz.vr_type = DataInterpolation::Static1D;
@@ -483,15 +483,14 @@ void MAMMicrophysics::set_elevated_emissions_reader()
483483
}
484484
std::shared_ptr<DataInterpolation> di_vertical = std::make_shared<DataInterpolation>(grid_,vertical_fields);
485485
di_vertical->set_input_files_dimname(ShortFieldTagsNames::LEV,"altitude");
486+
di_vertical->set_input_files_dimname(ShortFieldTagsNames::ILEV,"altitude_int");
486487
di_vertical->setup_time_database ({file_name},util::TimeLine::YearlyPeriodic, ref_ts_vertical);
487488
di_vertical->create_horiz_remappers (extfrc_map_file=="none" ? "" : extfrc_map_file);
488-
di_vertical->set_logger(m_atm_logger);
489+
di_vertical->set_logger(m_atm_logger);
489490
DataInterpolation::VertRemapData remap_data_vertical;
490491
remap_data_vertical.vr_type = DataInterpolation::Custom;
491492
remap_data_vertical.pmid = z_iface;
492493
auto grid_after_hremap_vertical = di_vertical->get_grid_after_hremap();
493-
grid_after_hremap_vertical->reset_field_tag_name(ShortFieldTagsNames::LEV, "altitude");
494-
grid_after_hremap_vertical->reset_field_tag_name(ShortFieldTagsNames::ILEV, "altitude_int");
495494
// we create elevated emission remapper
496495
auto vertical_remapper_elevated = std::make_shared<VerticalRemapperMAM4>(grid_after_hremap_vertical, grid_,
497496
VerticalRemapperMAM4::VertRemapType::MAM4_ELEVATED_EMISSIONS);

components/eamxx/src/share/algorithm/eamxx_data_interpolation.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ DataInterpolation (const std::shared_ptr<const AbstractGrid>& model_grid,
3636
using namespace ShortFieldTagsNames;
3737
m_input_files_dimnames[COL] = "ncol";
3838
m_input_files_dimnames[LEV] = "lev";
39+
m_input_files_dimnames[ILEV] = "ilev";
3940
e2str(LEV);
4041

4142
// Initialize logger with a console logger for warnings (logs on all ranks)
@@ -190,7 +191,17 @@ init_data_interval (const util::TimeStamp& t0)
190191
fnames.push_back(f.name());
191192
}
192193

193-
m_reader = std::make_shared<AtmosphereInput>(fnames,m_horiz_remapper_beg->get_src_grid());
194+
// NOTE: Sometimes the original data does not use the same field tags as eamxx.
195+
// For these cases, we need to perform a shallow clone of
196+
// io_grid because the tags are constant in this object.
197+
using namespace ShortFieldTagsNames;
198+
auto horiz_interp_src_grid =
199+
m_horiz_remapper_beg->get_src_grid()->clone(m_horiz_remapper_beg->get_src_grid()->name(), true);
200+
horiz_interp_src_grid->reset_field_tag_name(COL, m_input_files_dimnames[COL]);
201+
horiz_interp_src_grid->reset_field_tag_name(LEV, m_input_files_dimnames[LEV]);
202+
horiz_interp_src_grid->reset_field_tag_name(ILEV, m_input_files_dimnames[ILEV]);
203+
204+
m_reader = std::make_shared<AtmosphereInput>(fnames,horiz_interp_src_grid);
194205

195206
// Loop over all stored time slices to find an interval that contains t0
196207
auto t0_interval = m_time_database.find_interval(t0);
@@ -412,6 +423,8 @@ create_horiz_remappers (const std::string& map_file)
412423
int map_ncols_src = m_horiz_remapper_beg->get_src_grid()->get_num_global_dofs();
413424
int map_ncols_tgt = m_horiz_remapper_beg->get_tgt_grid()->get_num_global_dofs();
414425

426+
427+
415428
// Ensure that the map file was compatible with data/model grids
416429
EKAT_REQUIRE_MSG (map_ncols_src==ncols_data,
417430
"[DataInterpolation] Error! Map file src grid is incompatible with the input data.\n"

0 commit comments

Comments
 (0)