subroutine stats_write_tavg_kslice implicit none integer :: n, k real, allocatable :: fld(:,:,:), tmp(:,:,:) allocate(fld(ib:ie, jb:je, kb:ke), tmp(ib:ie, jb:je, nkslice)) if (myidy == 0) call writestat_nc(ncidtks, 'time', timee, nrectks, .true.) do n = 1, tVarsCount call stats_tavg_field(trim(tVars(n,1)), fld) do k = 1, nkslice tmp(:,:,k) = fld(:, :, kslice(k)) end do call writeoffset(ncidtks, trim(tVars(n,1)), tmp, nrectks, xdim, ydim, nkslice) end do deallocate(fld, tmp) call stats_write_pedestrian_wind(ncidtks, nrectks) end subroutine stats_write_tavg_kslice