MODFLOW 6  version 6.7.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 33 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 301 of file ArrayReaders.f90.

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

526  ! -- dummy
527  integer(I4B), intent(in) :: iu, iout
528  integer(I4B), intent(in) :: ncol, nrow, nlay, nval
529  real(DP), dimension(nval), intent(inout) :: darr
530  character(len=*), intent(in) :: aname
531  integer(I4B), intent(in) :: ndim ! dis%ndim
532  integer(I4B), intent(in) :: k1, k2
533  ! -- local
534  !
535  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 396 of file ArrayReaders.f90.

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

490  integer(I4B), intent(in) :: iu
491  integer(I4B), intent(in) :: iout
492  integer(I4B), intent(in) :: ndim
493  integer(I4B), intent(in) :: ncol
494  integer(I4B), intent(in) :: nrow
495  integer(I4B), intent(in) :: nlay
496  integer(I4B), intent(in) :: k1, k2
497  real(DP), dimension(ncol, nrow, nlay), intent(inout) :: darr
498  character(len=*), intent(in) :: aname
499  ! -- local
500  integer(I4B) :: k, kk
501  !
502  do k = k1, k2
503  if (k <= 0) then
504  kk = 1
505  else
506  kk = k
507  end if
508  call read_array_dbl2d(iu, darr(:, :, kk), aname, ndim, ncol, nrow, iout, k)
509  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 512 of file ArrayReaders.f90.

513  integer(I4B), intent(in) :: iu
514  integer(I4B), intent(in) :: iout
515  integer(I4B), intent(in) :: ndim
516  integer(I4B), intent(in) :: nvals
517  real(DP), dimension(nvals, 1, 1), intent(inout) :: darr
518  character(len=*), intent(in) :: aname
519  ! -- local
520  !
521  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 65 of file ArrayReaders.f90.

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

287  ! -- dummy
288  integer(I4B), intent(in) :: iu, iout
289  integer(I4B), intent(in) :: ncol, nrow, nlay, nval
290  integer(I4B), dimension(nval), intent(inout) :: iarr
291  character(len=*), intent(in) :: aname
292  integer(I4B), intent(in) :: ndim ! dis%ndim
293  integer(I4B), intent(in) :: k1, k2
294  ! -- local
295  !
296  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 159 of file ArrayReaders.f90.

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

252  integer(I4B), intent(in) :: iu
253  integer(I4B), intent(in) :: iout
254  integer(I4B), intent(in) :: ndim
255  integer(I4B), intent(in) :: ncol
256  integer(I4B), intent(in) :: nrow
257  integer(I4B), intent(in) :: nlay
258  integer(I4B), intent(in) :: k1, k2
259  integer(I4B), dimension(ncol, nrow, nlay), intent(inout) :: iarr
260  character(len=*), intent(in) :: aname
261  ! -- local
262  integer(I4B) :: k, kk
263  do k = k1, k2
264  if (k <= 0) then
265  kk = 1
266  else
267  kk = k
268  end if
269  call read_array_int2d(iu, iarr(:, :, kk), aname, ndim, ncol, nrow, iout, k)
270  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 273 of file ArrayReaders.f90.

274  integer(I4B), intent(in) :: iu
275  integer(I4B), intent(in) :: iout
276  integer(I4B), intent(in) :: ndim
277  integer(I4B), intent(in) :: nvals
278  integer(I4B), dimension(nvals, 1, 1), intent(inout) :: iarr
279  character(len=*), intent(in) :: aname
280  ! -- local
281  !
282  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: