        Program le_grib        

      integer,parameter                         :: nx=1440, ny=721, nz=26
      integer i,j,k,l
      real ht(nx,ny,nz),tp(nx,ny,nz),th(nx,ny,nz),uw(nx,ny,nz),vw(nx,ny,nz),rh(nx,ny,nz),pr(nz),pri(nz),slp(nx,ny,14),temp(nx,ny)

!      real,    dimension(:,:,:) ,allocatable	:: ht	   !Isobaric heights (m)
!      real,    dimension(:,:,:) ,allocatable	:: tp	   !Isobaric temps (K)
!      real,    dimension(:,:,:) ,allocatable	:: th	   !Isobaric theta (K)
!      real,    dimension(:,:,:) ,allocatable	:: uw	   !Isobaric u-wind (m/s)
!      real,    dimension(:,:,:) ,allocatable	:: vw	   !Isobaric v-wind (m/s)
!      real,    dimension(:,:,:) ,allocatable	:: rh	   !Isobaric rh,mr (%,kg/kg)
!      real,    dimension(:)	,allocatable	:: pr,pri  !Isobaric pressures (mb)
!      real,    dimension(:,:,:) ,allocatable	:: slp   


     
!      allocate(ht(nx,ny,nz))
!      allocate(tp(nx,ny,nz))			   
!      allocate(th(nx,ny,nz))			 
!      allocate(uw(nx,ny,nz))		     
!      allocate(vw(nx,ny,nz))		    
!      allocate(rh(nx,ny,nz)) 
!      allocate(slp(nx,ny,14)) 
!      allocate(pr(nz))
!      allocate(pri(nz))    


!       nx=1440  !!!!!!!!!!!!!!!!!!
!       ny=721      
!       nz=26
        print*,nx,ny,nz
       open(11,file='/scratchout/grupos/grpeta/projetos/tempo/oper/gef_v1.0.0_new/INIT_DATA/2019031400.bin',form='unformatted',status='old', access='direct',recl=1440*721*4)     
     

       do 20 l=1,nz
        k=l
       
       read(11,rec=k) ((uw(i,j,l),i=1,nx),j=ny,1,-1) 
   20  continue 

       print*,'uw=',uw(1,1,1)

      
       do 30 l=1,nz

       k=l+26
       read(11,rec=k) ((vw(i,j,l),i=1,nx),j=ny,1,-1)
   30  continue        
       
       print*,'vw=',vw(1,1,1)
       
       do 40 l=1,nz

       k=l+52
       read(11,rec=k) ((ht(i,j,l),i=1,nx),j=ny,1,-1) 
   40  continue 
 
 
       print*,'ht=',ht(1,1,1)
 
       do 50 l=1,nz

       k=l+78
       read(11,rec=k) ((tp(i,j,l),i=1,nx),j=ny,1,-1) 
   50  continue 
 
     
       print*,'tp=',tp(1,1,1)
     
      
       do 60 l=1,nz

       k=l+104
       read(11,rec=k) ((rh(i,j,l),i=1,nx),j=ny,1,-1) 
   60  continue
   
       print*,'rh=',rh(1,1,1)
          
     
     
       read(11,rec=131) ((slp(i,j,1),i=1,nx),j=ny,1,-1) 
       read(11,rec=132) ((slp(i,j,2),i=1,nx),j=ny,1,-1)
       read(11,rec=133) ((slp(i,j,3),i=1,nx),j=ny,1,-1)
       read(11,rec=134) ((slp(i,j,4),i=1,nx),j=ny,1,-1)
       
       read(11,rec=135) ((slp(i,j,5),i=1,nx),j=ny,1,-1)
       read(11,rec=136) ((slp(i,j,6),i=1,nx),j=ny,1,-1)
       read(11,rec=137) ((slp(i,j,7),i=1,nx),j=ny,1,-1)
       read(11,rec=138) ((slp(i,j,8),i=1,nx),j=ny,1,-1)
       read(11,rec=139) ((slp(i,j,9),i=1,nx),j=ny,1,-1)
       read(11,rec=140) ((slp(i,j,10),i=1,nx),j=ny,1,-1)
       read(11,rec=141) ((slp(i,j,11),i=1,nx),j=ny,1,-1)
       read(11,rec=142) ((slp(i,j,12),i=1,nx),j=ny,1,-1)


       OPEN(77,file='/scratchin/grupos/grpeta/projetos/tempo/oper/gef_v1.0.0_new/gef_trunk/PRP/INIT_DATA/feb1998/ICEC_WEASD.bin',form='unformatted',access='direct',status='old',recl=1440*721*4)
   
   
      read(77,rec=1) ((slp(i,j,13),i=1,nx),j=181,1,-1)
      read(77,rec=2) ((slp(i,j,14),i=1,ny),j=181,1,-1)
    

      do i=1,nx
      do j=1,ny
      if (slp(i,j,13).eq.9.9990003E+20) then
      slp(i,j,13)=0.
      endif
    
    
      if (slp(i,j,14).eq.9.9990003E+20) then
      slp(i,j,14)=0.
      endif
      enddo
      enddo 

        do i=1,360
        do j=1,181
!	print*,slp(i,j,13)
        enddo
        enddo
 

!c#########################################  
       print *,'SLP',1,slp(234,70,1)
       print *,'SLP',2,slp(234,70,2)
       print *,'SLP',3,slp(234,70,3)
       print *,'SLP',4,slp(234,70,4)

       print *,'SLP',5,slp(234,70,5)

       print *,'SLP',6,slp(234,70,6)
       print *,'SLP',7,slp(234,70,7)
       print *,'SLP',8,slp(234,70,8)
       print *,'SLP',9,slp(234,70,9)
       print *,'SLP',10,slp(234,70,10)
       print *,'SLP',11,slp(234,70,11)
       print *,'SLP',12,slp(234,70,12)

       print *,'SLP',13,slp(234,70,13)
       print *,'SLP',14,slp(234,70,14)
   
       do l=5,12
!       print *,'SLP',14,slp(:,:,l)
       enddo
   
!       print*,slp(:,:,5)
       
       
!       print*,rh(22,:,23)
       
       
       close(11)
      close(77)

       END PROGRAM     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
     
