Skip to content

Commit

Permalink
Merge Pull Request #2917 from E3SM-Project/scream/tcclevenger/iop_fil…
Browse files Browse the repository at this point in the history
…e_read

Automatically Merged using E3SM Pull Request AutoTester
PR Title: Fix how IOP reads time
PR Author: tcclevenger
PR LABELS: BFB, AT: AUTOMERGE, bugfix, DP-SCREAM
  • Loading branch information
E3SM-Bot authored Jul 26, 2024
2 parents a1b89eb + e5845ea commit 5658827
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 5658827

Please sign in to comment.