New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
nctools.F90 in utils/tools/OBSTOOLS/src – NEMO

source: utils/tools/OBSTOOLS/src/nctools.F90 @ 10841

Last change on this file since 10841 was 3000, checked in by djlea, 13 years ago

Updated obstools. Addition of headers to programs which explain what each utility does and how to run it. All the programs now build using the naketools utility.

File size: 1.1 KB
Line 
1#define __MYFILE__ 'nctools.F90'
2MODULE nctools
3
4   ! Utility subroutines for netCDF access
5   ! Modified    : MAB (nf90, handle_error, LINE&FILE)
6   ! Modifled    : KSM (new shorter name)
7
8   USE netcdf
9
10   PUBLIC ldebug_netcdf, nchdlerr
11   LOGICAL :: ldebug_netcdf = .FALSE.  ! Debug switch for netcdf
12
13CONTAINS
14
15   SUBROUTINE nchdlerr(status,lineno,filename)
16     
17      ! Error handler for netCDF access
18      IMPLICIT NONE
19
20
21      INTEGER :: status ! netCDF return status
22      INTEGER :: lineno ! Line number (usually obtained from
23                        !  preprocessing __LINE__,__MYFILE__)
24      CHARACTER(len=*),OPTIONAL :: filename
25
26      IF (status/=nf90_noerr) THEN
27         WRITE(*,*)'Netcdf error, code ',status
28         IF (PRESENT(filename)) THEN
29            WRITE(*,*)'In file ',filename,' in line ',lineno
30         ELSE
31            WRITE(*,*)'In line ',lineno
32         END IF
33         WRITE(*,'(2A)')' Error message : ',nf90_strerror(status)
34         CALL abort
35      ENDIF
36
37   END SUBROUTINE nchdlerr
38
39!----------------------------------------------------------------------
40END MODULE nctools
Note: See TracBrowser for help on using the repository browser.