Skip to content

Commit 93cc466

Browse files
committed
Fixing the time interpolation for LINOZ and oxidants.
1 parent feca5a7 commit 93cc466

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

components/eamxx/src/physics/mam/readfiles/tracer_reader_utils.hpp

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct TracerTimeSlice {
126126

127127
// Converts raw YYYYMMDD date integers into sorted TimeStamp-index pairs.
128128
// Assumes yearly periodicity for now.
129-
// NOTE: Consider adding support for transient data.
129+
// NOTE: Consider adding support for transient data.
130130
struct TracerTimeDatabase {
131131
std::vector<TracerTimeSlice> slices;
132132
scream::util::TimeLine timeline = scream::util::TimeLine::YearlyPeriodic;
@@ -148,7 +148,7 @@ struct TracerTimeDatabase {
148148
int get_next_idx(int idx) const {
149149
return (idx + 1) % slices.size();
150150
}
151-
151+
152152
// Finds the interval [t_i, t_{i+1}) that contains ts. Assumes cyclic behavior.
153153
int find_interval(const util::TimeStamp& ts) const {
154154
EKAT_REQUIRE_MSG(size() >= 2, "Time database has fewer than 2 time slices.");
@@ -362,7 +362,7 @@ inline void init_monthly_time_offset(TracerData& tracer_data,
362362
EKAT_REQUIRE_MSG(cyclical_ymd_index >= 0,
363363
"Error! Model time (" + std::to_string(cyclical_ymd) +
364364
") is not within tracer time period.");
365-
365+
366366
tracer_data.offset_time_index_ = cyclical_ymd_index;
367367
}
368368

@@ -383,7 +383,7 @@ inline void init_irregular_time_database(TracerData& tracer_data,
383383

384384
auto ts_model = convert_date(cyclical_ymd);
385385
const int interval = tracer_data.time_db.find_interval(ts_model);
386-
386+
387387
EKAT_REQUIRE_MSG(interval >= 0,
388388
"Error! Model time (" + std::to_string(cyclical_ymd) +
389389
") is not within the tracer time range.");
@@ -461,11 +461,7 @@ inline void setup_tracer_data(TracerData &tracer_data,
461461
}
462462

463463
// Time initialization logic — delegated to helpers above
464-
if (tracer_file_type == ELEVATED_EMISSIONS) {
465-
init_irregular_time_database(tracer_data, trace_data_file, cyclical_ymd);
466-
} else {
467-
init_monthly_time_offset(tracer_data, trace_data_file, cyclical_ymd);
468-
}
464+
init_irregular_time_database(tracer_data, trace_data_file, cyclical_ymd);
469465

470466
scorpio::release_file(trace_data_file);
471467
tracer_data.file_type = tracer_file_type;
@@ -624,7 +620,7 @@ inline void update_monthly_timestate(
624620
}
625621
}
626622

627-
// Loads time slice data before and after current timestamp (ts),
623+
// Loads time slice data before and after current timestamp (ts),
628624
// and prepares interpolation state. First call initializes both BEG and END.
629625
inline void update_irregular_timestate(
630626
const std::shared_ptr<AtmosphereInput>& scorpio_reader,
@@ -705,13 +701,8 @@ inline void update_tracer_timestate(
705701
TracerTimeState& time_state,
706702
TracerData& data_tracer)
707703
{
708-
if (data_tracer.file_type == ELEVATED_EMISSIONS) {
709-
update_irregular_timestate(scorpio_reader, ts, tracer_horiz_interp,
704+
update_irregular_timestate(scorpio_reader, ts, tracer_horiz_interp,
710705
time_state, data_tracer);
711-
} else {
712-
update_monthly_timestate(scorpio_reader, ts, tracer_horiz_interp,
713-
time_state, data_tracer);
714-
}
715706
}
716707

717708
// This function is based on the SPA::perform_time_interpolation function.

components/eamxx/tests/single-process/mam/aero_microphys/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/output.yaml
2525
# Ensure test input files are present in the data dir
2626
set (TEST_INPUT_FILES
2727
scream/init/${EAMxx_tests_IC_FILE_MAM4xx_72lev}
28-
scream/mam4xx/linoz/ne2np4/linoz1850-2015_2010JPL_CMIP6_10deg_58km_ne2np4_c20240724.nc
28+
scream/mam4xx/linoz/ne2np4/linoz2010_2010JPL_CMIP6_10deg_58km_ne2np4_c20250826.nc
2929
scream/mam4xx/invariants/ne2np4/oxid_ne2np4_L26_1850-2015_c20240827.nc
3030
scream/mam4xx/linoz/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc
3131
scream/mam4xx/photolysis/RSF_GT200nm_v3.0_c080811.nc

components/eamxx/tests/single-process/mam/aero_microphys/input.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ eamxx:
2020
mam4_o3_lbl: 4
2121
mam4_psc_T : 193.0
2222
mam4_linoz_ymd : 20100101
23-
mam4_linoz_file_name : ${SCREAM_DATA_DIR}/mam4xx/linoz/ne2np4/linoz1850-2015_2010JPL_CMIP6_10deg_58km_ne2np4_c20240724.nc
23+
mam4_linoz_file_name : ${SCREAM_DATA_DIR}/mam4xx/linoz/ne2np4/linoz2010_2010JPL_CMIP6_10deg_58km_ne2np4_c20250826.nc
2424
mam4_oxid_file_name : ${SCREAM_DATA_DIR}/mam4xx/invariants/ne2np4/oxid_ne2np4_L26_2015_c20250813.nc
2525
mam4_oxid_ymd : 20150101
2626
mam4_linoz_chlorine_file : ${SCREAM_DATA_DIR}/mam4xx/linoz/Linoz_Chlorine_Loading_CMIP6_0003-2017_c20171114.nc

0 commit comments

Comments
 (0)