FV3 Bundle
ncdr_alloc_assert.f90
Go to the documentation of this file.
2  ! Allocate if things aren't allocated, or assert that things are
3  ! all good to go.
4  !
5  ! Other parts include just assertion functions (e.g. asserting
6  ! that a variable exists).
9  use ncdr_climsg, only: ncdr_error
12  use netcdf, only: nf90_inquire_attribute, nf90_global, nf90_byte, &
13  nf90_short, nf90_int, nf90_float, nf90_double, nf90_char, &
14  nf90_string
15 
16  implicit none
17 
19  module procedure nc_diag_read_id_assert_var, &
21  end interface nc_diag_read_assert_var
22 
24  module procedure nc_diag_read_id_assert_attr, &
26  end interface nc_diag_read_assert_attr
27 
29  module procedure nc_diag_read_id_assert_global_attr, &
32 
34  ! Note that nc_diag_read_assert_dims_alloc_string is seperate
35  ! since it is rare and conflicts with the non-alloc def.
36  module procedure &
55  end interface nc_diag_read_assert_dims
56 
57  contains
58  function nc_diag_read_id_assert_var(file_ncdr_id, var_name) result(var_index)
59  integer(i_long), intent(in) :: file_ncdr_id
60  character(len=*), intent(in) :: var_name
61 
62  integer(i_long) :: var_index
63 
64  call ncdr_check_ncdr_id(file_ncdr_id)
65 
66  do var_index = 1, ncdr_files(file_ncdr_id)%nvars
67  if (ncdr_files(file_ncdr_id)%vars(var_index)%var_name == var_name) &
68  return
69  end do
70 
71  ! If we didn't find anything, show an error!
72  call ncdr_error("The specified variable '" // var_name // "' does not exist!")
73  end function nc_diag_read_id_assert_var
74 
75  function nc_diag_read_noid_assert_var(var_name) result(var_index)
76  character(len=*), intent(in) :: var_name
77 
78  integer(i_long) :: var_index
79 
81 
82  var_index = nc_diag_read_id_assert_var(current_ncdr_id, var_name)
83  end function nc_diag_read_noid_assert_var
84 
85  subroutine nc_diag_read_id_assert_attr(file_ncdr_id, var_name, attr_name, attr_type, attr_len)
86  integer(i_long), intent(in) :: file_ncdr_id
87  character(len=*), intent(in) :: var_name
88  character(len=*), intent(in) :: attr_name
89  integer(i_long), intent(out) :: attr_type
90  integer(i_long), intent(out) :: attr_len
91 
92  integer(i_long) :: var_id
93 
94  call ncdr_check_ncdr_id(file_ncdr_id)
95 
96  var_id = ncdr_files(file_ncdr_id)%vars( &
97  nc_diag_read_assert_var(file_ncdr_id, var_name) )%var_id
98 
99  call ncdr_nc_check(nf90_inquire_attribute(ncdr_files(file_ncdr_id)%ncid, &
100  var_id, &
101  attr_name, attr_type, attr_len))
102  end subroutine nc_diag_read_id_assert_attr
103 
104  subroutine nc_diag_read_noid_assert_attr(var_name, attr_name, attr_type, attr_len)
105  character(*), intent(in) :: var_name
106  character(len=*), intent(in) :: attr_name
107  integer(i_long), intent(out) :: attr_type
108  integer(i_long), intent(out) :: attr_len
109 
111 
112  call nc_diag_read_id_assert_attr(current_ncdr_id, var_name, attr_name, attr_type, attr_len)
113  end subroutine nc_diag_read_noid_assert_attr
114 
115  subroutine nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
116  integer(i_long), intent(in) :: file_ncdr_id
117  character(len=*), intent(in) :: attr_name
118  integer(i_long), intent(out) :: attr_type
119  integer(i_long), intent(out) :: attr_len
120 
121  call ncdr_check_ncdr_id(file_ncdr_id)
122 
123  call ncdr_nc_check(nf90_inquire_attribute(ncdr_files(file_ncdr_id)%ncid, &
124  nf90_global, &
125  attr_name, attr_type, attr_len))
127 
128  subroutine nc_diag_read_noid_assert_global_attr(attr_name, attr_type, attr_len)
129  character(len=*), intent(in) :: attr_name
130  integer(i_long), intent(out) :: attr_type
131  integer(i_long), intent(out) :: attr_len
132 
134 
135  call nc_diag_read_id_assert_global_attr(current_ncdr_id, attr_name, attr_type, attr_len)
137 
138  subroutine nc_diag_read_assert_var_type(var_type, correct_var_type)
139  integer(i_long) :: var_type
140  integer(i_long) :: correct_var_type
141 
142  if (var_type /= correct_var_type) &
143  call ncdr_error("Mismatched type for variable! Got " // &
145  " when " // &
146  nc_diag_read_get_type_str(correct_var_type) // &
147  " was expected for the variable!")
148  end subroutine nc_diag_read_assert_var_type
149 
150  subroutine nc_diag_read_assert_attr_type(attr_type, correct_attr_type)
151  integer(i_long) :: attr_type
152  integer(i_long) :: correct_attr_type
153 
154  if (attr_type /= correct_attr_type) &
155  call ncdr_error("Mismatched type for attribute! Got " // &
156  nc_diag_read_get_type_str(attr_type) // &
157  " when " // &
158  nc_diag_read_get_type_str(correct_attr_type) // &
159  " was expected for the attribute!")
160  end subroutine nc_diag_read_assert_attr_type
161 
162  subroutine nc_diag_read_assert_global_attr_type(attr_type, correct_attr_type)
163  integer(i_long) :: attr_type
164  integer(i_long) :: correct_attr_type
165 
166  if (attr_type /= correct_attr_type) &
167  call ncdr_error("Mismatched type for global attribute! Got " // &
168  nc_diag_read_get_type_str(attr_type) // &
169  " when " // &
170  nc_diag_read_get_type_str(correct_attr_type) // &
171  " was expected for the global attribute!")
173 
174  function nc_diag_read_get_type_str(var_type) result(type_str)
175  integer(i_long) :: var_type
176  character(len=:), allocatable :: type_str
177 
178  if (var_type == nf90_byte) then
179  type_str = "NF90_BYTE"
180  else if (var_type == nf90_short) then
181  type_str = "NF90_SHORT"
182  else if (var_type == nf90_int) then
183  type_str = "NF90_INT"
184  else if (var_type == nf90_float) then
185  type_str = "NF90_FLOAT"
186  else if (var_type == nf90_double) then
187  type_str = "NF90_DOUBLE"
188  else if (var_type == nf90_char) then
189  type_str = "NF90_CHAR"
190  else if (var_type == nf90_string) then
191  type_str = "NF90_STRING (not supported)"
192  else
193  type_str = "(unknown type)"
194  end if
195  end function nc_diag_read_get_type_str
196 
197  subroutine nc_diag_read_assert_var_ndims(var_ndims, correct_var_ndims)
198  integer(i_long) :: var_ndims
199  integer(i_long) :: correct_var_ndims
200 
201  if (var_ndims /= correct_var_ndims) &
202  call ncdr_error("Mismatched dimensions for variable!")
203  end subroutine nc_diag_read_assert_var_ndims
204 
205  !-------------------------------------------------------------
206  ! Variable allocation and assertion subroutines
207  !-------------------------------------------------------------
208  subroutine nc_diag_read_assert_dims_string(var_stor, correct_dims)
209  character(len=*), intent(in) :: var_stor
210  integer(i_long), dimension(:), intent(in) :: correct_dims
211  integer(i_long), parameter :: correct_ndims = 1
212 
213  if (size(correct_dims) /= correct_ndims) &
214  call ncdr_error("Invalid number of dimensions for variable!")
215  if (len(var_stor) < correct_dims(1)) &
216  call ncdr_error("Mismatched dimensions for variable storage!")
217  end subroutine nc_diag_read_assert_dims_string
218 
219  subroutine nc_diag_read_assert_dims_single_byte(var_stor, correct_dims)
220  integer(i_byte), intent(in) :: var_stor
221  integer(i_long), dimension(:), intent(in) :: correct_dims
222  integer(i_long), parameter :: correct_ndims = 1
223 
224  if (size(correct_dims) /= correct_ndims) &
225  call ncdr_error("Invalid number of dimensions for variable!")
226  if (correct_dims(1) /= 1) &
227  call ncdr_error("Mismatched dimensions for variable storage!")
229 
230  subroutine nc_diag_read_assert_dims_single_short(var_stor, correct_dims)
231  integer(i_short), intent(in) :: var_stor
232  integer(i_long), dimension(:), intent(in) :: correct_dims
233  integer(i_long), parameter :: correct_ndims = 1
234 
235  if (size(correct_dims) /= correct_ndims) &
236  call ncdr_error("Invalid number of dimensions for variable!")
237  if (correct_dims(1) /= 1) &
238  call ncdr_error("Mismatched dimensions for variable storage!")
240 
241  subroutine nc_diag_read_assert_dims_single_long(var_stor, correct_dims)
242  integer(i_long), intent(in) :: var_stor
243  integer(i_long), dimension(:), intent(in) :: correct_dims
244  integer(i_long), parameter :: correct_ndims = 1
245 
246  if (size(correct_dims) /= correct_ndims) &
247  call ncdr_error("Invalid number of dimensions for variable!")
248  if (correct_dims(1) /= 1) &
249  call ncdr_error("Mismatched dimensions for variable storage!")
251 
252  subroutine nc_diag_read_assert_dims_single_float(var_stor, correct_dims)
253  real(r_single) , intent(in) :: var_stor
254  integer(i_long), dimension(:), intent(in) :: correct_dims
255  integer(i_long), parameter :: correct_ndims = 1
256 
257  if (size(correct_dims) /= correct_ndims) &
258  call ncdr_error("Invalid number of dimensions for variable!")
259  if (correct_dims(1) /= 1) &
260  call ncdr_error("Mismatched dimensions for variable storage!")
262 
263  subroutine nc_diag_read_assert_dims_single_double(var_stor, correct_dims)
264  real(r_double) , intent(in) :: var_stor
265  integer(i_long), dimension(:), intent(in) :: correct_dims
266  integer(i_long), parameter :: correct_ndims = 1
267 
268  if (size(correct_dims) /= correct_ndims) &
269  call ncdr_error("Invalid number of dimensions for variable!")
270  if (correct_dims(1) /= 1) &
271  call ncdr_error("Mismatched dimensions for variable storage!")
273 
274  subroutine nc_diag_read_assert_dims_alloc_string(var_stor, correct_dims)
275  character(len=:),allocatable,intent(inout) :: var_stor
276  integer(i_long), dimension(:), intent(in) :: correct_dims
277  integer(i_long), parameter :: correct_ndims = 1
278 
279  ! If allocated, make sure the dimensions are correct.
280  ! If not, go ahead and allocate it ourselves.
281  if (allocated(var_stor)) then
282  if (size(correct_dims) /= correct_ndims) &
283  call ncdr_error("Invalid number of dimensions for variable!")
284  if (len(var_stor) /= correct_dims(1)) &
285  call ncdr_error("Mismatched dimensions for variable storage!")
286  else
287  allocate(character(len=correct_dims(1)) :: var_stor)
288  end if
290 
291  subroutine nc_diag_read_assert_dims_1d_byte(var_stor, correct_dims)
292  integer(i_byte),dimension(:),allocatable,intent(inout) :: var_stor
293  integer(i_long), dimension(:), intent(in) :: correct_dims
294  integer(i_long), parameter :: correct_ndims = 1
295 
296  ! If allocated, make sure the dimensions are correct.
297  ! If not, go ahead and allocate it ourselves.
298  if (allocated(var_stor)) then
299  if (size(correct_dims) /= correct_ndims) &
300  call ncdr_error("Invalid number of dimensions for variable!")
301  if (any(shape(var_stor) /= correct_dims)) &
302  call ncdr_error("Mismatched dimensions for variable storage!")
303  else
304  allocate(var_stor(correct_dims(1)))
305  end if
306  end subroutine nc_diag_read_assert_dims_1d_byte
307 
308  subroutine nc_diag_read_assert_dims_1d_short(var_stor, correct_dims)
309  integer(i_short),dimension(:),allocatable,intent(inout) :: var_stor
310  integer(i_long), dimension(:), intent(in) :: correct_dims
311  integer(i_long), parameter :: correct_ndims = 1
312 
313  ! If allocated, make sure the dimensions are correct.
314  ! If not, go ahead and allocate it ourselves.
315  if (allocated(var_stor)) then
316  if (size(correct_dims) /= correct_ndims) &
317  call ncdr_error("Invalid number of dimensions for variable!")
318  if (any(shape(var_stor) /= correct_dims)) &
319  call ncdr_error("Mismatched dimensions for variable storage!")
320  else
321  allocate(var_stor(correct_dims(1)))
322  end if
323  end subroutine nc_diag_read_assert_dims_1d_short
324 
325  subroutine nc_diag_read_assert_dims_1d_long(var_stor, correct_dims)
326  integer(i_long),dimension(:),allocatable,intent(inout) :: var_stor
327  integer(i_long), dimension(:), intent(in) :: correct_dims
328  integer(i_long), parameter :: correct_ndims = 1
329 
330  ! If allocated, make sure the dimensions are correct.
331  ! If not, go ahead and allocate it ourselves.
332  if (allocated(var_stor)) then
333  if (size(correct_dims) /= correct_ndims) &
334  call ncdr_error("Invalid number of dimensions for variable!")
335  if (any(shape(var_stor) /= correct_dims)) &
336  call ncdr_error("Mismatched dimensions for variable storage!")
337  else
338  allocate(var_stor(correct_dims(1)))
339  end if
340  end subroutine nc_diag_read_assert_dims_1d_long
341 
342  subroutine nc_diag_read_assert_dims_1d_float(var_stor, correct_dims)
343  real(r_single),dimension(:),allocatable,intent(inout) :: var_stor
344  integer(i_long), dimension(:), intent(in) :: correct_dims
345  integer(i_long), parameter :: correct_ndims = 1
346 
347  ! If allocated, make sure the dimensions are correct.
348  ! If not, go ahead and allocate it ourselves.
349  if (allocated(var_stor)) then
350  if (size(correct_dims) /= correct_ndims) &
351  call ncdr_error("Invalid number of dimensions for variable!")
352  if (any(shape(var_stor) /= correct_dims)) &
353  call ncdr_error("Mismatched dimensions for variable storage!")
354  else
355  allocate(var_stor(correct_dims(1)))
356  end if
357  end subroutine nc_diag_read_assert_dims_1d_float
358 
359  subroutine nc_diag_read_assert_dims_1d_double(var_stor, correct_dims)
360  real(r_double),dimension(:),allocatable,intent(inout) :: var_stor
361  integer(i_long), dimension(:), intent(in) :: correct_dims
362  integer(i_long), parameter :: correct_ndims = 1
363 
364  ! If allocated, make sure the dimensions are correct.
365  ! If not, go ahead and allocate it ourselves.
366  if (allocated(var_stor)) then
367  if (size(correct_dims) /= correct_ndims) &
368  call ncdr_error("Invalid number of dimensions for variable!")
369  if (any(shape(var_stor) /= correct_dims)) &
370  call ncdr_error("Mismatched dimensions for variable storage!")
371  else
372  allocate(var_stor(correct_dims(1)))
373  end if
375 
376  subroutine nc_diag_read_assert_dims_1d_string(var_stor, correct_dims)
377  character(len=:),dimension(:),allocatable,intent(inout) :: var_stor
378  integer(i_long), dimension(:), intent(in) :: correct_dims
379  integer(i_long), parameter :: correct_ndims = 2
380 
381  ! If allocated, make sure the dimensions are correct.
382  ! If not, go ahead and allocate it ourselves.
383  if (allocated(var_stor)) then
384  if (size(correct_dims) /= correct_ndims) &
385  call ncdr_error("Invalid number of dimensions for variable!")
386  if (len(var_stor) /= correct_dims(1)) &
387  call ncdr_error("Mismatched dimensions for variable storage!")
388  if (size(var_stor) /= correct_dims(2)) &
389  call ncdr_error("Mismatched dimensions for variable storage!")
390  else
391  allocate(character(len=correct_dims(1)) :: var_stor(correct_dims(2)))
392  end if
394 
395  subroutine nc_diag_read_assert_dims_2d_byte(var_stor, correct_dims)
396  integer(i_byte),dimension(:,:),allocatable,intent(inout):: var_stor
397  integer(i_long), dimension(:), intent(in) :: correct_dims
398  integer(i_long), parameter :: correct_ndims = 2
399 
400  ! If allocated, make sure the dimensions are correct.
401  ! If not, go ahead and allocate it ourselves.
402  if (allocated(var_stor)) then
403  if (size(correct_dims) /= correct_ndims) &
404  call ncdr_error("Invalid number of dimensions for variable!")
405  if (any(shape(var_stor) /= correct_dims)) &
406  call ncdr_error("Mismatched dimensions for variable storage!")
407  else
408  allocate(var_stor(correct_dims(1), correct_dims(2)))
409  end if
410  end subroutine nc_diag_read_assert_dims_2d_byte
411 
412  subroutine nc_diag_read_assert_dims_2d_short(var_stor, correct_dims)
413  integer(i_short),dimension(:,:),allocatable,intent(inout):: var_stor
414  integer(i_long), dimension(:), intent(in) :: correct_dims
415  integer(i_long), parameter :: correct_ndims = 2
416 
417  ! If allocated, make sure the dimensions are correct.
418  ! If not, go ahead and allocate it ourselves.
419  if (allocated(var_stor)) then
420  if (size(correct_dims) /= correct_ndims) &
421  call ncdr_error("Invalid number of dimensions for variable!")
422  if (any(shape(var_stor) /= correct_dims)) &
423  call ncdr_error("Mismatched dimensions for variable storage!")
424  else
425  allocate(var_stor(correct_dims(1), correct_dims(2)))
426  end if
427  end subroutine nc_diag_read_assert_dims_2d_short
428 
429  subroutine nc_diag_read_assert_dims_2d_long(var_stor, correct_dims)
430  integer(i_long),dimension(:,:),allocatable,intent(inout):: var_stor
431  integer(i_long), dimension(:), intent(in) :: correct_dims
432  integer(i_long), parameter :: correct_ndims = 2
433 
434  ! If allocated, make sure the dimensions are correct.
435  ! If not, go ahead and allocate it ourselves.
436  if (allocated(var_stor)) then
437  if (size(correct_dims) /= correct_ndims) &
438  call ncdr_error("Invalid number of dimensions for variable!")
439  if (any(shape(var_stor) /= correct_dims)) &
440  call ncdr_error("Mismatched dimensions for variable storage!")
441  else
442  allocate(var_stor(correct_dims(1), correct_dims(2)))
443  end if
444  end subroutine nc_diag_read_assert_dims_2d_long
445 
446  subroutine nc_diag_read_assert_dims_2d_float(var_stor, correct_dims)
447  real(r_single),dimension(:,:),allocatable,intent(inout):: var_stor
448  integer(i_long), dimension(:), intent(in) :: correct_dims
449  integer(i_long), parameter :: correct_ndims = 2
450 
451  ! If allocated, make sure the dimensions are correct.
452  ! If not, go ahead and allocate it ourselves.
453  if (allocated(var_stor)) then
454  if (size(correct_dims) /= correct_ndims) &
455  call ncdr_error("Invalid number of dimensions for variable!")
456  if (any(shape(var_stor) /= correct_dims)) &
457  call ncdr_error("Mismatched dimensions for variable storage!")
458  else
459  allocate(var_stor(correct_dims(1), correct_dims(2)))
460  end if
461  end subroutine nc_diag_read_assert_dims_2d_float
462 
463  subroutine nc_diag_read_assert_dims_2d_double(var_stor, correct_dims)
464  real(r_double),dimension(:,:),allocatable,intent(inout):: var_stor
465  integer(i_long), dimension(:), intent(in) :: correct_dims
466  integer(i_long), parameter :: correct_ndims = 2
467 
468  ! If allocated, make sure the dimensions are correct.
469  ! If not, go ahead and allocate it ourselves.
470  if (allocated(var_stor)) then
471  if (size(correct_dims) /= correct_ndims) &
472  call ncdr_error("Invalid number of dimensions for variable!")
473  if (any(shape(var_stor) /= correct_dims)) &
474  call ncdr_error("Mismatched dimensions for variable storage!")
475  else
476  allocate(var_stor(correct_dims(1), correct_dims(2)))
477  end if
479 
480  subroutine nc_diag_read_assert_dims_2d_string(var_stor, correct_dims)
481  character(len=:),dimension(:,:),allocatable,intent(inout):: var_stor
482  integer(i_long), dimension(:), intent(in) :: correct_dims
483  integer(i_long), parameter :: correct_ndims = 3
484 
485  ! If allocated, make sure the dimensions are correct.
486  ! If not, go ahead and allocate it ourselves.
487  if (allocated(var_stor)) then
488  if (size(correct_dims) /= correct_ndims) &
489  call ncdr_error("Invalid number of dimensions for variable!")
490  if (len(var_stor) /= correct_dims(1)) &
491  call ncdr_error("Mismatched dimensions for variable storage!")
492  if (any(shape(var_stor) /= correct_dims(2:3))) &
493  call ncdr_error("Mismatched dimensions for variable storage!")
494  else
495  allocate(character(len=correct_dims(1)) :: var_stor(correct_dims(2), correct_dims(3)))
496  end if
498 end module ncdr_alloc_assert
subroutine nc_diag_read_id_assert_global_attr(file_ncdr_id, attr_name, attr_type, attr_len)
integer, parameter, public i_byte
Definition: ncd_kinds.F90:45
character(len=:) function, allocatable nc_diag_read_get_type_str(var_type)
subroutine nc_diag_read_noid_assert_attr(var_name, attr_name, attr_type, attr_len)
subroutine nc_diag_read_noid_assert_global_attr(attr_name, attr_type, attr_len)
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_single_float(var_stor, correct_dims)
subroutine nc_diag_read_assert_dims_2d_float(var_stor, correct_dims)
subroutine nc_diag_read_assert_dims_alloc_string(var_stor, correct_dims)
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_assert_dims_2d_long(var_stor, correct_dims)
subroutine nc_diag_read_assert_dims_2d_short(var_stor, correct_dims)
subroutine nc_diag_read_id_assert_attr(file_ncdr_id, var_name, attr_name, attr_type, attr_len)
subroutine nc_diag_read_assert_dims_2d_double(var_stor, correct_dims)
integer(i_long) function nc_diag_read_id_assert_var(file_ncdr_id, var_name)
subroutine nc_diag_read_assert_dims_1d_byte(var_stor, correct_dims)
subroutine ncdr_check_ncdr_id(file_ncdr_id)
Definition: ncdr_check.f90:12
subroutine nc_diag_read_assert_dims_single_long(var_stor, correct_dims)
subroutine nc_diag_read_assert_global_attr_type(attr_type, correct_attr_type)
subroutine nc_diag_read_assert_dims_1d_short(var_stor, correct_dims)
integer, parameter, public i_short
Definition: ncd_kinds.F90:46
subroutine nc_diag_read_assert_dims_single_byte(var_stor, correct_dims)
subroutine nc_diag_read_assert_dims_single_short(var_stor, correct_dims)
subroutine nc_diag_read_assert_dims_2d_string(var_stor, correct_dims)
subroutine nc_diag_read_assert_attr_type(attr_type, correct_attr_type)
subroutine ncdr_error(err)
Definition: ncdr_climsg.F90:13
subroutine nc_diag_read_assert_dims_1d_string(var_stor, correct_dims)
subroutine nc_diag_read_assert_dims_2d_byte(var_stor, correct_dims)
integer, parameter, public r_double
Definition: ncd_kinds.F90:80
integer, parameter, public r_single
Definition: ncd_kinds.F90:79
subroutine nc_diag_read_assert_dims_string(var_stor, correct_dims)
subroutine nc_diag_read_assert_dims_single_double(var_stor, correct_dims)
subroutine nc_diag_read_assert_var_type(var_type, correct_var_type)
subroutine nc_diag_read_assert_var_ndims(var_ndims, correct_var_ndims)
subroutine nc_diag_read_assert_dims_1d_long(var_stor, correct_dims)
subroutine nc_diag_read_assert_dims_1d_float(var_stor, correct_dims)
integer(i_long) function nc_diag_read_noid_assert_var(var_name)
subroutine nc_diag_read_assert_dims_1d_double(var_stor, correct_dims)