WAVEWATCH III  beta 0.0.1
scrip_netcdfmod Module Reference

Functions/Subroutines

logical(scrip_logical) function, public scrip_netcdferrorcheck (netcdfStat, errorCode, rtnName, errorMsg)
 

Function/Subroutine Documentation

◆ scrip_netcdferrorcheck()

logical (scrip_logical) function, public scrip_netcdfmod::scrip_netcdferrorcheck ( integer (scrip_i4), intent(in)  netcdfStat,
integer (scrip_i4), intent(out)  errorCode,
character (*), intent(in)  rtnName,
character (*), intent(in)  errorMsg 
)

Definition at line 45 of file scrip_netcdfmod.f90.

45 
46  ! !DESCRIPTION:
47  ! This routine checks netCDF status flags from netCDF routines.
48  ! On error, it adds an error message to the error log and returns
49  ! both a true value to the calling routines as well as setting the
50  ! error code to fail. It is used in the same manner is the
51  ! SCRIP\_ErrorCheck function.
52  !
53  ! !REVISION HISTORY:
54  ! same as module
55 
56  ! !OUTPUT PARAMETERS:
57 
58  logical (SCRIP_logical) :: &
59  SCRIP_NetcdfErrorCheck
60 
61  integer (SCRIP_i4), intent(out) :: &
62  errorCode ! returned SCRIP error flag
63 
64  ! !INPUT PARAMETERS:
65 
66  integer (SCRIP_i4), intent(in) :: &
67  netcdfStat ! status flag from netCDF call
68 
69  character (*), intent(in) :: &
70  rtnName, &! name of calling routine
71  errorMsg ! error message for logging
72 
73  !EOP
74  !BOC
75  !-----------------------------------------------------------------------
76  !
77  ! local variables
78  !
79  !-----------------------------------------------------------------------
80 
81  character (SCRIP_charLength) :: &
82  ncErrMsg ! netCDF error message
83 
84  !-----------------------------------------------------------------------
85  !
86  ! if no error, return false and a successful errorCode
87  !
88  !-----------------------------------------------------------------------
89 
90  if (netcdfstat == nf90_noerr) then
91  errorcode = scrip_success
92  scrip_netcdferrorcheck = .false.
93 
94  !-----------------------------------------------------------------------
95  !
96  ! if an error is detected, return a true value and call the SCRIP
97  ! error handlers to log the error. Log both the netCDF error msg
98  ! as well as the error passed by the calling routine.
99  !
100  !-----------------------------------------------------------------------
101 
102  else
103 
104  scrip_netcdferrorcheck = .true.
105  ncerrmsg = nf90_strerror(netcdfstat)
106  call scrip_errorset(errorcode, rtnname, ncerrmsg)
107  call scrip_errorset(errorcode, rtnname, errormsg)
108 
109  endif
110 
111  !-----------------------------------------------------------------------
112  !EOC
113 

References scrip_errormod::scrip_errorset(), and scrip_errormod::scrip_success.

Referenced by scrip_remap_read::read_remap_scrip_ww3(), scrip_remap_read::read_remap_ww3(), scrip_remap_write::write_remap_csm(), scrip_remap_write::write_remap_scrip(), and scrip_remap_write::write_remap_scrip_ww3().

scrip_errormod::scrip_errorset
subroutine, public scrip_errorset(errorCode, rtnName, errorMsg)
Definition: scrip_errormod.f90:81
scrip_errormod::scrip_success
integer(scrip_i4), parameter, public scrip_success
Definition: scrip_errormod.f90:42