ESMF_NetCDFCheckError Function

private function ESMF_NetCDFCheckError(ncStatus, module, fileName, lineNo, rc)

Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: ncStatus
character(len=*), intent(in) :: module
character(len=*), intent(in) :: fileName
integer, intent(in) :: lineNo
integer, intent(out), optional :: rc

Return Value logical


Source Code

function ESMF_NetCDFCheckError(ncStatus, module, fileName, lineNo, rc)

    logical                        :: ESMF_NetCDFCheckError

    integer, intent(in)            :: ncStatus
    character(len=*), intent(in)   :: module
    character(len=*), intent(in)   :: fileName
    integer, intent(in)  :: lineNo
    integer, intent(out), optional :: rc

    integer, parameter :: nf90_noerror = 0

    ESMF_NetCDFCheckError = .FALSE.

#ifdef ESMF_NETCDF
    if (ncStatus .ne. nf90_noerror) then
      call ESMF_LogWrite (msg="netCDF Status Return Error", &
          logmsgFlag=ESMF_LOGMSG_ERROR, line=lineNo, file=fileName, method=module)
      call ESMF_LogFlush()
      if (present(rc)) rc = ESMF_FAILURE
      ESMF_NetCDFCheckError = .TRUE.
    else
      if (present(rc)) rc = ESMF_SUCCESS
      return
    end if
#else
    call ESMF_LogSetError(rcToCheck=ESMF_RC_LIB_NOT_PRESENT, &
      msg="- ESMF_NETCDF not defined when lib was compiled", ESMF_CONTEXT, &
      rcToReturn=rc)
    return
#endif

end function ESMF_NetCDFCheckError