!-------------------------------------- LICENCE BEGIN ------------------------------------
!Environment Canada - Atmospheric Science and Technology License/Disclaimer,
! version 3; Last Modified: May 7, 2008.
!This is free but copyrighted software; you can use/redistribute/modify it under the terms
!of the Environment Canada - Atmospheric Science and Technology License/Disclaimer
!version 3 or (at your option) any later version that should be found at:
!http://collaboration.cmc.ec.gc.ca/science/rpn.comm/license.html
!
!This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
!without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
!See the above mentioned License/Disclaimer for more details.
!You should have received a copy of the License/Disclaimer along with this software;
!if not, you can write to: EC-RPN COMM Group, 2121 TransCanada, suite 500, Dorval (Quebec),
!CANADA, H9P 1J3; or send e-mail to service.rpn@ec.gc.ca
!-------------------------------------- LICENCE END --------------------------------------
!
subroutine prdatabin 1,2
use modfgat
, only : nstamplist, nobsgid, nobs, notag, nstepobs
use modmask
, only : lmask,ldiag,lmaskto
IMPLICIT NONE
#include "comdim.cdk"
#include "comdimo.cdk"
#include "comlun.cdk"
#include "comcst.cdk"
#include "comoabdy.cdk"
#include "comoahdr.cdk"
#include "comoba.cdk"
#include "comgdpar.cdk"
#include "cvcord.cdk"
#include "comfilt.cdk"
#include "comct0.cdk"
#include "comvfiles.cdk"
#include "comsv.cdk"
#include "comcva.cdk"
integer :: jstep,jobs,jfile,jdata,ibeginobs,ilastobs,iobs,idatabeg
integer :: idatend
integer, allocatable, dimension(:,:) :: idataass
allocate(idataass(nfiles,nstepobs+1))
idataass = 0
do jstep = 1,nstepobs
do jobs = 1, nobs(jstep)
iobs = notag(jobs,jstep)
idatabeg = mobhdr(ncmrln,iobs)
idatend = mobhdr(ncmnlv,iobs) + idatabeg - 1
do jfile = 1, nfiles
if(nbegintyp(jfile) .gt. 0) then
ibeginobs = mobdata(ncmobs,nbegintyp(jfile))
ilastobs=mobdata(ncmobs,nendtyp(jfile))
if(iobs.ge.ibeginobs .and. iobs .le. ilastobs) then
do jdata = idatabeg, idatend
if ( mobdata(ncmass,jdata) .eq. 1) then
idataass(jfile,jstep) = idataass(jfile,jstep) + 1
idataass(jfile,nstepobs+1) = idataass(jfile,nstepobs
& +1) + 1
endif
enddo
endif
endif
enddo
enddo
enddo
write(nulout,*)'Distribution of assimilated data over stepobs'
write(nulout,*)'Bin# :',(jstep,jstep=1,nstepobs),'Total'
do jfile = 1, nfiles
if(nbegintyp(jfile) .gt. 0) then
if(cfamtyp(jfile) .ne. cfamtyp(jfile+1)) then
write(nulout,*) cfamtyp(jfile),':',(idataass(jfile,jstep)
& ,jstep=1,nstepobs+1)
else
do jstep = 1,nstepobs+1
idataass(jfile+1,jstep) = idataass(jfile,jstep) +
& idataass(jfile+1,jstep)
enddo
endif
endif
enddo
write(nulout,*)'_______________________________________________'
end subroutine