Skip to content

Commit

Permalink
Fix how IOP reads time
Browse files Browse the repository at this point in the history
  • Loading branch information
tcclevenger committed Jul 25, 2024
1 parent a1b89eb commit e5845ea
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions components/eamxx/src/share/iop/intensive_observation_period.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<int>("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<int>("iop_file_times", ntimes);
for (int t=0; t<ntimes; ++t) {
scorpio::read_var(iop_file,"tsec",&m_time_info.iop_file_times_in_sec(t),t);
}

// Check that lat/lon from iop file match the targets in parameters. Note that
// longitude may be negtive in the iop file, we convert to positive before checking.
const auto nlats = scorpio::get_dimlen(iop_file, "lat");
Expand Down

0 comments on commit e5845ea

Please sign in to comment.