FV3 Bundle
ncdw_lheader.F90
Go to the documentation of this file.
3  use ncdw_state, only: ncid, init_done
5  use netcdf, only: nf90_put_att, nf90_global
6 
7  implicit none
8 
9  interface nc_diag_header
10  module procedure nc_diag_header_byte, &
16  end interface nc_diag_header
17 
18  contains
19  ! nc_diag_header - input integer(i_byte)
20  ! Corresponding NetCDF4 type: byte
21  subroutine nc_diag_header_byte(header_name, header_value)
22  character(len=*), intent(in) :: header_name
23  integer(i_byte), intent(in) :: header_value
24 
25  if (.NOT. init_done) &
26  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
27  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, header_value))
28  end subroutine nc_diag_header_byte
29 
30  ! nc_diag_header - input integer(i_short)
31  ! Corresponding NetCDF4 type: short
32  subroutine nc_diag_header_short(header_name, header_value)
33  character(len=*), intent(in) :: header_name
34  integer(i_short), intent(in) :: header_value
35 
36  if (.NOT. init_done) &
37  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
38  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, header_value))
39  end subroutine nc_diag_header_short
40 
41  ! nc_diag_header - input integer(i_long)
42  ! Corresponding NetCDF4 type: int (old: long)
43  subroutine nc_diag_header_long(header_name, header_value)
44  character(len=*), intent(in) :: header_name
45  integer(i_long), intent(in) :: header_value
46 
47  if (.NOT. init_done) &
48  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
49  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, header_value))
50  end subroutine nc_diag_header_long
51 
52  ! nc_diag_header - input real(r_single)
53  ! Corresponding NetCDF4 type: float (or real)
54  subroutine nc_diag_header_rsingle(header_name, header_value)
55  character(len=*), intent(in) :: header_name
56  real(r_single), intent(in) :: header_value
57 
58  if (.NOT. init_done) &
59  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
60  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, header_value))
61  end subroutine nc_diag_header_rsingle
62 
63  ! nc_diag_header - input real(r_double)
64  ! Corresponding NetCDF4 type: double
65  subroutine nc_diag_header_rdouble(header_name, header_value)
66  character(len=*), intent(in) :: header_name
67  real(r_double), intent(in) :: header_value
68 
69  if (.NOT. init_done) &
70  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
71  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, header_value))
72  end subroutine nc_diag_header_rdouble
73 
74  ! nc_diag_header - input character(len=*)
75  ! Corresponding NetCDF4 type: string? char?
76  subroutine nc_diag_header_string(header_name, header_value)
77  character(len=*), intent(in) :: header_name
78  character(len=*), intent(in) :: header_value
79 
80  if (.NOT. init_done) &
81  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
82  ! Note: using F95 trim here!
83  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, trim(header_value)))
84  end subroutine nc_diag_header_string
85 
86  !=============================================================
87  ! VECTOR TYPES
88  !=============================================================
89 
90  ! nc_diag_header - input integer(i_byte), dimension(:)
91  ! Corresponding NetCDF4 type: byte
92  subroutine nc_diag_header_byte_v(header_name, header_value)
93  character(len=*), intent(in) :: header_name
94  integer(i_byte), dimension(:), intent(in) :: header_value
95 
96  if (.NOT. init_done) &
97  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
98  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, header_value))
99  end subroutine nc_diag_header_byte_v
100 
101  ! nc_diag_header - input integer(i_short)
102  ! Corresponding NetCDF4 type: short
103  subroutine nc_diag_header_short_v(header_name, header_value)
104  character(len=*), intent(in) :: header_name
105  integer(i_short), dimension(:), intent(in) :: header_value
106 
107  if (.NOT. init_done) &
108  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
109  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, header_value))
110  end subroutine nc_diag_header_short_v
111 
112  ! nc_diag_header - input integer(i_long)
113  ! Corresponding NetCDF4 type: int (old: long)
114  subroutine nc_diag_header_long_v(header_name, header_value)
115  character(len=*), intent(in) :: header_name
116  integer(i_long), dimension(:), intent(in) :: header_value
117 
118  if (.NOT. init_done) &
119  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
120  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, header_value))
121  end subroutine nc_diag_header_long_v
122 
123  ! nc_diag_header - input real(r_single)
124  ! Corresponding NetCDF4 type: float (or real)
125  subroutine nc_diag_header_rsingle_v(header_name, header_value)
126  character(len=*), intent(in) :: header_name
127  real(r_single), dimension(:), intent(in) :: header_value
128 
129  if (.NOT. init_done) &
130  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
131  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, header_value))
132  end subroutine nc_diag_header_rsingle_v
133 
134  ! nc_diag_header - input real(r_double)
135  ! Corresponding NetCDF4 type: double
136  subroutine nc_diag_header_rdouble_v(header_name, header_value)
137  character(len=*), intent(in) :: header_name
138  real(r_double), dimension(:), intent(in) :: header_value
139 
140  if (.NOT. init_done) &
141  call nclayer_error("Can't write definitions - NetCDF4 layer not initialized yet!")
142  call nclayer_check(nf90_put_att(ncid, nf90_global, header_name, header_value))
143  end subroutine nc_diag_header_rdouble_v
144 end module ncdw_lheader
integer, parameter, public i_byte
Definition: ncd_kinds.F90:45
integer, parameter, public i_long
Definition: ncd_kinds.F90:47
logical init_done
Definition: ncdw_state.f90:9
subroutine nc_diag_header_rdouble(header_name, header_value)
subroutine nc_diag_header_byte_v(header_name, header_value)
subroutine nclayer_check(status)
subroutine nc_diag_header_byte(header_name, header_value)
subroutine nc_diag_header_short(header_name, header_value)
integer(i_long) ncid
Definition: ncdw_state.f90:8
subroutine nc_diag_header_long(header_name, header_value)
subroutine nc_diag_header_string(header_name, header_value)
subroutine nc_diag_header_rdouble_v(header_name, header_value)
subroutine nc_diag_header_long_v(header_name, header_value)
integer, parameter, public i_short
Definition: ncd_kinds.F90:46
subroutine nc_diag_header_rsingle_v(header_name, header_value)
subroutine nclayer_error(err)
Definition: ncdw_climsg.F90:97
integer, parameter, public r_double
Definition: ncd_kinds.F90:80
integer, parameter, public r_single
Definition: ncd_kinds.F90:79
subroutine nc_diag_header_rsingle(header_name, header_value)
subroutine nc_diag_header_short_v(header_name, header_value)