SICOPOLIS V5-dev  Revision 1279
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-2018 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 error_m
39 
40 use netcdf
41 
42 contains
43 
44 !-------------------------------------------------------------------------------
45 !> NetCDF error capturing.
46 !<------------------------------------------------------------------------------
47 subroutine check(status, ch_calling_routine)
48 
49 implicit none
50 
51 integer(i4b), intent(in) :: status
52 character(len=64), optional, intent(in) :: ch_calling_routine
53 
54 character(len=64) :: ch_clrt
55 character(len=256) :: errormsgg
56 
57 character, parameter :: ch_end_of_line = char(10)
58 
59 if ( present(ch_calling_routine) ) then
60  ch_clrt = trim(ch_calling_routine)
61 else
62  ch_clrt = 'read_erg_nc' ! default calling routine
63 end if
64 
65 if (status /= nf90_noerr) then
66  errormsgg = ' '// trim(nf90_strerror(status)) &
67  // ch_end_of_line &
68  // ' >>> '//trim(ch_clrt)//' Stopped due to NetCDF error!'
69  call error(errormsgg)
70 end if
71 
72 end subroutine check
73 
74 end module nc_check_m
75 !
subroutine error(error_message)
Main routine of error_m: Writing of error messages and stopping execution.
Definition: error_m.F90:47
Declarations of kind types for SICOPOLIS.
Writing of error messages and stopping execution.
Definition: error_m.F90:35
NetCDF error capturing.
Definition: nc_check_m.F90:35
subroutine check(status, ch_calling_routine)
NetCDF error capturing.
Definition: nc_check_m.F90:48