!--------------------------------------------------------------------------------------------------
! SUBROUTINE: GRIDST - READ GLOBAL GRIB SST                           
!
! ABSTRACT: SUBSTITUTE THE GRIBST SUB PROGRAM READ THE SST FIELD IN A BINARY FORMAT INSTED A GRIB
!           FORMAT IN THIS CASE THE BINARY FILE IS GENERATE FROM SST GRIB2 FILE WITH WGRIB2 
!           PROGRAM: 
!           wgrib2 -d 1 sst2dvar_grb_0.5.grib2 -v \ -no_header big_endian -bin ssthiresgrd.bin
!
! PROGRAM HISTORY LOG:
! 08-11-03 - JORGE LUIS GOMES
!--------------------------------------------------------------------------------------------------
    SUBROUTINE GRIDST(INSST,GSST)
!
    IMPLICIT NONE
!
    INTEGER     ,   PARAMETER :: NX   = 4320
    INTEGER     ,   PARAMETER :: NY   = 2160 
    INTEGER     ,   PARAMETER :: NXP1 = NX + 1
!
    INTEGER                                                                             ::&
    & INSST   , I       , J       , JJ      , KK 
!
    REAL        , DIMENSION(NX,NY)                                                      ::&
    & OUTI
!
    REAL        , DIMENSION(NXP1,NY)                                                    ::&
    & GSST
!
    OPEN (INSST, FILE='sstgrb_gfs', FORM='unformatted',CONVERT='big_endian')
!
    READ(INSST) ((OUTI(I,(NY+1)-J),I=1,NX),J=1,NY)
!
    DO JJ=1,NY
        DO KK=1,NX
            GSST(KK,JJ) = OUTI(KK,JJ)
        END DO
    END DO
!-----------------------------------
! ADD GREENICH TO RIGHT SIDE OF GRID
!-----------------------------------
    DO JJ=1,NY
        GSST(NXP1,JJ) = GSST(1,JJ)
    END DO
!
    WRITE(0,*) 'LEAVING GRIDST'
!
    RETURN
!
    END SUBROUTINE GRIDST
