Skip to content

Commit

Permalink
Exit when a hotstart file is not found
Browse files Browse the repository at this point in the history
The current `combine_hotstart7` moves along even with a wrong istep and
cannot find an uncombined hotstart file, failing later with an unclear
error message.
This commit checks the return values from nf90_open and exits when it
failed.
  • Loading branch information
kjnam committed Jun 10, 2024
1 parent 38d9501 commit 8441b91
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/Utility/Combining_Scripts/combine_hotstart7.f90
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,10 @@ subroutine combine_hotstart7(istep)

!Query # of vars
iret=nf90_open('hotstart_000000_'//it_char(1:it_len)//'.nc',OR(NF90_NETCDF4,NF90_NOWRITE),ncid2)
if(iret.ne.0) then
write(*,*) 'Cannot find the hotstart file to read. Check the input information.'
call exit(iret)
endif
iret=nf90_inquire(ncid2,nDimensions=ndimensions,nVariables=nvars)
write(*,*)'nvars=',nvars,ndimensions
allocate(idims(ndimensions),dim_name(ndimensions),dimids(ndimensions))
Expand Down

0 comments on commit 8441b91

Please sign in to comment.