538 integer(I4B),
intent(in) :: ncid
539 type(MeshNCDimIdType),
intent(inout) :: dim_ids
540 type(MeshNCVarIdType),
intent(inout) :: var_ids
541 type(DisvType),
pointer,
intent(in) :: dis
542 integer(I4B),
dimension(:),
pointer,
contiguous,
intent(in) :: p_mem
543 character(len=*),
intent(in) :: nc_varname
544 character(len=*),
intent(in) :: pkgname
545 character(len=*),
intent(in) :: tagname
546 character(len=*),
intent(in) :: gridmap_name
547 character(len=*),
intent(in) :: shapestr
548 character(len=*),
intent(in) :: longname
549 character(len=*),
intent(in) :: nc_tag
550 integer(I4B),
intent(in) :: deflate
551 integer(I4B),
intent(in) :: shuffle
552 integer(I4B),
intent(in) :: chunk_face
553 integer(I4B),
intent(in) :: iper
554 character(len=*),
intent(in) :: nc_fname
555 integer(I4B),
dimension(2) :: dis_shape
556 integer(I4B),
dimension(:, :),
pointer,
contiguous :: int2d
557 integer(I4B) :: axis_sz, nvals, k
558 integer(I4B),
dimension(:),
allocatable :: var_id
559 character(len=LINELENGTH) :: longname_l, varname_l
561 if (shapestr ==
'NCPL')
then
563 varname_l = export_varname(nc_varname)
564 longname_l = export_longname(longname, pkgname, tagname, layer=0, iper=iper)
567 axis_sz = dim_ids%nmesh_face
570 call nf_verify(nf90_redef(ncid), nc_fname)
571 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
572 (/axis_sz/), var_id(1)), &
576 call ncvar_chunk(ncid, var_id(1), chunk_face, nc_fname)
578 call ncvar_deflate(ncid, var_id(1), deflate, shuffle, nc_fname)
581 call nf_verify(nf90_put_att(ncid, var_id(1),
'_FillValue', &
582 (/nf90_fill_int/)), nc_fname)
583 call nf_verify(nf90_put_att(ncid, var_id(1),
'long_name', &
584 longname_l), nc_fname)
587 call ncvar_gridmap(ncid, var_id(1), gridmap_name, nc_fname)
588 call ncvar_mf6attr(ncid, var_id(1), 0, iper, 0, nc_tag, nc_fname)
591 call nf_verify(nf90_enddef(ncid), nc_fname)
592 call nf_verify(nf90_put_var(ncid, var_id(1), p_mem), &
596 allocate (var_id(dis%nlay))
599 call nf_verify(nf90_redef(ncid), nc_fname)
602 varname_l = export_varname(nc_varname, layer=k, iper=iper)
603 longname_l = export_longname(longname, pkgname, tagname, layer=k, &
606 call nf_verify(nf90_def_var(ncid, varname_l, nf90_int, &
607 (/dim_ids%nmesh_face/), var_id(k)), &
611 call ncvar_chunk(ncid, var_id(k), chunk_face, nc_fname)
613 call ncvar_deflate(ncid, var_id(k), deflate, shuffle, nc_fname)
616 call nf_verify(nf90_put_att(ncid, var_id(k),
'_FillValue', &
617 (/nf90_fill_int/)), nc_fname)
618 call nf_verify(nf90_put_att(ncid, var_id(k),
'long_name', &
619 longname_l), nc_fname)
622 call ncvar_gridmap(ncid, var_id(k), gridmap_name, nc_fname)
623 call ncvar_mf6attr(ncid, var_id(k), k, iper, 0, nc_tag, nc_fname)
627 dis_shape(1) = dis%ncpl
628 dis_shape(2) = dis%nlay
629 nvals = product(dis_shape)
630 int2d(1:dis_shape(1), 1:dis_shape(2)) => p_mem(1:nvals)
633 call nf_verify(nf90_enddef(ncid), nc_fname)
635 call nf_verify(nf90_put_var(ncid, var_id(k), int2d(:, k)), nc_fname)