subroutine ndarray_oc_dump_hook(pf, lev, state)
type(pf_pfasst_t), intent(inout) :: pf
type(pf_level_t), intent(inout) :: lev
type(pf_state_t), intent(in) :: state
character(len=256) :: fnamey, fnamep
type(ndarray_oc), pointer :: qend
qend => cast_as_ndarray_oc(lev%qend)
write(fnamey, "('y_s',i0.2,'i',i0.3,'l',i0.2,'.npy')") &
state%step, state%iter, lev%index
call ndarray_dump_numpy(trim(pf%outdir)//c_null_char, trim(fnamey)//c_null_char, '<f8'//c_null_char//c_null_char, &
qend%dim, qend%shape, size(qend%yflatarray), qend%yflatarray)
write(fnamep, "('p_s',i0.2,'i',i0.3,'l',i0.2,'.npy')") &
state%step, state%iter, lev%index
call ndarray_dump_numpy(trim(pf%outdir)//c_null_char, trim(fnamep)//c_null_char, '<f8'//c_null_char//c_null_char, &
qend%dim, qend%shape, size(qend%pflatarray), qend%pflatarray)
end subroutine ndarray_oc_dump_hook