      implicit none
      integer,parameter :: iq=7200  !longitudinal grid number
      integer,parameter :: jq=3201  !latitudinal  grid number
      integer,parameter :: ntide=4  !tidal constitutes (n=1 M2, n=2 S2, n=3 K1, n=4 O1)
      real :: x(iq)                 !longitdes
      real :: y(jq)                 !latitudes
      real :: omg(ntide)            !tidal frequencies
      real :: dx(iq,jq)             !longitudinal grid size(unit: meter)
      real :: dy(iq,jq)             !latitudinal  grid size(unit: meter)
      real :: dep(iq,jq)            !sea floor depth(unit: meter)
      real ::  ene(iq,jq,ntide)     !baroclinic tidal energy density (unit: Joule/meter^3)
      real :: conv(iq,jq,ntide)     !baroclinic tidal energy conversion rate (unit: Watt/meter^2)
      real :: diss(iq,jq,ntide)     !baroclinit tidal energy dissipation rate (unit: Watt/meter^2)
      integer :: i,j,n,id,jd
!---------Open Binal Big Endian Data-------------------------------------
      open(10,file='ENE-CONV-DISS.DATA',form='unformatted') 
!-------------------------------------------------------------------------
      read(10) id,jd
        if(id.ne.iq) pause 'check iq'
        if(jd.ne.jq) pause 'check jq'             
      read(10)  (x(i),i=1,iq),(y(j),j=1,jq)    
      read(10)  (( dx(i,j),i=1,iq),j=1,jq), & 
                (( dy(i,j),i=1,iq),j=1,jq)    
      read(10)  ((dep(i,j),i=1,iq),j=1,jq)    
      do n=1,ntide
        read(10) omg(n)                         
        read(10) ((  ene(i,j,n),i=1,iq),j=1,jq) 
        read(10) (( conv(i,j,n),i=1,iq),j=1,jq) 
        read(10) (( diss(i,j,n),i=1,iq),j=1,jq) 
      end do        
!----------------------------------------------------------------------------
      stop
      end
