@@ -72,6 +72,8 @@ enum TracerFileType {
72
72
ZONAL,
73
73
// vertical emission files
74
74
VERT_EMISSION,
75
+ //
76
+ NONE
75
77
};
76
78
77
79
enum TracerDataIndex { BEG = 0 , END = 1 , OUT = 2 };
@@ -381,11 +383,6 @@ inline std::shared_ptr<AbstractRemapper> create_horiz_remapper(
381
383
model_grid->clone (" tracer_horiz_interp_tgt_grid" , true );
382
384
horiz_interp_tgt_grid->reset_num_vertical_lev (tracer_data.nlevs_data );
383
385
384
- if (tracer_data.file_type == VERT_EMISSION) {
385
- horiz_interp_tgt_grid->reset_field_tag_name (LEV, " altitude" );
386
- horiz_interp_tgt_grid->reset_field_tag_name (ILEV, " altitude_int" );
387
- }
388
-
389
386
const int ncols_model = model_grid->get_num_global_dofs ();
390
387
std::shared_ptr<AbstractRemapper> remapper;
391
388
if (tracer_data.ncols_data == ncols_model) {
@@ -436,44 +433,33 @@ inline std::shared_ptr<AbstractRemapper> create_horiz_remapper(
436
433
437
434
} // create_horiz_remapper
438
435
439
- inline std::shared_ptr<AtmosphereInput> create_tracer_data_reader (
440
- const std::shared_ptr<AbstractRemapper> &horiz_remapper,
441
- const std::string &tracer_data_file) {
442
- std::vector<Field> io_fields;
443
- for (int i = 0 ; i < horiz_remapper->get_num_fields (); ++i) {
444
- io_fields.push_back (horiz_remapper->get_src_field (i));
445
- }
446
- const auto io_grid = horiz_remapper->get_src_grid ();
447
- return std::make_shared<AtmosphereInput>(tracer_data_file, io_grid, io_fields,
448
- true );
449
- } // create_tracer_data_reader
450
-
451
436
inline std::shared_ptr<AtmosphereInput> create_tracer_data_reader (
452
437
const std::shared_ptr<AbstractRemapper> &horiz_remapper,
453
438
const std::string &tracer_data_file,
454
- const TracerData &tracer_data,
455
- const std::string &extfrc_map_file
456
- ) {
439
+ const TracerFileType file_type = NONE)
440
+ {
457
441
std::vector<Field> io_fields;
458
442
for (int i = 0 ; i < horiz_remapper->get_num_fields (); ++i) {
459
443
io_fields.push_back (horiz_remapper->get_src_field (i));
460
444
}
461
445
const auto io_grid = horiz_remapper->get_src_grid ();
462
-
463
- // NOTE: If we are using a vertical emission NC file with altitude instead of levels ,
464
- // we must rename this tag. This is only necessary when a map file is used .
465
- if (tracer_data. file_type == VERT_EMISSION && extfrc_map_file != " " ){
446
+ if (file_type == VERT_EMISSION ){
447
+ // NOTE: If we are using a vertical emission nc file with altitude instead of lev ,
448
+ // we must rename this tag.
449
+ // We need to perform a shallow clone of io_grid because tags are const in this object.
466
450
auto horiz_interp_src_grid =
467
451
io_grid->clone (" tracer_horiz_interp_src_grid" , true );
468
- horiz_interp_src_grid->reset_field_tag_name (LEV, " altitude" );
469
- horiz_interp_src_grid->reset_field_tag_name (ILEV, " altitude_int" );
470
- return std::make_shared<AtmosphereInput>(tracer_data_file, horiz_interp_src_grid, io_fields,
452
+ horiz_interp_src_grid->reset_field_tag_name (LEV, " altitude" );
453
+ horiz_interp_src_grid->reset_field_tag_name (ILEV, " altitude_int" );
454
+ return std::make_shared<AtmosphereInput>(tracer_data_file, horiz_interp_src_grid, io_fields,
471
455
true );
472
- } else {
456
+ } else {
457
+ // We do not need to rename tags in or clone io_grid for other types of files.
473
458
return std::make_shared<AtmosphereInput>(tracer_data_file, io_grid, io_fields,
474
459
true );
475
460
}
476
461
462
+
477
463
} // create_tracer_data_reader
478
464
479
465
inline void update_tracer_data_from_file (
0 commit comments