!----------------------------------------------------------------------------- ! ! check -- Universal Netcdf error checker (F90). Abort on error. ! ! 1.00 2009-jan-26 Original module version. By Dave Allured. ! ! This subroutine is used with the Netcdf Fortran 90 libraries to ! handle function return codes within a single program line. ! ! Usage: ! ! use netcdf__check ! ... ! call check (nf90_function (args)) ! ! This routine considers all error codes to be fatal errors, ! except for nf90_noerr, which is usually zero. ! !----------------------------------------------------------------------------- module netcdf__check contains subroutine check (status) use netcdf implicit none integer, intent (in) :: status ! standard Netcdf library return code if (status /= nf90_noerr) then print *, '*** Netcdf error number ', status print *, '*** ', trim (nf90_strerror (status)) call exit (99) end if end subroutine check end module netcdf__check