Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix how IOP reads time #2917

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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