FV3 Bundle
ncdr_global_attrs_fetch.f90
Go to the documentation of this file.
9  use netcdf, only: nf90_get_att, nf90_byte, nf90_short, nf90_int, &
10  nf90_float, nf90_double, nf90_char, nf90_global
11 
12  implicit none
13 
15  ! Note that nc_diag_read_(no)id_get_global_attr_1d_string is not
16  ! included due to rare use + conflicts with single_string.
17  module procedure &
40  end interface nc_diag_read_get_global_attr
41 
42  contains
43  subroutine nc_diag_read_id_get_global_attr_1d_byte(file_ncdr_id, attr_name, attr_stor)
44  integer(i_long), intent(in) :: file_ncdr_id
45  character(len=*), intent(in) :: attr_name
46  integer(i_byte), dimension(:), allocatable, intent(inout) :: attr_stor
47 
48  integer(i_long) :: attr_len, attr_type, file_ncid
49 
50  call ncdr_check_ncdr_id(file_ncdr_id)
51 
52  file_ncid = ncdr_files(file_ncdr_id)%ncid
53  call ncdr_check_ncdr_id(file_ncdr_id)
54 
55  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
56 
57  call nc_diag_read_assert_global_attr_type(attr_type, nf90_byte)
58 
59  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
60 
61  call ncdr_nc_check(nf90_get_att(file_ncid, &
62  nf90_global, &
63  attr_name, &
64  attr_stor))
66 
67  subroutine nc_diag_read_noid_get_global_attr_1d_byte(attr_name, attr_stor)
68  character(len=*), intent(in) :: attr_name
69  integer(i_byte), dimension(:), allocatable, intent(inout) :: attr_stor
70 
74 
75  subroutine nc_diag_read_id_get_global_attr_1d_short(file_ncdr_id, attr_name, attr_stor)
76  integer(i_long), intent(in) :: file_ncdr_id
77  character(len=*), intent(in) :: attr_name
78  integer(i_short), dimension(:), allocatable, intent(inout) :: attr_stor
79 
80  integer(i_long) :: attr_len, attr_type, file_ncid
81 
82  call ncdr_check_ncdr_id(file_ncdr_id)
83 
84  file_ncid = ncdr_files(file_ncdr_id)%ncid
85  call ncdr_check_ncid(file_ncid)
86 
87  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
88 
89  call nc_diag_read_assert_global_attr_type(attr_type, nf90_short)
90 
91  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
92 
93  call ncdr_nc_check(nf90_get_att(file_ncid, &
94  nf90_global, &
95  attr_name, &
96  attr_stor))
98 
99  subroutine nc_diag_read_noid_get_global_attr_1d_short(attr_name, attr_stor)
100  character(len=*), intent(in) :: attr_name
101  integer(i_short), dimension(:), allocatable, intent(inout) :: attr_stor
102 
106 
107  subroutine nc_diag_read_id_get_global_attr_1d_long(file_ncdr_id, attr_name, attr_stor)
108  integer(i_long), intent(in) :: file_ncdr_id
109  character(len=*), intent(in) :: attr_name
110  integer(i_long), dimension(:), allocatable, intent(inout) :: attr_stor
111 
112  integer(i_long) :: attr_len, attr_type, file_ncid
113 
114  call ncdr_check_ncdr_id(file_ncdr_id)
115 
116  file_ncid = ncdr_files(file_ncdr_id)%ncid
117  call ncdr_check_ncid(file_ncid)
118 
119  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
120 
121  call nc_diag_read_assert_global_attr_type(attr_type, nf90_int)
122 
123  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
124 
125  call ncdr_nc_check(nf90_get_att(file_ncid, &
126  nf90_global, &
127  attr_name, &
128  attr_stor))
130 
131  subroutine nc_diag_read_noid_get_global_attr_1d_long(attr_name, attr_stor)
132  character(len=*), intent(in) :: attr_name
133  integer(i_long), dimension(:), allocatable, intent(inout) :: attr_stor
134 
136  call nc_diag_read_id_get_global_attr_1d_long(current_ncdr_id, attr_name, attr_stor)
138 
139  subroutine nc_diag_read_id_get_global_attr_1d_float(file_ncdr_id, attr_name, attr_stor)
140  integer(i_long), intent(in) :: file_ncdr_id
141  character(len=*), intent(in) :: attr_name
142  real(r_single), dimension(:), allocatable, intent(inout) :: attr_stor
143 
144  integer(i_long) :: attr_len, attr_type, file_ncid
145 
146  call ncdr_check_ncdr_id(file_ncdr_id)
147 
148  file_ncid = ncdr_files(file_ncdr_id)%ncid
149  call ncdr_check_ncid(file_ncid)
150 
151  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
152 
153  call nc_diag_read_assert_global_attr_type(attr_type, nf90_float)
154 
155  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
156 
157  call ncdr_nc_check(nf90_get_att(file_ncid, &
158  nf90_global, &
159  attr_name, &
160  attr_stor))
162 
163  subroutine nc_diag_read_noid_get_global_attr_1d_float(attr_name, attr_stor)
164  character(len=*), intent(in) :: attr_name
165  real(r_single), dimension(:), allocatable, intent(inout) :: attr_stor
166 
170 
171  subroutine nc_diag_read_id_get_global_attr_1d_double(file_ncdr_id, attr_name, attr_stor)
172  integer(i_long), intent(in) :: file_ncdr_id
173  character(len=*), intent(in) :: attr_name
174  real(r_double), dimension(:), allocatable, intent(inout) :: attr_stor
175 
176  integer(i_long) :: attr_len, attr_type, file_ncid
177 
178  call ncdr_check_ncdr_id(file_ncdr_id)
179 
180  file_ncid = ncdr_files(file_ncdr_id)%ncid
181  call ncdr_check_ncid(file_ncid)
182 
183  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
184 
185  call nc_diag_read_assert_global_attr_type(attr_type, nf90_double)
186 
187  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
188 
189  call ncdr_nc_check(nf90_get_att(file_ncid, &
190  nf90_global, &
191  attr_name, &
192  attr_stor))
194 
195  subroutine nc_diag_read_noid_get_global_attr_1d_double(attr_name, attr_stor)
196  character(len=*), intent(in) :: attr_name
197  real(r_double), dimension(:), allocatable, intent(inout) :: attr_stor
198 
202 
203  subroutine nc_diag_read_id_get_global_attr_1d_string(file_ncdr_id, attr_name, attr_stor)
204  integer(i_long), intent(in) :: file_ncdr_id
205  character(len=*), intent(in) :: attr_name
206  character(len=:),allocatable,intent(inout) :: attr_stor
207 
208  integer(i_long) :: attr_len, attr_type, file_ncid
209 
210  call ncdr_check_ncdr_id(file_ncdr_id)
211 
212  file_ncid = ncdr_files(file_ncdr_id)%ncid
213  call ncdr_check_ncid(file_ncid)
214 
215  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
216 
217  call nc_diag_read_assert_global_attr_type(attr_type, nf90_char)
218 
219  call nc_diag_read_assert_dims_alloc_string(attr_stor, (/ attr_len /))
220 
221  call ncdr_nc_check(nf90_get_att(file_ncid, &
222  nf90_global, &
223  attr_name, &
224  attr_stor))
226 
227  subroutine nc_diag_read_noid_get_global_attr_1d_string(attr_name, attr_stor)
228  character(len=*), intent(in) :: attr_name
229  character(len=:),allocatable,intent(inout) :: attr_stor
230 
234 
235  subroutine nc_diag_read_id_get_global_attr_single_byte(file_ncdr_id, attr_name, attr_stor)
236  integer(i_long), intent(in) :: file_ncdr_id
237  character(len=*), intent(in) :: attr_name
238  integer(i_byte) :: attr_stor
239 
240  integer(i_long) :: attr_len, attr_type, file_ncid
241 
242  call ncdr_check_ncdr_id(file_ncdr_id)
243 
244  file_ncid = ncdr_files(file_ncdr_id)%ncid
245  call ncdr_check_ncdr_id(file_ncdr_id)
246 
247  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
248 
249  call nc_diag_read_assert_global_attr_type(attr_type, nf90_byte)
250 
251  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
252 
253  call ncdr_nc_check(nf90_get_att(file_ncid, &
254  nf90_global, &
255  attr_name, &
256  attr_stor))
258 
259  subroutine nc_diag_read_noid_get_global_attr_single_byte(attr_name, attr_stor)
260  character(len=*), intent(in) :: attr_name
261  integer(i_byte) :: attr_stor
262 
266 
267  subroutine nc_diag_read_id_get_global_attr_single_short(file_ncdr_id, attr_name, attr_stor)
268  integer(i_long), intent(in) :: file_ncdr_id
269  character(len=*), intent(in) :: attr_name
270  integer(i_short) :: attr_stor
271 
272  integer(i_long) :: attr_len, attr_type, file_ncid
273 
274  call ncdr_check_ncdr_id(file_ncdr_id)
275 
276  file_ncid = ncdr_files(file_ncdr_id)%ncid
277  call ncdr_check_ncid(file_ncid)
278 
279  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
280 
281  call nc_diag_read_assert_global_attr_type(attr_type, nf90_short)
282 
283  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
284 
285  call ncdr_nc_check(nf90_get_att(file_ncid, &
286  nf90_global, &
287  attr_name, &
288  attr_stor))
290 
291  subroutine nc_diag_read_noid_get_global_attr_single_short(attr_name, attr_stor)
292  character(len=*), intent(in) :: attr_name
293  integer(i_short) :: attr_stor
294 
298 
299  subroutine nc_diag_read_id_get_global_attr_single_long(file_ncdr_id, attr_name, attr_stor)
300  integer(i_long), intent(in) :: file_ncdr_id
301  character(len=*), intent(in) :: attr_name
302  integer(i_long) :: attr_stor
303 
304  integer(i_long) :: attr_len, attr_type, file_ncid
305 
306  call ncdr_check_ncdr_id(file_ncdr_id)
307 
308  file_ncid = ncdr_files(file_ncdr_id)%ncid
309  call ncdr_check_ncid(file_ncid)
310 
311  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
312 
313  call nc_diag_read_assert_global_attr_type(attr_type, nf90_int)
314 
315  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
316 
317  call ncdr_nc_check(nf90_get_att(file_ncid, &
318  nf90_global, &
319  attr_name, &
320  attr_stor))
322 
323  subroutine nc_diag_read_noid_get_global_attr_single_long(attr_name, attr_stor)
324  character(len=*), intent(in) :: attr_name
325  integer(i_long) :: attr_stor
326 
330 
331  subroutine nc_diag_read_id_get_global_attr_single_float(file_ncdr_id, attr_name, attr_stor)
332  integer(i_long), intent(in) :: file_ncdr_id
333  character(len=*), intent(in) :: attr_name
334  real(r_single) :: attr_stor
335 
336  integer(i_long) :: attr_len, attr_type, file_ncid
337 
338  call ncdr_check_ncdr_id(file_ncdr_id)
339 
340  file_ncid = ncdr_files(file_ncdr_id)%ncid
341  call ncdr_check_ncid(file_ncid)
342 
343  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
344 
345  call nc_diag_read_assert_global_attr_type(attr_type, nf90_float)
346 
347  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
348 
349  call ncdr_nc_check(nf90_get_att(file_ncid, &
350  nf90_global, &
351  attr_name, &
352  attr_stor))
354 
355  subroutine nc_diag_read_noid_get_global_attr_single_float(attr_name, attr_stor)
356  character(len=*), intent(in) :: attr_name
357  real(r_single) :: attr_stor
358 
362 
363  subroutine nc_diag_read_id_get_global_attr_single_double(file_ncdr_id, attr_name, attr_stor)
364  integer(i_long), intent(in) :: file_ncdr_id
365  character(len=*), intent(in) :: attr_name
366  real(r_double) :: attr_stor
367 
368  integer(i_long) :: attr_len, attr_type, file_ncid
369 
370  call ncdr_check_ncdr_id(file_ncdr_id)
371 
372  file_ncid = ncdr_files(file_ncdr_id)%ncid
373  call ncdr_check_ncid(file_ncid)
374 
375  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
376 
377  call nc_diag_read_assert_global_attr_type(attr_type, nf90_double)
378 
379  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
380 
381  call ncdr_nc_check(nf90_get_att(file_ncid, &
382  nf90_global, &
383  attr_name, &
384  attr_stor))
386 
387  subroutine nc_diag_read_noid_get_global_attr_single_double(attr_name, attr_stor)
388  character(len=*), intent(in) :: attr_name
389  real(r_double) :: attr_stor
390 
394 
395  subroutine nc_diag_read_id_get_global_attr_single_string(file_ncdr_id, attr_name, attr_stor)
396  integer(i_long), intent(in) :: file_ncdr_id
397  character(len=*), intent(in) :: attr_name
398  character(len=*) :: attr_stor
399 
400  integer(i_long) :: attr_len, attr_type, file_ncid
401 
402  call ncdr_check_ncdr_id(file_ncdr_id)
403 
404  file_ncid = ncdr_files(file_ncdr_id)%ncid
405  call ncdr_check_ncid(file_ncid)
406 
407  call nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
408 
409  call nc_diag_read_assert_global_attr_type(attr_type, nf90_char)
410 
411  call nc_diag_read_assert_dims(attr_stor, (/ attr_len /))
412 
413  call ncdr_nc_check(nf90_get_att(file_ncid, &
414  nf90_global, &
415  attr_name, &
416  attr_stor))
418 
419  subroutine nc_diag_read_noid_get_global_attr_single_string(attr_name, attr_stor)
420  character(len=*), intent(in) :: attr_name
421  character(len=*) :: attr_stor
422 
426 end module ncdr_global_attrs_fetch
subroutine nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
subroutine nc_diag_read_id_get_global_attr_1d_byte(file_ncdr_id, attr_name, attr_stor)
subroutine nc_diag_read_id_get_global_attr_single_short(file_ncdr_id, attr_name, attr_stor)
integer, parameter, public i_byte
Definition: ncd_kinds.F90:45
integer, parameter, public i_long
Definition: ncd_kinds.F90:47
subroutine ncdr_nc_check(status)
Definition: ncdr_check.f90:85
subroutine nc_diag_read_assert_dims_alloc_string(var_stor, correct_dims)
subroutine nc_diag_read_id_get_global_attr_single_string(file_ncdr_id, attr_name, attr_stor)
integer(i_long) current_ncdr_id
Definition: ncdr_state.f90:7
type(ncdr_file), dimension(:), allocatable ncdr_files
Definition: ncdr_state.f90:14
subroutine ncdr_check_current_ncdr_id
Definition: ncdr_check.f90:22
subroutine nc_diag_read_id_get_global_attr_1d_short(file_ncdr_id, attr_name, attr_stor)
subroutine ncdr_check_ncid(file_ncid)
Definition: ncdr_check.f90:28
subroutine nc_diag_read_noid_get_global_attr_1d_string(attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_1d_float(attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_single_long(attr_name, attr_stor)
subroutine nc_diag_read_id_get_global_attr_single_float(file_ncdr_id, attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_1d_byte(attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_1d_short(attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_single_byte(attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_single_float(attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_single_string(attr_name, attr_stor)
subroutine nc_diag_read_id_get_global_attr_1d_double(file_ncdr_id, attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_1d_long(attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_single_double(attr_name, attr_stor)
subroutine ncdr_check_ncdr_id(file_ncdr_id)
Definition: ncdr_check.f90:12
subroutine nc_diag_read_assert_global_attr_type(attr_type, correct_attr_type)
integer, parameter, public i_short
Definition: ncd_kinds.F90:46
subroutine nc_diag_read_id_get_global_attr_1d_string(file_ncdr_id, attr_name, attr_stor)
subroutine nc_diag_read_id_get_global_attr_single_byte(file_ncdr_id, attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_1d_double(attr_name, attr_stor)
integer, parameter, public r_double
Definition: ncd_kinds.F90:80
subroutine nc_diag_read_id_get_global_attr_single_double(file_ncdr_id, attr_name, attr_stor)
subroutine nc_diag_read_noid_get_global_attr_single_short(attr_name, attr_stor)
integer, parameter, public r_single
Definition: ncd_kinds.F90:79
subroutine nc_diag_read_id_get_global_attr_single_long(file_ncdr_id, attr_name, attr_stor)
subroutine nc_diag_read_id_get_global_attr_1d_float(file_ncdr_id, attr_name, attr_stor)
subroutine nc_diag_read_id_get_global_attr_1d_long(file_ncdr_id, attr_name, attr_stor)