SICOPOLIS V5-dev  Revision 1173
nc_check_m.F90
Go to the documentation of this file.
1 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 !
3 ! Module : n c _ c h e c k _ m
4 !
5 !> @file
6 !!
7 !! NetCDF error capturing.
8 !!
9 !! @section Copyright
10 !!
11 !! Copyright 2009-2017 Ralf Greve
12 !!
13 !! @section License
14 !!
15 !! This file is part of SICOPOLIS.
16 !!
17 !! SICOPOLIS is free software: you can redistribute it and/or modify
18 !! it under the terms of the GNU General Public License as published by
19 !! the Free Software Foundation, either version 3 of the License, or
20 !! (at your option) any later version.
21 !!
22 !! SICOPOLIS is distributed in the hope that it will be useful,
23 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
24 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 !! GNU General Public License for more details.
26 !!
27 !! You should have received a copy of the GNU General Public License
28 !! along with SICOPOLIS. If not, see <http://www.gnu.org/licenses/>.
29 !<
30 !+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
31 
32 !-------------------------------------------------------------------------------
33 !> NetCDF error capturing.
34 !<------------------------------------------------------------------------------
35 module nc_check_m
36 
37 use sico_types_m
38 use netcdf
39 
40 contains
41 
42 !-------------------------------------------------------------------------------
43 !> NetCDF error capturing.
44 !<------------------------------------------------------------------------------
45 subroutine check(status, ch_calling_routine)
46 
47 implicit none
48 
49 integer(i4b), intent(in) :: status
50 character(len=64), optional, intent(in) :: ch_calling_routine
51 
52 character(len=64) :: ch_clrt
53 
54 if ( present(ch_calling_routine) ) then
55  ch_clrt = trim(ch_calling_routine)
56 else
57  ch_clrt = 'read_erg_nc' ! default calling routine
58 end if
59 
60 if (status /= nf90_noerr) then
61  write(6,'(1x,a)') trim(nf90_strerror(status))
62  write(6,'(1x,a)') ' '//trim(ch_clrt)//': Stopped due to NetCDF error!'
63  stop
64 end if
65 
66 end subroutine check
67 
68 end module nc_check_m
69 !
Declarations of kind types for SICOPOLIS.
NetCDF error capturing.
Definition: nc_check_m.F90:35
subroutine check(status, ch_calling_routine)
NetCDF error capturing.
Definition: nc_check_m.F90:46