Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
io_netcdf: do check exit status of nf90_close in final_restart
In ice_restart::final_restart, we call nf90_close outside any condition on 'my_task'. This is very fishy, as the restart file is only opened by the first MPI rank in init_restart_write. The reason it works is (most likely) because we do not check the exit status of nf90_close, which (most likely) fails on all ranks other than the first. What's more, we always output "Restart read/written" to the log file, even if the call to nf90_close failed. This means the log file will always say the restart was written, even if it might not have been because of an error, which can be very confusing (see [1] and following). Move the call to nf90_close inside the existing condition on 'my_task', and also check the exit status, converting any error code to its textual representation using 'nf90_strerror'. [1] https://gitlab.science.gc.ca/Ocean_Data_Assimilation/RIOPS/issues/101#note_790575
- Loading branch information