From e5845eaaf8d2bb1cd07c0223c0848c76cc21617f Mon Sep 17 00:00:00 2001 From: tcclevenger Date: Mon, 22 Jul 2024 10:20:20 -0600 Subject: [PATCH] Fix how IOP reads time --- .../src/share/iop/intensive_observation_period.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/components/eamxx/src/share/iop/intensive_observation_period.cpp b/components/eamxx/src/share/iop/intensive_observation_period.cpp index 6f8474f8d85..32b120c5700 100644 --- a/components/eamxx/src/share/iop/intensive_observation_period.cpp +++ b/components/eamxx/src/share/iop/intensive_observation_period.cpp @@ -248,15 +248,17 @@ initialize_iop_file(const util::TimeStamp& run_t0, else if (scorpio::has_dim(iop_file, "tsec")) time_dimname = "tsec"; else EKAT_ERROR_MSG("Error! No valid dimension for tsec in "+iop_file+".\n"); - const auto ntimes = scorpio::get_dimlen(iop_file, time_dimname); - m_time_info.iop_file_times_in_sec = view_1d_host("iop_file_times", ntimes); - scorpio::read_var(iop_file,"tsec",m_time_info.iop_file_times_in_sec.data()); - - // From now on, when we read vars, "time" must be treated as unlimited, to avoid issues + // When we read vars, "time" must be treated as unlimited, to avoid issues if (not scorpio::is_dim_unlimited(iop_file,time_dimname)) { scorpio::pretend_dim_is_unlimited(iop_file,time_dimname); } + const auto ntimes = scorpio::get_dimlen(iop_file, time_dimname); + m_time_info.iop_file_times_in_sec = view_1d_host("iop_file_times", ntimes); + for (int t=0; t