MODFLOW 6  version 6.6.0.dev0
USGS Modular Hydrologic Model
ncarrayreadermodule Module Reference

This module contains the NCArrayReaderModule. More...

Data Types

interface  netcdf_array_load
 

Functions/Subroutines

logical(lgp) function is_layered (grid)
 does the grid support per layer variables More...
 
subroutine nc_array_load_int1d (int1d, mshape, idt, mf6_input, nc_vars, input_fname, iout, kper)
 Load NetCDF integer 1D array. More...
 
subroutine nc_array_load_int2d (int2d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
 Load NetCDF integer 2D array. More...
 
subroutine nc_array_load_int3d (int3d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
 Load NetCDF integer 3D array. More...
 
subroutine nc_array_load_dbl1d (dbl1d, mshape, idt, mf6_input, nc_vars, input_fname, iout, kper, iaux)
 Load NetCDF double 1D array. More...
 
subroutine nc_array_load_dbl2d (dbl2d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
 Load NetCDF double 2D array. More...
 
subroutine nc_array_load_dbl3d (dbl3d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
 Load NetCDF double 3D array. More...
 
subroutine load_integer1d_type (int1d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 1d integer More...
 
subroutine load_integer1d_layered (int1d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 1d integer layered More...
 
subroutine load_integer2d_type (int2d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 2d integer More...
 
subroutine load_integer2d_layered (int2d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 2d integer layered More...
 
subroutine load_integer3d_type (int3d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 3d integer More...
 
subroutine load_integer3d_layered (int3d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 3d integer layered More...
 
subroutine load_double1d_type (dbl1d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 1d double More...
 
subroutine load_double1d_spd (dbl1d, mf6_input, mshape, idt, nc_vars, iper, input_fname, iaux)
 load type 1d double More...
 
subroutine load_double1d_layered (dbl1d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 1d double layered More...
 
subroutine load_double1d_layered_spd (dbl1d, mf6_input, mshape, idt, nc_vars, iper, input_fname, iaux)
 load type 1d double layered More...
 
subroutine load_double2d_type (dbl2d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 2d double More...
 
subroutine load_double2d_layered (dbl2d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 2d double layered More...
 
subroutine load_double3d_type (dbl3d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 3d double More...
 
subroutine load_double3d_layered (dbl3d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 3d double layered More...
 

Detailed Description

This module defines the netcdf_array_load interface which can read layered (UGRID) and non-layered (STRUCTURED) netcdf arrays stored in modflow6 designated input variables.

Function/Subroutine Documentation

◆ is_layered()

logical(lgp) function ncarrayreadermodule::is_layered ( character(len=*), intent(in)  grid)
private

Definition at line 35 of file NCArrayReader.f90.

36  character(len=*), intent(in) :: grid
37  logical(LGP) :: layered
38  !
39  select case (grid)
40  case ('LAYERED MESH')
41  layered = .true.
42  case ('STRUCTURED')
43  layered = .false.
44  case default
45  layered = .false.
46  end select
47  !
48  ! -- return
49  return
Here is the caller graph for this function:

◆ load_double1d_layered()

subroutine ncarrayreadermodule::load_double1d_layered ( real(dp), dimension(:), intent(in), pointer, contiguous  dbl1d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname 
)

Definition at line 596 of file NCArrayReader.f90.

598  ! -- dummy
599  real(DP), dimension(:), contiguous, pointer, intent(in) :: dbl1d
600  type(ModflowInputType), intent(in) :: mf6_input
601  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
602  type(InputParamDefinitionType), intent(in) :: idt
603  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
604  character(len=*), intent(in) :: input_fname
605  ! -- local
606  integer(I4B), dimension(:), allocatable :: layer_shape
607  integer(I4B) :: nlay, varid
608  integer(I4B) :: k, ncpl
609  integer(I4B) :: index_start, index_stop
610  real(DP), dimension(:), contiguous, pointer :: dbl1d_ptr
611  !
612  nullify (dbl1d_ptr)
613  index_start = 1
614  !
615  call get_layered_shape(mshape, nlay, layer_shape)
616  !
617  ncpl = product(layer_shape)
618  !
619  do k = 1, nlay
620  varid = nc_vars%varid(idt%mf6varname, layer=k)
621  index_stop = index_start + ncpl - 1
622  dbl1d_ptr(1:ncpl) => dbl1d(index_start:index_stop)
623  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
624  nc_vars%nc_fname)
625  index_start = index_stop + 1
626  end do
627  !
628  ! -- return
629  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double1d_layered_spd()

subroutine ncarrayreadermodule::load_double1d_layered_spd ( real(dp), dimension(:), intent(in), pointer, contiguous  dbl1d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
integer(i4b), intent(in)  iper,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in), optional  iaux 
)
private

Definition at line 634 of file NCArrayReader.f90.

636  use constantsmodule, only: dnodata
637  ! -- dummy
638  real(DP), dimension(:), contiguous, pointer, intent(in) :: dbl1d
639  type(ModflowInputType), intent(in) :: mf6_input
640  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
641  type(InputParamDefinitionType), intent(in) :: idt
642  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
643  integer(I4B), intent(in) :: iper
644  character(len=*), intent(in) :: input_fname
645  integer(I4B), optional, intent(in) :: iaux
646  ! -- local
647  integer(I4B), dimension(:), allocatable :: layer_shape
648  integer(I4B) :: nlay, varid
649  integer(I4B) :: k, n, ncpl
650  integer(I4B) :: index_start, index_stop
651  real(DP), dimension(:), contiguous, pointer :: dbl1d_ptr
652  !
653  call get_layered_shape(mshape, nlay, layer_shape)
654  !
655  ncpl = product(layer_shape)
656  allocate (dbl1d_ptr(ncpl))
657  !
658  do k = 1, nlay
659  index_start = 1
660  index_stop = index_start + ncpl - 1
661  if (present(iaux)) then
662  varid = nc_vars%varid(idt%mf6varname, layer=k, period=iper, iaux=iaux)
663  else
664  varid = nc_vars%varid(idt%mf6varname, layer=k, period=iper)
665  end if
666  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
667  nc_vars%nc_fname)
668  do n = 1, ncpl
669  if (dbl1d_ptr(n) /= dnodata) then
670  dbl1d(n) = dbl1d_ptr(n)
671  end if
672  end do
673  end do
674  !
675  ! -- cleanup
676  deallocate (dbl1d_ptr)
677  !
678  ! -- return
679  return
This module contains simulation constants.
Definition: Constants.f90:9
real(dp), parameter dnodata
real no data constant
Definition: Constants.f90:95
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double1d_spd()

subroutine ncarrayreadermodule::load_double1d_spd ( real(dp), dimension(:), intent(in), pointer, contiguous  dbl1d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
integer(i4b), intent(in)  iper,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in), optional  iaux 
)
private

Definition at line 524 of file NCArrayReader.f90.

526  use constantsmodule, only: dnodata
527  ! -- dummy
528  real(DP), dimension(:), contiguous, pointer, intent(in) :: dbl1d
529  type(ModflowInputType), intent(in) :: mf6_input
530  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
531  type(InputParamDefinitionType), intent(in) :: idt
532  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
533  integer(I4B), intent(in) :: iper
534  character(len=*), intent(in) :: input_fname
535  integer(I4B), optional, intent(in) :: iaux
536  ! -- local
537  real(DP), dimension(:, :, :), contiguous, pointer :: dbl3d
538  integer(I4B) :: nvals, varid
539  integer(I4B) :: n, i, j, k
540  !
541  ! -- initialize
542  nvals = 0
543  !
544  ! -- set varid
545  if (present(iaux)) then
546  varid = nc_vars%varid(idt%mf6varname, period=iper, iaux=iaux)
547  else
548  varid = nc_vars%varid(idt%mf6varname, period=iper)
549  end if
550  !
551  if (idt%shape == 'NODES') then
552  ! TODO future support
553  write (errmsg, '(a)') &
554  'IDM NetCDF load_double1d_spd NODES var shape not supported => '// &
555  trim(idt%tagname)
556  call store_error(errmsg)
557  call store_error_filename(input_fname)
558  else if (idt%shape == 'NCPL' .or. idt%shape == 'NAUX NCPL') then
559 
560  if (size(mshape) == 3) then
561  !
562  allocate (dbl3d(mshape(3), mshape(2), mshape(1)))
563  !
564  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl3d), &
565  nc_vars%nc_fname)
566  !
567  n = 0
568  do k = 1, size(dbl3d, dim=3)
569  do i = 1, size(dbl3d, dim=2)
570  do j = 1, size(dbl3d, dim=1)
571  if (n < size(dbl1d)) then
572  n = n + 1
573  else
574  n = 1
575  end if
576  if (dbl3d(j, i, k) /= dnodata) then
577  dbl1d(n) = dbl3d(j, i, k)
578  end if
579  end do
580  end do
581  end do
582 
583  else if (size(mshape) == 2) then
584  ! TODO
585  write (errmsg, '(a)') &
586  'IDM NetCDF load_double1d_spd DISV model not supported => '// &
587  trim(idt%tagname)
588  call store_error(errmsg)
589  call store_error_filename(input_fname)
590  end if
591  end if
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double1d_type()

subroutine ncarrayreadermodule::load_double1d_type ( real(dp), dimension(:), intent(in), pointer, contiguous  dbl1d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
integer(i4b), intent(in)  varid,
character(len=*), intent(in)  input_fname 
)
private

Definition at line 473 of file NCArrayReader.f90.

475  ! -- dummy
476  real(DP), dimension(:), contiguous, pointer, intent(in) :: dbl1d
477  type(ModflowInputType), intent(in) :: mf6_input
478  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
479  type(InputParamDefinitionType), intent(in) :: idt
480  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
481  integer(I4B), intent(in) :: varid
482  character(len=*), intent(in) :: input_fname
483  ! -- local
484  integer(I4B), dimension(:), allocatable :: array_shape
485  real(DP), dimension(:, :, :), contiguous, pointer :: dbl3d_ptr
486  real(DP), dimension(:, :), contiguous, pointer :: dbl2d_ptr
487  integer(I4B) :: nvals
488  !
489  ! -- initialize
490  nvals = 0
491  !
492  if (idt%shape == 'NODES') then
493  ! -- set number of values
494  nvals = product(mshape)
495  !
496  if (size(mshape) == 3) then
497  dbl3d_ptr(1:mshape(3), 1:mshape(2), 1:mshape(1)) => dbl1d(1:nvals)
498  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl3d_ptr), &
499  nc_vars%nc_fname)
500  else if (size(mshape) == 2) then
501  dbl2d_ptr(1:mshape(2), 1:mshape(1)) => dbl1d(1:nvals)
502  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl2d_ptr), &
503  nc_vars%nc_fname)
504  else if (size(mshape) == 1) then
505  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d), nc_vars%nc_fname)
506  end if
507  else
508  ! -- interpret shape
509  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
510  !
511  ! -- set nvals
512  nvals = array_shape(1)
513  !
514  ! -- read and set data
515  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d), nc_vars%nc_fname)
516  end if
517  !
518  ! -- return
519  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double2d_layered()

subroutine ncarrayreadermodule::load_double2d_layered ( real(dp), dimension(:, :), intent(in), pointer, contiguous  dbl2d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname 
)
private

Definition at line 717 of file NCArrayReader.f90.

719  ! -- dummy
720  real(DP), dimension(:, :), contiguous, pointer, intent(in) :: dbl2d
721  type(ModflowInputType), intent(in) :: mf6_input
722  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
723  type(InputParamDefinitionType), intent(in) :: idt
724  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
725  character(len=*), intent(in) :: input_fname
726  ! -- local
727  integer(I4B), dimension(:), allocatable :: layer_shape
728  integer(I4B) :: k
729  integer(I4B) :: ncpl, nlay, varid
730  real(DP), dimension(:), contiguous, pointer :: dbl1d_ptr
731  !
732  nullify (dbl1d_ptr)
733 
734  if (size(mshape) == 3) then
735  write (errmsg, '(a,a,a)') &
736  'Layered netcdf read not supported for DIS dbl2d type ('// &
737  trim(idt%tagname)//').'
738  call store_error(errmsg)
739  call store_error_filename(input_fname)
740  else if (size(mshape) == 2) then
741  call get_layered_shape(mshape, nlay, layer_shape)
742  ncpl = layer_shape(1)
743  do k = 1, nlay
744  varid = nc_vars%varid(idt%mf6varname, layer=k)
745  dbl1d_ptr(1:ncpl) => dbl2d(1:ncpl, k)
746  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
747  nc_vars%nc_fname)
748  end do
749  end if
750  !
751  ! -- return
752  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double2d_type()

subroutine ncarrayreadermodule::load_double2d_type ( real(dp), dimension(:, :), intent(in), pointer, contiguous  dbl2d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
integer(i4b), intent(in)  varid,
character(len=*), intent(in)  input_fname 
)

Definition at line 684 of file NCArrayReader.f90.

686  ! -- dummy
687  real(DP), dimension(:, :), contiguous, pointer, intent(in) :: dbl2d
688  type(ModflowInputType), intent(in) :: mf6_input
689  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
690  type(InputParamDefinitionType), intent(in) :: idt
691  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
692  integer(I4B), intent(in) :: varid
693  character(len=*), intent(in) :: input_fname
694  ! -- local
695  real(DP), dimension(:), contiguous, pointer :: dbl1d_ptr
696  integer(I4B), dimension(:), allocatable :: array_shape
697  integer(I4B) :: ncpl, nlay
698  !
699  nullify (dbl1d_ptr)
700  !
701  if (nc_vars%grid == 'STRUCTURED') then
702  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl2d), nc_vars%nc_fname)
703  else if (nc_vars%grid == 'LAYERED MESH') then
704  call get_layered_shape(mshape, nlay, array_shape)
705  ncpl = product(array_shape)
706  dbl1d_ptr(1:ncpl) => dbl2d(:, :)
707  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
708  nc_vars%nc_fname)
709  end if
710  !
711  ! -- return
712  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double3d_layered()

subroutine ncarrayreadermodule::load_double3d_layered ( real(dp), dimension(:, :, :), intent(in), pointer, contiguous  dbl3d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname 
)
private

Definition at line 776 of file NCArrayReader.f90.

778  ! -- dummy
779  real(DP), dimension(:, :, :), contiguous, pointer, intent(in) :: dbl3d
780  type(ModflowInputType), intent(in) :: mf6_input
781  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
782  type(InputParamDefinitionType), intent(in) :: idt
783  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
784  character(len=*), intent(in) :: input_fname
785  ! -- local
786  integer(I4B), dimension(:), allocatable :: layer_shape
787  integer(I4B) :: k !, i, j
788  integer(I4B) :: ncpl, nlay, varid
789  integer(I4B) :: index_start, index_stop
790  real(DP), dimension(:), contiguous, pointer :: dbl1d_ptr
791  !
792  nullify (dbl1d_ptr)
793 
794  call get_layered_shape(mshape, nlay, layer_shape)
795 
796  ncpl = product(layer_shape)
797  index_start = 1
798  do k = 1, nlay
799  varid = nc_vars%varid(idt%mf6varname, layer=k)
800  index_stop = index_start + ncpl - 1
801  dbl1d_ptr(1:ncpl) => dbl3d(:, :, k:k)
802  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
803  nc_vars%nc_fname)
804  index_start = index_stop + 1
805  end do
806  !
807  ! -- return
808  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_double3d_type()

subroutine ncarrayreadermodule::load_double3d_type ( real(dp), dimension(:, :, :), intent(in), pointer, contiguous  dbl3d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
integer(i4b), intent(in)  varid,
character(len=*), intent(in)  input_fname 
)
private

Definition at line 757 of file NCArrayReader.f90.

759  ! -- dummy
760  real(DP), dimension(:, :, :), contiguous, pointer, intent(in) :: dbl3d
761  type(ModflowInputType), intent(in) :: mf6_input
762  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
763  type(InputParamDefinitionType), intent(in) :: idt
764  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
765  integer(I4B), intent(in) :: varid
766  character(len=*), intent(in) :: input_fname
767  ! -- local
768  !
769  call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl3d), nc_vars%nc_fname)
770  !
771  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer1d_layered()

subroutine ncarrayreadermodule::load_integer1d_layered ( integer(i4b), dimension(:), intent(in), pointer, contiguous  int1d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname 
)
private

Definition at line 306 of file NCArrayReader.f90.

308  ! -- dummy
309  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: int1d
310  type(ModflowInputType), intent(in) :: mf6_input
311  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
312  type(InputParamDefinitionType), intent(in) :: idt
313  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
314  character(len=*), intent(in) :: input_fname
315  ! -- local
316  integer(I4B), dimension(:), allocatable :: layer_shape
317  integer(I4B) :: nlay, varid
318  integer(I4B) :: k, ncpl
319  integer(I4B) :: index_start, index_stop
320  integer(I4B), dimension(:), contiguous, pointer :: int1d_ptr
321  !
322  nullify (int1d_ptr)
323 
324  call get_layered_shape(mshape, nlay, layer_shape)
325 
326  ncpl = product(layer_shape)
327  index_start = 1
328  do k = 1, nlay
329  varid = nc_vars%varid(idt%mf6varname, layer=k)
330  index_stop = index_start + ncpl - 1
331  int1d_ptr(1:ncpl) => int1d(index_start:index_stop)
332  call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
333  nc_vars%nc_fname)
334  index_start = index_stop + 1
335  end do
336  !
337  ! -- return
338  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer1d_type()

subroutine ncarrayreadermodule::load_integer1d_type ( integer(i4b), dimension(:), intent(in), pointer, contiguous  int1d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
integer(i4b), intent(in)  varid,
character(len=*), intent(in)  input_fname 
)
private

Definition at line 255 of file NCArrayReader.f90.

257  ! -- dummy
258  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: int1d
259  type(ModflowInputType), intent(in) :: mf6_input
260  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
261  type(InputParamDefinitionType), intent(in) :: idt
262  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
263  integer(I4B), intent(in) :: varid
264  character(len=*), intent(in) :: input_fname
265  ! -- local
266  integer(I4B), dimension(:), allocatable :: array_shape
267  integer(I4B), dimension(:, :, :), contiguous, pointer :: int3d_ptr
268  integer(I4B), dimension(:, :), contiguous, pointer :: int2d_ptr
269  integer(I4B) :: nvals
270  !
271  ! -- initialize
272  nvals = 0
273  !
274  if (idt%shape == 'NODES') then
275  ! -- set number of values
276  nvals = product(mshape)
277  !
278  if (size(mshape) == 3) then
279  int3d_ptr(1:mshape(3), 1:mshape(2), 1:mshape(1)) => int1d(1:nvals)
280  call nf_verify(nf90_get_var(nc_vars%ncid, varid, int3d_ptr), &
281  nc_vars%nc_fname)
282  else if (size(mshape) == 2) then
283  int2d_ptr(1:mshape(2), 1:mshape(1)) => int1d(1:nvals)
284  call nf_verify(nf90_get_var(nc_vars%ncid, varid, int2d_ptr), &
285  nc_vars%nc_fname)
286  else if (size(mshape) == 1) then
287  call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d), nc_vars%nc_fname)
288  end if
289  else
290  ! -- interpret shape
291  call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
292  !
293  ! -- set nvals
294  nvals = array_shape(1)
295  !
296  ! -- read and set data
297  call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d), nc_vars%nc_fname)
298  end if
299  !
300  ! -- return
301  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer2d_layered()

subroutine ncarrayreadermodule::load_integer2d_layered ( integer(i4b), dimension(:, :), intent(in), pointer, contiguous  int2d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname 
)
private

Definition at line 376 of file NCArrayReader.f90.

378  ! -- dummy
379  integer(I4B), dimension(:, :), contiguous, pointer, intent(in) :: int2d
380  type(ModflowInputType), intent(in) :: mf6_input
381  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
382  type(InputParamDefinitionType), intent(in) :: idt
383  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
384  character(len=*), intent(in) :: input_fname
385  ! -- local
386  integer(I4B), dimension(:), allocatable :: layer_shape
387  integer(I4B) :: k
388  integer(I4B) :: ncpl, nlay, varid
389  integer(I4B), dimension(:), contiguous, pointer :: int1d_ptr
390  !
391  nullify (int1d_ptr)
392 
393  if (size(mshape) == 3) then
394  write (errmsg, '(a,a,a)') &
395  'Layered netcdf read not supported for DIS int2d type ('// &
396  trim(idt%tagname)//').'
397  call store_error(errmsg)
398  call store_error_filename(input_fname)
399  else if (size(mshape) == 2) then
400  call get_layered_shape(mshape, nlay, layer_shape)
401  ncpl = layer_shape(1)
402  do k = 1, nlay
403  varid = nc_vars%varid(idt%mf6varname, layer=k)
404  int1d_ptr(1:ncpl) => int2d(1:ncpl, k)
405  call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
406  nc_vars%nc_fname)
407  end do
408  end if
409  !
410  ! -- return
411  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer2d_type()

subroutine ncarrayreadermodule::load_integer2d_type ( integer(i4b), dimension(:, :), intent(in), pointer, contiguous  int2d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
integer(i4b), intent(in)  varid,
character(len=*), intent(in)  input_fname 
)
private

Definition at line 343 of file NCArrayReader.f90.

345  ! -- dummy
346  integer(I4B), dimension(:, :), contiguous, pointer, intent(in) :: int2d
347  type(ModflowInputType), intent(in) :: mf6_input
348  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
349  type(InputParamDefinitionType), intent(in) :: idt
350  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
351  integer(I4B), intent(in) :: varid
352  character(len=*), intent(in) :: input_fname
353  ! -- local
354  integer(I4B), dimension(:), contiguous, pointer :: int1d_ptr
355  integer(I4B), dimension(:), allocatable :: array_shape
356  integer(I4B) :: ncpl, nlay
357  !
358  nullify (int1d_ptr)
359  !
360  if (nc_vars%grid == 'STRUCTURED') then
361  call nf_verify(nf90_get_var(nc_vars%ncid, varid, int2d), nc_vars%nc_fname)
362  else if (nc_vars%grid == 'LAYERED MESH') then
363  call get_layered_shape(mshape, nlay, array_shape)
364  ncpl = product(array_shape)
365  int1d_ptr(1:ncpl) => int2d(:, :)
366  call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
367  nc_vars%nc_fname)
368  end if
369  !
370  ! -- return
371  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer3d_layered()

subroutine ncarrayreadermodule::load_integer3d_layered ( integer(i4b), dimension(:, :, :), intent(in), pointer, contiguous  int3d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname 
)
private

Definition at line 435 of file NCArrayReader.f90.

437  ! -- dummy
438  integer(I4B), dimension(:, :, :), contiguous, pointer, intent(in) :: int3d
439  type(ModflowInputType), intent(in) :: mf6_input
440  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
441  type(InputParamDefinitionType), intent(in) :: idt
442  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
443  character(len=*), intent(in) :: input_fname
444  ! -- local
445  integer(I4B), dimension(:), allocatable :: layer_shape
446  integer(I4B) :: k !, i, j
447  integer(I4B) :: ncpl, nlay, varid
448  integer(I4B) :: index_start, index_stop
449  integer(I4B), dimension(:), contiguous, pointer :: int1d_ptr
450  !
451  nullify (int1d_ptr)
452  index_start = 1
453  !
454  call get_layered_shape(mshape, nlay, layer_shape)
455  !
456  ncpl = product(layer_shape)
457  !
458  do k = 1, nlay
459  varid = nc_vars%varid(idt%mf6varname, layer=k)
460  index_stop = index_start + ncpl - 1
461  int1d_ptr(1:ncpl) => int3d(:, :, k:k)
462  call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
463  nc_vars%nc_fname)
464  index_start = index_stop + 1
465  end do
466  !
467  ! -- return
468  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer3d_type()

subroutine ncarrayreadermodule::load_integer3d_type ( integer(i4b), dimension(:, :, :), intent(in), pointer, contiguous  int3d,
type(modflowinputtype), intent(in)  mf6_input,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
integer(i4b), intent(in)  varid,
character(len=*), intent(in)  input_fname 
)
private

Definition at line 416 of file NCArrayReader.f90.

418  ! -- dummy
419  integer(I4B), dimension(:, :, :), contiguous, pointer, intent(in) :: int3d
420  type(ModflowInputType), intent(in) :: mf6_input
421  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
422  type(InputParamDefinitionType), intent(in) :: idt
423  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
424  integer(I4B), intent(in) :: varid
425  character(len=*), intent(in) :: input_fname
426  ! -- local
427  !
428  call nf_verify(nf90_get_var(nc_vars%ncid, varid, int3d), nc_vars%nc_fname)
429  !
430  return
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nc_array_load_dbl1d()

subroutine ncarrayreadermodule::nc_array_load_dbl1d ( real(dp), dimension(:), intent(in), pointer, contiguous  dbl1d,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in), optional  kper,
integer(i4b), intent(in), optional  iaux 
)
private
Parameters
[in]mshapemodel shape
[in]idtinput data type object describing this record

Definition at line 149 of file NCArrayReader.f90.

151  real(DP), dimension(:), pointer, contiguous, intent(in) :: dbl1d
152  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
153  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
154  type(ModflowInputType), intent(in) :: mf6_input
155  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
156  character(len=*), intent(in) :: input_fname
157  integer(I4B), intent(in) :: iout
158  integer(I4B), optional, intent(in) :: kper
159  integer(I4B), optional, intent(in) :: iaux
160  ! -- local
161  integer(I4B) :: varid
162  logical(LGP) :: layered
163  !
164  if (present(kper)) then
165  layered = (kper > 0 .and. is_layered(nc_vars%grid))
166  else
167  layered = (idt%layered .and. is_layered(nc_vars%grid))
168  end if
169  !
170  if (layered) then
171  if (present(kper)) then
172  call load_double1d_layered_spd(dbl1d, mf6_input, mshape, idt, nc_vars, &
173  kper, input_fname, iaux)
174  else
175  call load_double1d_layered(dbl1d, mf6_input, mshape, idt, nc_vars, &
176  input_fname)
177  end if
178  else
179  if (present(kper)) then
180  call load_double1d_spd(dbl1d, mf6_input, mshape, idt, nc_vars, &
181  kper, input_fname, iaux)
182  else
183  varid = nc_vars%varid(idt%mf6varname)
184  call load_double1d_type(dbl1d, mf6_input, mshape, idt, nc_vars, &
185  varid, input_fname)
186  end if
187  end if
188  !
189  ! -- return
190  return

◆ nc_array_load_dbl2d()

subroutine ncarrayreadermodule::nc_array_load_dbl2d ( real(dp), dimension(:, :), intent(in), pointer, contiguous  dbl2d,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in]mshapemodel shape
[in]idtinput data type object describing this record

Definition at line 195 of file NCArrayReader.f90.

197  real(DP), dimension(:, :), pointer, contiguous, intent(in) :: dbl2d
198  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
199  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
200  type(ModflowInputType), intent(in) :: mf6_input
201  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
202  character(len=*), intent(in) :: input_fname
203  integer(I4B), intent(in) :: iout
204  ! -- local
205  integer(I4B) :: varid
206  logical(LGP) :: layered
207  !
208  layered = (idt%layered .and. is_layered(nc_vars%grid))
209  !
210  if (layered) then
211  call load_double2d_layered(dbl2d, mf6_input, mshape, idt, nc_vars, &
212  input_fname)
213  else
214  varid = nc_vars%varid(idt%mf6varname)
215  call load_double2d_type(dbl2d, mf6_input, mshape, idt, nc_vars, &
216  varid, input_fname)
217  end if
218  !
219  ! -- return
220  return

◆ nc_array_load_dbl3d()

subroutine ncarrayreadermodule::nc_array_load_dbl3d ( real(dp), dimension(:, :, :), intent(in), pointer, contiguous  dbl3d,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in]mshapemodel shape
[in]idtinput data type object describing this record

Definition at line 225 of file NCArrayReader.f90.

227  real(DP), dimension(:, :, :), pointer, contiguous, intent(in) :: dbl3d
228  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
229  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
230  type(ModflowInputType), intent(in) :: mf6_input
231  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
232  character(len=*), intent(in) :: input_fname
233  integer(I4B), intent(in) :: iout
234  ! -- local
235  integer(I4B) :: varid
236  logical(LGP) :: layered
237  !
238  layered = (idt%layered .and. is_layered(nc_vars%grid))
239  !
240  if (layered) then
241  call load_double3d_layered(dbl3d, mf6_input, mshape, idt, nc_vars, &
242  input_fname)
243  else
244  varid = nc_vars%varid(idt%mf6varname)
245  call load_double3d_type(dbl3d, mf6_input, mshape, idt, nc_vars, &
246  varid, input_fname)
247  end if
248  !
249  ! -- return
250  return

◆ nc_array_load_int1d()

subroutine ncarrayreadermodule::nc_array_load_int1d ( integer(i4b), dimension(:), intent(in), pointer, contiguous  int1d,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout,
integer(i4b), intent(in), optional  kper 
)
private
Parameters
[in]mshapemodel shape
[in]idtinput data type object describing this record

Definition at line 54 of file NCArrayReader.f90.

56  integer(I4B), dimension(:), pointer, contiguous, intent(in) :: int1d
57  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
58  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
59  type(ModflowInputType), intent(in) :: mf6_input
60  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
61  character(len=*), intent(in) :: input_fname
62  integer(I4B), intent(in) :: iout
63  integer(I4B), optional, intent(in) :: kper
64  ! -- local
65  integer(I4B) :: varid
66  logical(LGP) :: layered
67  !
68  layered = (idt%layered .and. is_layered(nc_vars%grid))
69  !
70  if (layered) then
71  call load_integer1d_layered(int1d, mf6_input, mshape, idt, nc_vars, &
72  input_fname)
73  else
74  if (present(kper)) then
75  varid = nc_vars%varid(idt%mf6varname, period=kper)
76  else
77  varid = nc_vars%varid(idt%mf6varname)
78  end if
79  call load_integer1d_type(int1d, mf6_input, mshape, idt, nc_vars, &
80  varid, input_fname)
81  end if
82  !
83  ! -- return
84  return

◆ nc_array_load_int2d()

subroutine ncarrayreadermodule::nc_array_load_int2d ( integer(i4b), dimension(:, :), intent(in), pointer, contiguous  int2d,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in]mshapemodel shape
[in]idtinput data type object describing this record

Definition at line 89 of file NCArrayReader.f90.

91  integer(I4B), dimension(:, :), pointer, contiguous, intent(in) :: int2d
92  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
93  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
94  type(ModflowInputType), intent(in) :: mf6_input
95  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
96  character(len=*), intent(in) :: input_fname
97  integer(I4B), intent(in) :: iout
98  ! -- local
99  integer(I4B) :: varid
100  logical(LGP) :: layered
101  !
102  layered = (idt%layered .and. is_layered(nc_vars%grid))
103  !
104  if (layered) then
105  call load_integer2d_layered(int2d, mf6_input, mshape, idt, nc_vars, &
106  input_fname)
107  else
108  varid = nc_vars%varid(idt%mf6varname)
109  call load_integer2d_type(int2d, mf6_input, mshape, idt, nc_vars, &
110  varid, input_fname)
111  end if
112  !
113  ! -- return
114  return

◆ nc_array_load_int3d()

subroutine ncarrayreadermodule::nc_array_load_int3d ( integer(i4b), dimension(:, :, :), intent(in), pointer, contiguous  int3d,
integer(i4b), dimension(:), intent(in), pointer, contiguous  mshape,
type(inputparamdefinitiontype), intent(in)  idt,
type(modflowinputtype), intent(in)  mf6_input,
type(ncpackagevarstype), intent(in), pointer  nc_vars,
character(len=*), intent(in)  input_fname,
integer(i4b), intent(in)  iout 
)
private
Parameters
[in]mshapemodel shape
[in]idtinput data type object describing this record

Definition at line 119 of file NCArrayReader.f90.

121  integer(I4B), dimension(:, :, :), pointer, contiguous, intent(in) :: int3d
122  integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
123  type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
124  type(ModflowInputType), intent(in) :: mf6_input
125  type(NCPackageVarsType), pointer, intent(in) :: nc_vars
126  character(len=*), intent(in) :: input_fname
127  integer(I4B), intent(in) :: iout
128  ! -- local
129  integer(I4B) :: varid
130  logical(LGP) :: layered
131  !
132  layered = (idt%layered .and. is_layered(nc_vars%grid))
133  !
134  if (layered) then
135  call load_integer3d_layered(int3d, mf6_input, mshape, idt, nc_vars, &
136  input_fname)
137  else
138  varid = nc_vars%varid(idt%mf6varname)
139  call load_integer3d_type(int3d, mf6_input, mshape, idt, nc_vars, &
140  varid, input_fname)
141  end if
142  !
143  ! -- return
144  return