MODFLOW 6 version 6.9.0.dev0
USGS Modular Hydrologic Model
Loading...
Searching...
No Matches
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
subroutine nc_array_load_int1d (int1d, mshape, idt, mf6_input, nc_vars, input_fname, iout, kper)
 Load NetCDF integer 1D array.
subroutine nc_array_load_int2d (int2d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
 Load NetCDF integer 2D array.
subroutine nc_array_load_int3d (int3d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
 Load NetCDF integer 3D array.
subroutine nc_array_load_dbl1d (dbl1d, mshape, idt, mf6_input, nc_vars, input_fname, iout, kper, iaux)
 Load NetCDF double 1D array.
subroutine nc_array_load_dbl2d (dbl2d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
 Load NetCDF double 2D array.
subroutine nc_array_load_dbl3d (dbl3d, mshape, idt, mf6_input, nc_vars, input_fname, iout)
 Load NetCDF double 3D array.
subroutine load_integer1d_type (int1d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 1d integer
subroutine load_integer1d_spd (int1d, mf6_input, mshape, idt, nc_vars, iper, input_fname)
 load type 1d double
subroutine load_integer1d_layered (int1d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 1d integer layered
subroutine load_integer1d_layered_spd (int1d, mf6_input, mshape, idt, nc_vars, iper, input_fname)
 load type 1d integer layered
subroutine load_integer2d_type (int2d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 2d integer
subroutine load_integer2d_layered (int2d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 2d integer layered
subroutine load_integer3d_type (int3d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 3d integer
subroutine load_integer3d_layered (int3d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 3d integer layered
subroutine load_double1d_type (dbl1d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 1d double
subroutine load_double1d_spd (dbl1d, mf6_input, mshape, idt, nc_vars, iper, input_fname, iaux)
 load type 1d double
subroutine load_double1d_layered (dbl1d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 1d double layered
subroutine load_double1d_layered_spd (dbl1d, mf6_input, mshape, idt, nc_vars, iper, input_fname, iaux)
 load type 1d double layered
subroutine load_double2d_type (dbl2d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 2d double
subroutine load_double2d_layered (dbl2d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 2d double layered
subroutine load_double3d_type (dbl3d, mf6_input, mshape, idt, nc_vars, varid, input_fname)
 load type 3d double
subroutine load_double3d_layered (dbl3d, mf6_input, mshape, idt, nc_vars, input_fname)
 load type 3d double layered

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 select case (grid)
39 case ('LAYERED MESH')
40 layered = .true.
41 case ('STRUCTURED')
42 layered = .false.
43 case default
44 layered = .false.
45 end select
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 )
private

Definition at line 605 of file NCArrayReader.f90.

607 real(DP), dimension(:), contiguous, pointer, intent(in) :: dbl1d
608 type(ModflowInputType), intent(in) :: mf6_input
609 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
610 type(InputParamDefinitionType), intent(in) :: idt
611 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
612 character(len=*), intent(in) :: input_fname
613 integer(I4B), dimension(:), allocatable :: layer_shape
614 integer(I4B) :: nlay, varid
615 integer(I4B) :: k, ncpl
616 integer(I4B) :: index_start, index_stop
617 real(DP), dimension(:), contiguous, pointer :: dbl1d_ptr
618
619 nullify (dbl1d_ptr)
620 index_start = 1
621 call get_layered_shape(mshape, nlay, layer_shape)
622 ncpl = product(layer_shape)
623
624 do k = 1, nlay
625 varid = nc_vars%varid(idt%tagname, layer=k)
626 index_stop = index_start + ncpl - 1
627 dbl1d_ptr(1:ncpl) => dbl1d(index_start:index_stop)
628 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
629 nc_vars%nc_fname)
630 index_start = index_stop + 1
631 end do
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 636 of file NCArrayReader.f90.

638 use tdismodule, only: kper
639 use constantsmodule, only: dnodata
640 real(DP), dimension(:), contiguous, pointer, intent(in) :: dbl1d
641 type(ModflowInputType), intent(in) :: mf6_input
642 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
643 type(InputParamDefinitionType), intent(in) :: idt
644 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
645 integer(I4B), intent(in) :: iper
646 character(len=*), intent(in) :: input_fname
647 integer(I4B), optional, intent(in) :: iaux
648 integer(I4B), dimension(:), allocatable :: layer_shape
649 integer(I4B) :: nlay, varid
650 integer(I4B) :: k, n, ncpl, idx
651 real(DP), dimension(:), contiguous, pointer :: dbl1d_ptr
652
653 call get_layered_shape(mshape, nlay, layer_shape)
654 ncpl = product(layer_shape)
655 allocate (dbl1d_ptr(ncpl))
656
657 do k = 1, nlay
658 if (present(iaux)) then
659 varid = nc_vars%varid(idt%tagname, layer=k, iaux=iaux)
660 else
661 varid = nc_vars%varid(idt%tagname, layer=k)
662 end if
663 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr, &
664 start=(/1, kper/), count=(/ncpl, 1/)), &
665 nc_vars%nc_fname)
666 if (idt%shape == 'NODES' .or. idt%shape == 'NAUX NODES') then
667 do n = 1, ncpl
668 idx = (k - 1) * ncpl + n
669 dbl1d(idx) = dbl1d_ptr(n)
670 end do
671 else if (idt%shape == 'NCPL' .or. idt%shape == 'NAUX NCPL') then
672 do n = 1, ncpl
673 dbl1d(n) = dbl1d_ptr(n)
674 end do
675 end if
676 end do
677
678 ! cleanup
679 deallocate (dbl1d_ptr)
This module contains simulation constants.
Definition Constants.f90:9
real(dp), parameter dnodata
real no data constant
Definition Constants.f90:95
integer(i4b), pointer, public kper
current stress period number
Definition tdis.f90:26
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 544 of file NCArrayReader.f90.

546 use tdismodule, only: kper
547 use constantsmodule, only: dnodata
548 real(DP), dimension(:), contiguous, pointer, intent(in) :: dbl1d
549 type(ModflowInputType), intent(in) :: mf6_input
550 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
551 type(InputParamDefinitionType), intent(in) :: idt
552 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
553 integer(I4B), intent(in) :: iper
554 character(len=*), intent(in) :: input_fname
555 integer(I4B), optional, intent(in) :: iaux
556 integer(I4B), dimension(:), allocatable :: layer_shape
557 real(DP), dimension(:, :, :), contiguous, pointer :: dbl3d
558 integer(I4B) :: varid, nlay, ncpl, nvals
559 integer(I4B) :: n
560
561 ! initialize
562 n = 0
563
564 ! set varid
565 if (present(iaux)) then
566 varid = nc_vars%varid(idt%tagname, iaux=iaux)
567 else
568 varid = nc_vars%varid(idt%tagname)
569 end if
570
571 call get_layered_shape(mshape, nlay, layer_shape)
572 ncpl = product(layer_shape)
573 nvals = product(mshape)
574
575 select case (idt%shape)
576 case ('NCPL', 'NAUX NCPL')
577 if (nc_vars%grid == 'STRUCTURED') then
578 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d, &
579 start=(/1, 1, kper/), &
580 count=(/mshape(3), mshape(2), 1/)), &
581 nc_vars%nc_fname)
582 else if (nc_vars%grid == 'LAYERED MESH') then
583 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d, &
584 start=(/1, kper/), count=(/ncpl, 1/)), &
585 nc_vars%nc_fname)
586 end if
587 case ('NODES', 'NAUX NODES')
588 if (nc_vars%grid == 'STRUCTURED') then
589 dbl3d(1:mshape(3), 1:mshape(2), 1:mshape(1)) => dbl1d(1:nvals)
590 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl3d, &
591 start=(/1, 1, 1, kper/), &
592 count=(/mshape(3), mshape(2), mshape(1), &
593 1/)), nc_vars%nc_fname)
594 else if (nc_vars%grid == 'LAYERED MESH') then
595 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d, &
596 start=(/1, kper/), count=(/nvals, 1/)), &
597 nc_vars%nc_fname)
598 end if
599 case default
600 end select
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 501 of file NCArrayReader.f90.

503 real(DP), dimension(:), contiguous, pointer, intent(in) :: dbl1d
504 type(ModflowInputType), intent(in) :: mf6_input
505 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
506 type(InputParamDefinitionType), intent(in) :: idt
507 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
508 integer(I4B), intent(in) :: varid
509 character(len=*), intent(in) :: input_fname
510 integer(I4B), dimension(:), allocatable :: array_shape
511 real(DP), dimension(:, :, :), contiguous, pointer :: dbl3d_ptr
512 real(DP), dimension(:, :), contiguous, pointer :: dbl2d_ptr
513 integer(I4B) :: nvals
514
515 ! initialize
516 nvals = 0
517
518 if (idt%shape == 'NODES') then
519 ! set number of values
520 nvals = product(mshape)
521 if (size(mshape) == 3) then
522 dbl3d_ptr(1:mshape(3), 1:mshape(2), 1:mshape(1)) => dbl1d(1:nvals)
523 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl3d_ptr), &
524 nc_vars%nc_fname)
525 else if (size(mshape) == 2) then
526 dbl2d_ptr(1:mshape(2), 1:mshape(1)) => dbl1d(1:nvals)
527 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl2d_ptr), &
528 nc_vars%nc_fname)
529 else if (size(mshape) == 1) then
530 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d), nc_vars%nc_fname)
531 end if
532 else
533 ! interpret shape
534 call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
535 ! set nvals
536 nvals = array_shape(1)
537 ! read and set data
538 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d), nc_vars%nc_fname)
539 end if
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 712 of file NCArrayReader.f90.

714 real(DP), dimension(:, :), contiguous, pointer, intent(in) :: dbl2d
715 type(ModflowInputType), intent(in) :: mf6_input
716 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
717 type(InputParamDefinitionType), intent(in) :: idt
718 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
719 character(len=*), intent(in) :: input_fname
720 integer(I4B), dimension(:), allocatable :: layer_shape
721 integer(I4B) :: k
722 integer(I4B) :: ncpl, nlay, varid
723 real(DP), dimension(:), contiguous, pointer :: dbl1d_ptr
724
725 nullify (dbl1d_ptr)
726
727 if (size(mshape) == 3) then
728 write (errmsg, '(a,a,a)') &
729 'Layered netcdf read not supported for DIS dbl2d type ('// &
730 trim(idt%tagname)//').'
731 call store_error(errmsg)
732 call store_error_filename(input_fname)
733 else if (size(mshape) == 2) then
734 call get_layered_shape(mshape, nlay, layer_shape)
735 ncpl = layer_shape(1)
736 do k = 1, nlay
737 varid = nc_vars%varid(idt%tagname, layer=k)
738 dbl1d_ptr(1:ncpl) => dbl2d(1:ncpl, k)
739 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
740 nc_vars%nc_fname)
741 end do
742 end if
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 )
private

Definition at line 684 of file NCArrayReader.f90.

686 real(DP), dimension(:, :), contiguous, pointer, intent(in) :: dbl2d
687 type(ModflowInputType), intent(in) :: mf6_input
688 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
689 type(InputParamDefinitionType), intent(in) :: idt
690 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
691 integer(I4B), intent(in) :: varid
692 character(len=*), intent(in) :: input_fname
693 real(DP), dimension(:), contiguous, pointer :: dbl1d_ptr
694 integer(I4B), dimension(:), allocatable :: array_shape
695 integer(I4B) :: ncpl, nlay
696
697 nullify (dbl1d_ptr)
698
699 if (nc_vars%grid == 'STRUCTURED') then
700 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl2d), nc_vars%nc_fname)
701 else if (nc_vars%grid == 'LAYERED MESH') then
702 call get_layered_shape(mshape, nlay, array_shape)
703 ncpl = product(array_shape)
704 dbl1d_ptr(1:ncpl) => dbl2d(:, :)
705 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
706 nc_vars%nc_fname)
707 end if
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 762 of file NCArrayReader.f90.

764 real(DP), dimension(:, :, :), contiguous, pointer, intent(in) :: dbl3d
765 type(ModflowInputType), intent(in) :: mf6_input
766 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
767 type(InputParamDefinitionType), intent(in) :: idt
768 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
769 character(len=*), intent(in) :: input_fname
770 integer(I4B), dimension(:), allocatable :: layer_shape
771 integer(I4B) :: k !, i, j
772 integer(I4B) :: ncpl, nlay, varid
773 integer(I4B) :: index_start, index_stop
774 real(DP), dimension(:), contiguous, pointer :: dbl1d_ptr
775
776 nullify (dbl1d_ptr)
777
778 call get_layered_shape(mshape, nlay, layer_shape)
779
780 ncpl = product(layer_shape)
781 index_start = 1
782 do k = 1, nlay
783 varid = nc_vars%varid(idt%tagname, layer=k)
784 index_stop = index_start + ncpl - 1
785 dbl1d_ptr(1:ncpl) => dbl3d(:, :, k:k)
786 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl1d_ptr), &
787 nc_vars%nc_fname)
788 index_start = index_stop + 1
789 end do
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 747 of file NCArrayReader.f90.

749 real(DP), dimension(:, :, :), contiguous, pointer, intent(in) :: dbl3d
750 type(ModflowInputType), intent(in) :: mf6_input
751 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
752 type(InputParamDefinitionType), intent(in) :: idt
753 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
754 integer(I4B), intent(in) :: varid
755 character(len=*), intent(in) :: input_fname
756 !
757 call nf_verify(nf90_get_var(nc_vars%ncid, varid, dbl3d), nc_vars%nc_fname)
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 326 of file NCArrayReader.f90.

328 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: int1d
329 type(ModflowInputType), intent(in) :: mf6_input
330 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
331 type(InputParamDefinitionType), intent(in) :: idt
332 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
333 character(len=*), intent(in) :: input_fname
334 integer(I4B), dimension(:), allocatable :: layer_shape
335 integer(I4B) :: nlay, varid
336 integer(I4B) :: k, ncpl
337 integer(I4B) :: index_start, index_stop
338 integer(I4B), dimension(:), contiguous, pointer :: int1d_ptr
339
340 nullify (int1d_ptr)
341
342 call get_layered_shape(mshape, nlay, layer_shape)
343
344 ncpl = product(layer_shape)
345 index_start = 1
346 do k = 1, nlay
347 varid = nc_vars%varid(idt%tagname, layer=k)
348 index_stop = index_start + ncpl - 1
349 int1d_ptr(1:ncpl) => int1d(index_start:index_stop)
350 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
351 nc_vars%nc_fname)
352 index_start = index_stop + 1
353 end do
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer1d_layered_spd()

subroutine ncarrayreadermodule::load_integer1d_layered_spd ( 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) iper,
character(len=*), intent(in) input_fname )
private

Definition at line 358 of file NCArrayReader.f90.

360 use tdismodule, only: kper
361 use constantsmodule, only: dnodata
362 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: int1d
363 type(ModflowInputType), intent(in) :: mf6_input
364 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
365 type(InputParamDefinitionType), intent(in) :: idt
366 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
367 integer(I4B), intent(in) :: iper
368 character(len=*), intent(in) :: input_fname
369 integer(I4B), dimension(:), allocatable :: layer_shape
370 integer(I4B) :: nlay, varid
371 integer(I4B) :: ncpl, nvals
372
373 call get_layered_shape(mshape, nlay, layer_shape)
374 nvals = product(mshape)
375 ncpl = product(layer_shape)
376
377 varid = nc_vars%varid(idt%tagname)
378 select case (idt%shape)
379 case ('NCPL', 'NAUX NCPL')
380 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d, &
381 start=(/1, kper/), count=(/ncpl, 1/)), &
382 nc_vars%nc_fname)
383 case ('NODES', 'NAUX NODES')
384 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d, &
385 start=(/1, kper/), count=(/nvals, 1/)), &
386 nc_vars%nc_fname)
387 case default
388 end select
Here is the call graph for this function:
Here is the caller graph for this function:

◆ load_integer1d_spd()

subroutine ncarrayreadermodule::load_integer1d_spd ( 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) iper,
character(len=*), intent(in) input_fname )
private

Definition at line 282 of file NCArrayReader.f90.

284 use tdismodule, only: kper
285 use constantsmodule, only: dnodata
286 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: int1d
287 type(ModflowInputType), intent(in) :: mf6_input
288 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
289 type(InputParamDefinitionType), intent(in) :: idt
290 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
291 integer(I4B), intent(in) :: iper
292 character(len=*), intent(in) :: input_fname
293 integer(I4B), dimension(:), allocatable :: layer_shape
294 integer(I4B) :: varid, nlay, ncpl
295
296 ! set varid
297 varid = nc_vars%varid(idt%tagname)
298
299 call get_layered_shape(mshape, nlay, layer_shape)
300 ncpl = product(layer_shape)
301
302 select case (idt%shape)
303 case ('NCPL', 'NAUX NCPL')
304 if (nc_vars%grid == 'STRUCTURED') then
305 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d, &
306 start=(/1, 1, kper/), &
307 count=(/mshape(3), mshape(2), 1/)), &
308 nc_vars%nc_fname)
309 else if (nc_vars%grid == 'LAYERED MESH') then
310 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d, &
311 start=(/1, kper/), count=(/ncpl, 1/)), &
312 nc_vars%nc_fname)
313 end if
314 case ('NODES', 'NAUX NODES')
315 write (errmsg, '(a,a,a)') &
316 'Timeseries netcdf input read not supported for full grid int1d &
317 &type ('//trim(idt%tagname)//').'
318 call store_error(errmsg)
319 call store_error_filename(input_fname)
320 case default
321 end select
character(len=linelength), pointer input_fname
input filename for tdis
Definition tdis.f90:46
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 239 of file NCArrayReader.f90.

241 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: int1d
242 type(ModflowInputType), intent(in) :: mf6_input
243 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
244 type(InputParamDefinitionType), intent(in) :: idt
245 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
246 integer(I4B), intent(in) :: varid
247 character(len=*), intent(in) :: input_fname
248 integer(I4B), dimension(:), allocatable :: array_shape
249 integer(I4B), dimension(:, :, :), contiguous, pointer :: int3d_ptr
250 integer(I4B), dimension(:, :), contiguous, pointer :: int2d_ptr
251 integer(I4B) :: nvals
252
253 ! initialize
254 nvals = 0
255
256 if (idt%shape == 'NODES') then
257 ! set number of values
258 nvals = product(mshape)
259 if (size(mshape) == 3) then
260 int3d_ptr(1:mshape(3), 1:mshape(2), 1:mshape(1)) => int1d(1:nvals)
261 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int3d_ptr), &
262 nc_vars%nc_fname)
263 else if (size(mshape) == 2) then
264 int2d_ptr(1:mshape(2), 1:mshape(1)) => int1d(1:nvals)
265 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int2d_ptr), &
266 nc_vars%nc_fname)
267 else if (size(mshape) == 1) then
268 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d), nc_vars%nc_fname)
269 end if
270 else
271 ! interpret shape
272 call get_shape_from_string(idt%shape, array_shape, mf6_input%mempath)
273 ! set nvals
274 nvals = array_shape(1)
275 ! read and set data
276 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d), nc_vars%nc_fname)
277 end if
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 421 of file NCArrayReader.f90.

423 integer(I4B), dimension(:, :), contiguous, pointer, intent(in) :: int2d
424 type(ModflowInputType), intent(in) :: mf6_input
425 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
426 type(InputParamDefinitionType), intent(in) :: idt
427 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
428 character(len=*), intent(in) :: input_fname
429 integer(I4B), dimension(:), allocatable :: layer_shape
430 integer(I4B) :: k
431 integer(I4B) :: ncpl, nlay, varid
432 integer(I4B), dimension(:), contiguous, pointer :: int1d_ptr
433
434 nullify (int1d_ptr)
435
436 if (size(mshape) == 3) then
437 write (errmsg, '(a,a,a)') &
438 'Layered netcdf read not supported for DIS int2d type ('// &
439 trim(idt%tagname)//').'
440 call store_error(errmsg)
441 call store_error_filename(input_fname)
442 else if (size(mshape) == 2) then
443 call get_layered_shape(mshape, nlay, layer_shape)
444 ncpl = layer_shape(1)
445 do k = 1, nlay
446 varid = nc_vars%varid(idt%tagname, layer=k)
447 int1d_ptr(1:ncpl) => int2d(1:ncpl, k)
448 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
449 nc_vars%nc_fname)
450 end do
451 end if
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 393 of file NCArrayReader.f90.

395 integer(I4B), dimension(:, :), contiguous, pointer, intent(in) :: int2d
396 type(ModflowInputType), intent(in) :: mf6_input
397 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
398 type(InputParamDefinitionType), intent(in) :: idt
399 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
400 integer(I4B), intent(in) :: varid
401 character(len=*), intent(in) :: input_fname
402 integer(I4B), dimension(:), contiguous, pointer :: int1d_ptr
403 integer(I4B), dimension(:), allocatable :: array_shape
404 integer(I4B) :: ncpl, nlay
405
406 nullify (int1d_ptr)
407
408 if (nc_vars%grid == 'STRUCTURED') then
409 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int2d), nc_vars%nc_fname)
410 else if (nc_vars%grid == 'LAYERED MESH') then
411 call get_layered_shape(mshape, nlay, array_shape)
412 ncpl = product(array_shape)
413 int1d_ptr(1:ncpl) => int2d(:, :)
414 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
415 nc_vars%nc_fname)
416 end if
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 470 of file NCArrayReader.f90.

472 integer(I4B), dimension(:, :, :), contiguous, pointer, intent(in) :: int3d
473 type(ModflowInputType), intent(in) :: mf6_input
474 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
475 type(InputParamDefinitionType), intent(in) :: idt
476 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
477 character(len=*), intent(in) :: input_fname
478 integer(I4B), dimension(:), allocatable :: layer_shape
479 integer(I4B) :: k !, i, j
480 integer(I4B) :: ncpl, nlay, varid
481 integer(I4B) :: index_start, index_stop
482 integer(I4B), dimension(:), contiguous, pointer :: int1d_ptr
483
484 nullify (int1d_ptr)
485 index_start = 1
486 call get_layered_shape(mshape, nlay, layer_shape)
487 ncpl = product(layer_shape)
488
489 do k = 1, nlay
490 varid = nc_vars%varid(idt%tagname, layer=k)
491 index_stop = index_start + ncpl - 1
492 int1d_ptr(1:ncpl) => int3d(:, :, k:k)
493 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int1d_ptr), &
494 nc_vars%nc_fname)
495 index_start = index_stop + 1
496 end do
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 456 of file NCArrayReader.f90.

458 integer(I4B), dimension(:, :, :), contiguous, pointer, intent(in) :: int3d
459 type(ModflowInputType), intent(in) :: mf6_input
460 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape
461 type(InputParamDefinitionType), intent(in) :: idt
462 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
463 integer(I4B), intent(in) :: varid
464 character(len=*), intent(in) :: input_fname
465 call nf_verify(nf90_get_var(nc_vars%ncid, varid, int3d), nc_vars%nc_fname)
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
[in]kperflag if set > 0 indicates ts

Definition at line 144 of file NCArrayReader.f90.

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

◆ 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 187 of file NCArrayReader.f90.

189 real(DP), dimension(:, :), pointer, contiguous, intent(in) :: dbl2d
190 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
191 type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
192 type(ModflowInputType), intent(in) :: mf6_input
193 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
194 character(len=*), intent(in) :: input_fname
195 integer(I4B), intent(in) :: iout
196 integer(I4B) :: varid
197 logical(LGP) :: layered
198
199 layered = (idt%layered .and. is_layered(nc_vars%grid))
200
201 if (layered) then
202 call load_double2d_layered(dbl2d, mf6_input, mshape, idt, nc_vars, &
203 input_fname)
204 else
205 varid = nc_vars%varid(idt%tagname)
206 call load_double2d_type(dbl2d, mf6_input, mshape, idt, nc_vars, &
207 varid, input_fname)
208 end if

◆ 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 213 of file NCArrayReader.f90.

215 real(DP), dimension(:, :, :), pointer, contiguous, intent(in) :: dbl3d
216 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
217 type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
218 type(ModflowInputType), intent(in) :: mf6_input
219 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
220 character(len=*), intent(in) :: input_fname
221 integer(I4B), intent(in) :: iout
222 integer(I4B) :: varid
223 logical(LGP) :: layered
224
225 layered = (idt%layered .and. is_layered(nc_vars%grid))
226
227 if (layered) then
228 call load_double3d_layered(dbl3d, mf6_input, mshape, idt, nc_vars, &
229 input_fname)
230 else
231 varid = nc_vars%varid(idt%tagname)
232 call load_double3d_type(dbl3d, mf6_input, mshape, idt, nc_vars, &
233 varid, input_fname)
234 end if

◆ 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
[in]kperflag if set > 0 indicates ts

Definition at line 50 of file NCArrayReader.f90.

52 integer(I4B), dimension(:), pointer, contiguous, intent(in) :: int1d
53 integer(I4B), dimension(:), contiguous, pointer, intent(in) :: mshape !< model shape
54 type(InputParamDefinitionType), intent(in) :: idt !< input data type object describing this record
55 type(ModflowInputType), intent(in) :: mf6_input
56 type(NCPackageVarsType), pointer, intent(in) :: nc_vars
57 character(len=*), intent(in) :: input_fname
58 integer(I4B), intent(in) :: iout
59 integer(I4B), optional, intent(in) :: kper !< flag if set > 0 indicates ts
60 integer(I4B) :: varid, iper
61 logical(LGP) :: layered
62
63 iper = 0
64 layered = (idt%layered .and. is_layered(nc_vars%grid))
65
66 if (present(kper)) then
67 iper = kper
68 end if
69
70 if (layered) then
71 if (iper > 0) then
72 call load_integer1d_layered_spd(int1d, mf6_input, mshape, idt, nc_vars, &
73 iper, input_fname)
74 else
75 call load_integer1d_layered(int1d, mf6_input, mshape, idt, nc_vars, &
76 input_fname)
77 end if
78 else
79 if (iper > 0) then
80 call load_integer1d_spd(int1d, mf6_input, mshape, idt, nc_vars, &
81 iper, input_fname)
82 else
83 varid = nc_vars%varid(idt%tagname)
84 call load_integer1d_type(int1d, mf6_input, mshape, idt, nc_vars, &
85 varid, input_fname)
86 end if
87 end if

◆ 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 92 of file NCArrayReader.f90.

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

◆ 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 118 of file NCArrayReader.f90.

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