550 integer(I4B),
intent(in) :: ncid
551 type(MeshNCDimIdType),
intent(inout) :: dim_ids
552 type(MeshNCVarIdType),
intent(inout) :: var_ids
553 type(DisvType),
pointer,
intent(in) :: dis
554 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
555 character(len=*),
intent(in) :: nc_varname
556 character(len=*),
intent(in) :: pkgname
557 character(len=*),
intent(in) :: tagname
558 character(len=*),
intent(in) :: gridmap_name
559 character(len=*),
intent(in) :: shapestr
560 character(len=*),
intent(in) :: longname
561 character(len=*),
intent(in) :: nc_tag
562 integer(I4B),
intent(in) :: deflate
563 integer(I4B),
intent(in) :: shuffle
564 integer(I4B),
intent(in) :: chunk_face
565 integer(I4B),
intent(in) :: iper
566 character(len=*),
intent(in) :: nc_fname
568 integer(I4B),
dimension(2) :: dis_shape
569 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
570 integer(I4B) :: axis_sz, nvals, k
571 integer(I4B),
dimension(:),
allocatable :: var_id
572 character(len=LINELENGTH) :: longname_l, varname_l
574 if (shapestr ==
'NCPL')
then
577 varname_l = export_varname(nc_varname)
578 longname_l = export_longname(longname, pkgname, tagname, layer=0, iper=iper)
581 axis_sz = dim_ids%nmesh_face
584 call nf_verify(nf90_redef(ncid), nc_fname)
585 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
586 (/axis_sz/), var_id(1)), &
590 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
592 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
595 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
596 (/nf90_fill_int/)), nc_fname)
597 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
598 longname_l), nc_fname)
601 call ncvar_gridmap(ncid, var_id(1), gridmap_name, nc_fname)
602 call ncvar_mf6attr(ncid, var_id(1), 0, iper, 0, nc_tag, nc_fname)
605 call nf_verify(nf90_enddef(ncid), nc_fname)
606 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
610 allocate (var_id(dis%nlay))
613 call nf_verify(nf90_redef(ncid), nc_fname)
617 varname_l = export_varname(nc_varname, layer=k, iper=iper)
618 longname_l = export_longname(longname, pkgname, tagname, layer=k, &
621 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
622 (/dim_ids%nmesh_face/), var_id(k)), &
626 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
628 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
631 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
632 (/nf90_fill_int/)), nc_fname)
633 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
634 longname_l), nc_fname)
637 call ncvar_gridmap(ncid, var_id(k), gridmap_name, nc_fname)
638 call ncvar_mf6attr(ncid, var_id(k), k, iper, 0, nc_tag, nc_fname)
642 dis_shape(1) = dis%ncpl
643 dis_shape(2) = dis%nlay
644 nvals = product(dis_shape)
645 int2d(1:dis_shape(1), 1:dis_shape(2)) => p_mem(1:nvals)
648 call nf_verify(nf90_enddef(ncid), nc_fname)
650 call nf_verify(nf90_put_var(ncid, var_id(k), int2d(:, k)), nc_fname)