MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
arrayreadersmodule::readarray Interface Reference
Collaboration diagram for arrayreadersmodule::readarray:
Collaboration graph

Private Member Functions

subroutine read_array_int1d (iu, iarr, aname, ndim, jj, iout, k)
 
subroutine read_array_int2d (iu, iarr, aname, ndim, jj, ii, iout, k)
 
subroutine read_array_int3d (iu, iarr, aname, ndim, ncol, nrow, nlay, iout, k1, k2)
 
subroutine read_array_dbl1d (iu, darr, aname, ndim, jj, iout, k)
 
subroutine read_array_dbl2d (iu, darr, aname, ndim, jj, ii, iout, k)
 
subroutine read_array_dbl3d (iu, darr, aname, ndim, ncol, nrow, nlay, iout, k1, k2)
 
subroutine read_array_dbl1d_layered (iu, darr, aname, ndim, ncol, nrow, nlay, nval, iout, k1, k2)
 
subroutine read_array_int1d_layered (iu, iarr, aname, ndim, ncol, nrow, nlay, nval, iout, k1, k2)
 
subroutine read_array_dbl3d_all (iu, darr, aname, ndim, nvals, iout)
 
subroutine read_array_int3d_all (iu, iarr, aname, ndim, nvals, iout)
 

Detailed Description

Definition at line 20 of file ArrayReaders.f90.

Member Function/Subroutine Documentation

◆ read_array_dbl1d()

subroutine arrayreadersmodule::readarray::read_array_dbl1d ( integer(i4b), intent(in)  iu,
real(dp), dimension(jj), intent(inout)  darr,
character(len=*), intent(in)  aname,
integer(i4b), intent(in)  ndim,
integer(i4b), intent(in)  jj,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  k 
)
private

Definition at line 288 of file ArrayReaders.f90.

289  ! -- dummy
290  integer(I4B), intent(in) :: iu, iout
291  integer(I4B), intent(in) :: jj
292  real(DP), dimension(jj), intent(inout) :: darr
293  character(len=*), intent(in) :: aname
294  integer(I4B), intent(in) :: ndim ! dis%ndim
295  integer(I4B), intent(in) :: k ! layer number; 0 to not print
296  ! -- local
297  logical(LGP) :: isok
298  integer(I4B) :: j, iclose, iprn, locat, ncpl, ndig
299  real(DP) :: cnstnt
300  logical :: prowcolnum
301  character(len=100) :: prfmt
302  integer(I4B) :: istat
303  integer(I4B) :: nvalt, nval
304  character(len=30) :: arrname
305  character(len=MAXCHARLEN) :: ermsgr
306  ! -- formats
307 2 format(/, 1x, a, ' = ', g14.7, ' FOR LAYER ', i0)
308 3 format(/, 1x, a, ' = ', g14.7)
309  !
310  ! -- Read array control record.
311  call read_control_dbl(iu, iout, aname, locat, cnstnt, iclose, iprn)
312  !
313  ! -- Read or assign array data.
314  if (locat == 0) then
315  ! -- Assign constant
316  do j = 1, jj
317  darr(j) = cnstnt
318  end do
319  if (iout > 0) then
320  if (k > 0) then
321  write (iout, 2) trim(aname), cnstnt, k
322  else
323  write (iout, 3) trim(aname), cnstnt
324  end if
325  end if
326  elseif (locat > 0) then
327  ! -- Read data as text
328  read (locat, *, iostat=istat, iomsg=ermsgr) (darr(j), j=1, jj)
329  if (istat /= 0) then
330  arrname = adjustl(aname)
331  errmsg = "Error reading data for array '"// &
332  trim(adjustl(arrname))//"'. "//trim(adjustl(ermsgr))
333  call store_error(errmsg)
334  call store_error_unit(locat)
335  end if
336  do j = 1, jj
337  darr(j) = darr(j) * cnstnt
338  end do
339  if (iclose == 1) then
340  close (locat)
341  end if
342  else
343  ! -- Read data as binary
344  locat = -locat
345  nvalt = 0
346  do
347  call read_binary_header(locat, iout, aname, nval)
348  isok = check_binary_size(nval, nvalt, size(darr), aname, locat)
349  if (isok .EQV. .false.) exit
350  read (locat, iostat=istat, iomsg=ermsgr) &
351  (darr(j), j=nvalt + 1, nvalt + nval)
352  if (istat /= 0) then
353  arrname = adjustl(aname)
354  errmsg = "Error reading data for array '"// &
355  trim(adjustl(arrname))//"'. "//trim(adjustl(ermsgr))
356  call store_error(errmsg)
357  call store_error_unit(locat)
358  end if
359  nvalt = nvalt + nval
360  if (nvalt == size(darr)) exit
361  end do
362  !
363  ! -- multiply entire array by constant
364  do j = 1, jj
365  darr(j) = darr(j) * cnstnt
366  end do
367  !
368  ! -- close the file
369  if (iclose == 1) then
370  close (locat)
371  end if
372  end if
373  !
374  ! -- Print array if requested.
375  if (iprn >= 0 .and. locat /= 0) then
376  prowcolnum = (ndim == 3)
377  call build_format_dbl(iprn, prfmt, prowcolnum, ncpl, ndig)
378  call print_array_dbl(darr, aname, iout, jj, 1, k, prfmt, ncpl, ndig, &
379  prowcolnum)
380  end if
Here is the call graph for this function:

◆ read_array_dbl1d_layered()

subroutine arrayreadersmodule::readarray::read_array_dbl1d_layered ( integer(i4b), intent(in)  iu,
real(dp), dimension(nval), intent(inout)  darr,
character(len=*), intent(in)  aname,
integer(i4b), intent(in)  ndim,
integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
integer(i4b), intent(in)  nlay,
integer(i4b), intent(in)  nval,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  k1,
integer(i4b), intent(in)  k2 
)
private

Definition at line 511 of file ArrayReaders.f90.

513  ! -- dummy
514  integer(I4B), intent(in) :: iu, iout
515  integer(I4B), intent(in) :: ncol, nrow, nlay, nval
516  real(DP), dimension(nval), intent(inout) :: darr
517  character(len=*), intent(in) :: aname
518  integer(I4B), intent(in) :: ndim ! dis%ndim
519  integer(I4B), intent(in) :: k1, k2
520  ! -- local
521  !
522  call read_array_dbl3d(iu, darr, aname, ndim, ncol, nrow, nlay, iout, k1, k2)
Here is the call graph for this function:

◆ read_array_dbl2d()

subroutine arrayreadersmodule::readarray::read_array_dbl2d ( integer(i4b), intent(in)  iu,
real(dp), dimension(jj, ii), intent(inout)  darr,
character(len=*), intent(in)  aname,
integer(i4b), intent(in)  ndim,
integer(i4b), intent(in)  jj,
integer(i4b), intent(in)  ii,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  k 
)
private

Definition at line 383 of file ArrayReaders.f90.

384  ! -- dummy
385  integer(I4B), intent(in) :: iu, iout
386  integer(I4B), intent(in) :: jj, ii
387  real(DP), dimension(jj, ii), intent(inout) :: darr
388  character(len=*), intent(in) :: aname
389  integer(I4B), intent(in) :: ndim ! dis%ndim
390  integer(I4B), intent(in) :: k ! layer number; 0 to not print
391  ! -- local
392  logical(LGP) :: isok
393  integer(I4B) :: i, iclose, iprn, j, locat, ncpl, ndig
394  integer(I4B) :: nval
395  real(DP) :: cnstnt
396  logical :: prowcolnum
397  character(len=100) :: prfmt
398  integer(I4B) :: istat
399  character(len=30) :: arrname
400  character(len=MAXCHARLEN) :: ermsgr
401  ! -- formats
402 2 format(/, 1x, a, ' = ', g14.7, ' FOR LAYER ', i0)
403 3 format(/, 1x, a, ' = ', g14.7)
404  !
405  ! -- Read array control record.
406  call read_control_dbl(iu, iout, aname, locat, cnstnt, iclose, iprn)
407  !
408  ! -- Read or assign array data.
409  if (locat == 0) then
410  ! -- Assign constant
411  do i = 1, ii
412  do j = 1, jj
413  darr(j, i) = cnstnt
414  end do
415  end do
416  if (iout > 0) then
417  if (k > 0) then
418  write (iout, 2) trim(aname), cnstnt, k
419  else
420  write (iout, 3) trim(aname), cnstnt
421  end if
422  end if
423  elseif (locat > 0) then
424  ! -- Read data as text
425  do i = 1, ii
426  read (locat, *, iostat=istat, iomsg=ermsgr) (darr(j, i), j=1, jj)
427  if (istat /= 0) then
428  arrname = adjustl(aname)
429  errmsg = "Error reading data for array '"// &
430  trim(adjustl(arrname))//"'. "//trim(adjustl(ermsgr))
431  call store_error(errmsg)
432  call store_error_unit(locat)
433  end if
434  do j = 1, jj
435  darr(j, i) = darr(j, i) * cnstnt
436  end do
437  end do
438  if (iclose == 1) then
439  close (locat)
440  end if
441  else
442  ! -- Read data as binary
443  locat = -locat
444  call read_binary_header(locat, iout, aname, nval)
445  isok = check_binary_size(nval, 0, size(darr), aname, locat)
446  if (isok) then
447  do i = 1, ii
448  read (locat, iostat=istat, iomsg=ermsgr) (darr(j, i), j=1, jj)
449  if (istat /= 0) then
450  arrname = adjustl(aname)
451  errmsg = "Error reading data for array '"// &
452  trim(adjustl(arrname))//"'. "//trim(adjustl(ermsgr))
453  call store_error(errmsg)
454  call store_error_unit(locat)
455  end if
456  do j = 1, jj
457  darr(j, i) = darr(j, i) * cnstnt
458  end do
459  end do
460  end if
461  if (iclose == 1) then
462  close (locat)
463  end if
464  end if
465  !
466  ! -- Print array if requested.
467  if (iprn >= 0 .and. locat /= 0) then
468  prowcolnum = (ndim == 3)
469  call build_format_dbl(iprn, prfmt, prowcolnum, ncpl, ndig)
470  call print_array_dbl(darr, aname, iout, jj, ii, k, prfmt, ncpl, &
471  ndig, prowcolnum)
472  end if
Here is the call graph for this function:

◆ read_array_dbl3d()

subroutine arrayreadersmodule::readarray::read_array_dbl3d ( integer(i4b), intent(in)  iu,
real(dp), dimension(ncol, nrow, nlay), intent(inout)  darr,
character(len=*), intent(in)  aname,
integer(i4b), intent(in)  ndim,
integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
integer(i4b), intent(in)  nlay,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  k1,
integer(i4b), intent(in)  k2 
)
private

Definition at line 475 of file ArrayReaders.f90.

477  integer(I4B), intent(in) :: iu
478  integer(I4B), intent(in) :: iout
479  integer(I4B), intent(in) :: ndim
480  integer(I4B), intent(in) :: ncol
481  integer(I4B), intent(in) :: nrow
482  integer(I4B), intent(in) :: nlay
483  integer(I4B), intent(in) :: k1, k2
484  real(DP), dimension(ncol, nrow, nlay), intent(inout) :: darr
485  character(len=*), intent(in) :: aname
486  ! -- local
487  integer(I4B) :: k, kk
488  !
489  do k = k1, k2
490  if (k <= 0) then
491  kk = 1
492  else
493  kk = k
494  end if
495  call read_array_dbl2d(iu, darr(:, :, kk), aname, ndim, ncol, nrow, iout, k)
496  end do
Here is the call graph for this function:

◆ read_array_dbl3d_all()

subroutine arrayreadersmodule::readarray::read_array_dbl3d_all ( integer(i4b), intent(in)  iu,
real(dp), dimension(nvals, 1, 1), intent(inout)  darr,
character(len=*), intent(in)  aname,
integer(i4b), intent(in)  ndim,
integer(i4b), intent(in)  nvals,
integer(i4b), intent(in)  iout 
)
private

Definition at line 499 of file ArrayReaders.f90.

500  integer(I4B), intent(in) :: iu
501  integer(I4B), intent(in) :: iout
502  integer(I4B), intent(in) :: ndim
503  integer(I4B), intent(in) :: nvals
504  real(DP), dimension(nvals, 1, 1), intent(inout) :: darr
505  character(len=*), intent(in) :: aname
506  ! -- local
507  !
508  call read_array_dbl1d(iu, darr, aname, ndim, nvals, iout, 0)
Here is the call graph for this function:

◆ read_array_int1d()

subroutine arrayreadersmodule::readarray::read_array_int1d ( integer(i4b), intent(in)  iu,
integer(i4b), dimension(jj), intent(inout)  iarr,
character(len=*), intent(in)  aname,
integer(i4b), intent(in)  ndim,
integer(i4b), intent(in)  jj,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  k 
)
private

Definition at line 52 of file ArrayReaders.f90.

53  ! -- dummy
54  integer(I4B), intent(in) :: iu, iout
55  integer(I4B), intent(in) :: jj
56  integer(I4B), dimension(jj), intent(inout) :: iarr
57  character(len=*), intent(in) :: aname
58  integer(I4B), intent(in) :: ndim ! dis%ndim
59  integer(I4B), intent(in) :: k ! layer number; 0 to not print
60  ! -- local
61  logical(LGP) :: isok
62  integer(I4B) :: iclose, iconst, iprn, j, locat, ncpl, ndig
63  integer(I4B) :: nval, nvalt
64  logical :: prowcolnum
65  character(len=100) :: prfmt
66  integer(I4B) :: istat
67  character(len=30) :: arrname
68  character(len=MAXCHARLEN) :: ermsgr
69  ! -- formats
70 2 format(/, 1x, a, ' = ', i0, ' FOR LAYER ', i0)
71 3 format(/, 1x, a, ' = ', i0)
72  !
73  ! -- Read array control record.
74  call read_control_int(iu, iout, aname, locat, iconst, iclose, iprn)
75  !
76  ! -- Read or assign array data.
77  if (locat == 0) then
78  ! -- Assign constant
79  do j = 1, jj
80  iarr(j) = iconst
81  end do
82  if (iout > 0) then
83  if (k > 0) then
84  write (iout, 2) trim(aname), iconst, k
85  else
86  write (iout, 3) trim(aname), iconst
87  end if
88  end if
89  elseif (locat > 0) then
90  ! -- Read data as text
91  read (locat, *, iostat=istat, iomsg=ermsgr) (iarr(j), j=1, jj)
92  if (istat /= 0) then
93  arrname = adjustl(aname)
94  errmsg = "Error reading data for array '"//trim(arrname)// &
95  "'. "//trim(adjustl(ermsgr))
96  call store_error(errmsg)
97  call store_error_unit(locat)
98  end if
99  do j = 1, jj
100  iarr(j) = iarr(j) * iconst
101  end do
102  if (iclose == 1) then
103  close (locat)
104  end if
105  else
106  ! -- Read data as binary
107  locat = -locat
108  nvalt = 0
109  do
110  call read_binary_header(locat, iout, aname, nval)
111  isok = check_binary_size(nval, nvalt, size(iarr), aname, locat)
112  if (isok .EQV. .false.) exit
113  read (locat, iostat=istat, iomsg=ermsgr) &
114  (iarr(j), j=nvalt + 1, nvalt + nval)
115  if (istat /= 0) then
116  arrname = adjustl(aname)
117  errmsg = "Error reading data for array '"//trim(arrname)// &
118  "'. "//trim(adjustl(ermsgr))
119  call store_error(errmsg)
120  call store_error_unit(locat)
121  end if
122  nvalt = nvalt + nval
123  if (nvalt == size(iarr)) exit
124  end do
125  !
126  ! -- multiply array by constant
127  do j = 1, jj
128  iarr(j) = iarr(j) * iconst
129  end do
130  !
131  ! -- close the file
132  if (iclose == 1) then
133  close (locat)
134  end if
135  end if
136  !
137  ! -- Print array if requested.
138  if (iprn >= 0 .and. locat /= 0) then
139  prowcolnum = (ndim == 3)
140  call build_format_int(iprn, prfmt, prowcolnum, ncpl, ndig)
141  call print_array_int(iarr, aname, iout, jj, 1, k, prfmt, ncpl, ndig, &
142  prowcolnum)
143  end if
Here is the call graph for this function:

◆ read_array_int1d_layered()

subroutine arrayreadersmodule::readarray::read_array_int1d_layered ( integer(i4b), intent(in)  iu,
integer(i4b), dimension(nval), intent(inout)  iarr,
character(len=*), intent(in)  aname,
integer(i4b), intent(in)  ndim,
integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
integer(i4b), intent(in)  nlay,
integer(i4b), intent(in)  nval,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  k1,
integer(i4b), intent(in)  k2 
)
private

Definition at line 272 of file ArrayReaders.f90.

274  ! -- dummy
275  integer(I4B), intent(in) :: iu, iout
276  integer(I4B), intent(in) :: ncol, nrow, nlay, nval
277  integer(I4B), dimension(nval), intent(inout) :: iarr
278  character(len=*), intent(in) :: aname
279  integer(I4B), intent(in) :: ndim ! dis%ndim
280  integer(I4B), intent(in) :: k1, k2
281  ! -- local
282  !
283  call read_array_int3d(iu, iarr, aname, ndim, ncol, nrow, nlay, iout, k1, k2)
Here is the call graph for this function:

◆ read_array_int2d()

subroutine arrayreadersmodule::readarray::read_array_int2d ( integer(i4b), intent(in)  iu,
integer(i4b), dimension(jj, ii), intent(inout)  iarr,
character(len=*), intent(in)  aname,
integer(i4b), intent(in)  ndim,
integer(i4b), intent(in)  jj,
integer(i4b), intent(in)  ii,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  k 
)
private

Definition at line 146 of file ArrayReaders.f90.

147  ! -- dummy
148  integer(I4B), intent(in) :: iu, iout
149  integer(I4B), intent(in) :: jj, ii
150  integer(I4B), dimension(jj, ii), intent(inout) :: iarr
151  character(len=*), intent(in) :: aname
152  integer(I4B), intent(in) :: ndim ! dis%ndim
153  integer(I4B), intent(in) :: k ! layer number; 0 to not print
154  ! -- local
155  logical(LGP) :: isok
156  integer(I4B) :: i, iclose, iconst, iprn, j, locat, ncpl, ndig
157  integer(I4B) :: nval
158  logical :: prowcolnum
159  character(len=100) :: prfmt
160  integer(I4B) :: istat
161  character(len=30) :: arrname
162  character(len=MAXCHARLEN) :: ermsgr
163  ! -- formats
164 2 format(/, 1x, a, ' = ', i0, ' FOR LAYER ', i0)
165 3 format(/, 1x, a, ' = ', i0)
166  !
167  ! -- Read array control record.
168  call read_control_int(iu, iout, aname, locat, iconst, iclose, iprn)
169  !
170  ! -- Read or assign array data.
171  if (locat == 0) then
172  ! -- Assign constant
173  do i = 1, ii
174  do j = 1, jj
175  iarr(j, i) = iconst
176  end do
177  end do
178  if (iout > 0) then
179  if (k > 0) then
180  write (iout, 2) trim(aname), iconst, k
181  else
182  write (iout, 3) trim(aname), iconst
183  end if
184  end if
185  elseif (locat > 0) then
186  ! -- Read data as text
187  do i = 1, ii
188  read (locat, *, iostat=istat, iomsg=ermsgr) (iarr(j, i), j=1, jj)
189  if (istat /= 0) then
190  arrname = adjustl(aname)
191  errmsg = "Error reading data for array '"//trim(arrname)// &
192  "'. "//trim(adjustl(ermsgr))
193  call store_error(errmsg)
194  call store_error_unit(locat)
195  end if
196  do j = 1, jj
197  iarr(j, i) = iarr(j, i) * iconst
198  end do
199  end do
200  if (iclose == 1) then
201  close (locat)
202  end if
203  else
204  ! -- Read data as binary
205  locat = -locat
206  call read_binary_header(locat, iout, aname, nval)
207  isok = check_binary_size(nval, 0, size(iarr), aname, locat)
208  if (isok) then
209  do i = 1, ii
210  read (locat, iostat=istat, iomsg=ermsgr) (iarr(j, i), j=1, jj)
211  if (istat /= 0) then
212  arrname = adjustl(aname)
213  errmsg = "Error reading data for array '"//trim(arrname)// &
214  "'. "//trim(adjustl(ermsgr))
215  call store_error(errmsg)
216  call store_error_unit(locat)
217  end if
218  do j = 1, jj
219  iarr(j, i) = iarr(j, i) * iconst
220  end do
221  end do
222  end if
223  if (iclose == 1) then
224  close (locat)
225  end if
226  end if
227  !
228  ! -- Print array if requested.
229  if (iprn >= 0 .and. locat /= 0) then
230  prowcolnum = (ndim == 3)
231  call build_format_int(iprn, prfmt, prowcolnum, ncpl, ndig)
232  call print_array_int(iarr, aname, iout, jj, ii, k, prfmt, ncpl, &
233  ndig, prowcolnum)
234  end if
Here is the call graph for this function:

◆ read_array_int3d()

subroutine arrayreadersmodule::readarray::read_array_int3d ( integer(i4b), intent(in)  iu,
integer(i4b), dimension(ncol, nrow, nlay), intent(inout)  iarr,
character(len=*), intent(in)  aname,
integer(i4b), intent(in)  ndim,
integer(i4b), intent(in)  ncol,
integer(i4b), intent(in)  nrow,
integer(i4b), intent(in)  nlay,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in)  k1,
integer(i4b), intent(in)  k2 
)
private

Definition at line 237 of file ArrayReaders.f90.

239  integer(I4B), intent(in) :: iu
240  integer(I4B), intent(in) :: iout
241  integer(I4B), intent(in) :: ndim
242  integer(I4B), intent(in) :: ncol
243  integer(I4B), intent(in) :: nrow
244  integer(I4B), intent(in) :: nlay
245  integer(I4B), intent(in) :: k1, k2
246  integer(I4B), dimension(ncol, nrow, nlay), intent(inout) :: iarr
247  character(len=*), intent(in) :: aname
248  ! -- local
249  integer(I4B) :: k, kk
250  do k = k1, k2
251  if (k <= 0) then
252  kk = 1
253  else
254  kk = k
255  end if
256  call read_array_int2d(iu, iarr(:, :, kk), aname, ndim, ncol, nrow, iout, k)
257  end do
Here is the call graph for this function:

◆ read_array_int3d_all()

subroutine arrayreadersmodule::readarray::read_array_int3d_all ( integer(i4b), intent(in)  iu,
integer(i4b), dimension(nvals, 1, 1), intent(inout)  iarr,
character(len=*), intent(in)  aname,
integer(i4b), intent(in)  ndim,
integer(i4b), intent(in)  nvals,
integer(i4b), intent(in)  iout 
)
private

Definition at line 260 of file ArrayReaders.f90.

261  integer(I4B), intent(in) :: iu
262  integer(I4B), intent(in) :: iout
263  integer(I4B), intent(in) :: ndim
264  integer(I4B), intent(in) :: nvals
265  integer(I4B), dimension(nvals, 1, 1), intent(inout) :: iarr
266  character(len=*), intent(in) :: aname
267  ! -- local
268  !
269  call read_array_int1d(iu, iarr, aname, ndim, nvals, iout, 0)
Here is the call graph for this function:

The documentation for this interface was generated from the following file: