source: LMDZ6/trunk/tools/netcdf95/docs/Detailed_content/errors.md @ 5407

Last change on this file since 5407 was 4918, checked in by Laurent Fairhead, 8 months ago

Reintegrated NetCDF95 in LMDZ so that it is compiled and made available by the makelmdz_fcm script.
The makelmdz_fcm creates the libnetcdf95 library and copies it in the tools/netcdf/lib directory, copying
the mod files in the tools/netcdf/include library.

File size: 1.4 KB
Line 
1# Handling of errors
2
3If you call a NetCDF95 procedure without the optional `ncerr`
4argument, and some error occurs, then the NetCDF95 procedure will:
5
6-   write to standard output all the information it has, including the
7    string produced by `nf90_strerror`;
8-   try to close the NetCDF file;
9-   stop the program, with an exit status of 1.
10
11For example, if some error occurs within a call to `nf95_inq_varid`,
12`nf95_inq_varid` will write to standard output:
13
14    nf95_inq_varid, name = < name of the variable you inquired about >:
15    < string produced by nf90_strerror >
16
17## `nf95_abort`
18
19(additional procedure)
20
21```
22subroutine nf95_abort(message, ncerr, ncid, varid)
23  character(len=*), intent(in):: message
24  ! (should include name of calling procedure)
25
26  integer, intent(in):: ncerr
27
28  integer, intent(in), optional :: ncid
29  ! This can be the file ncid or a group ncid. Provide this argument
30  ! if you want nf95_abort to try to close the file.
31
32  integer, intent(in), optional :: varid
33```
34
35This is a public procedure which is also used internally in NetCDF95.
36`nf95_abort` prints a message and stops the program. `nf95_abort` may
37also be useful after calling procedures of the Fortran 90 interface
38that have not been implemented in NetCDF95.
39
40You should include the name of the calling procedure in the `message`
41argument. Provide the `ncid` argument if you want `nf95_abort` to try
42to close the file. Provide `varid` if you want `nf95_abort` to print
43it.
Note: See TracBrowser for help on using the repository browser.