SUBROUTINE SY_SGDS ( iubfma, iubfmn )
C************************************************************************
C* SY_SGDS								*
C*									*
C* This routine gets and stores the data for state of ground, snow	*
C* depth and ground minimum temperature.				*
C*									*
C* SY_SGDS ( IUBFMA, IUBFMN )						*
C*									*
C* Input parameters:							*
C*	IUBFMA		INTEGER		Logical unit number of messages	*
C*					file for BUFR input stream	*
C*	IUBFMN		INTEGER		Logical unit number of messages	*
C*					file for BUFR output stream	*
C**									*
C* Log:									*
C* J. Ator/NCEP		01/13						*
C************************************************************************
	INCLUDE		'GEMPRM.PRM'
	INCLUDE		'sycmn.cmn'
C*
	REAL*8		r8sgds (4), r8gmth
C*-----------------------------------------------------------------------
C
C*	Get the data.
C
	IF ( gots96 .or. gots91 ) THEN
	    CALL UFBSEQ ( iubfma, r8sgds, 4, 1, nlv, 'STGDSNDM' )
	    CALL UFBINT ( iubfma, r8gmth, 1, 1, nlv, 'GMITH' )
	ELSE
	    CALL UFBSEQ ( iubfma, r8wk, MXMN, MXLV, nlv, 'STATEGRD' )
	    r8sgds (1) = r8bfms
	    r8sgds (2) = r8wk (1,1)
	    r8sgds (3) = r8bfms
	    r8sgds (4) = r8wk (2,1)
	    r8gmth = r8wk (3,1)
	END IF
C
C*	Store the data, unless it's missing.
C
	IF ( ( IBFMS ( r8sgds (2) ) .eq. 0 ) .or.
     +	     ( IBFMS ( r8sgds (4) ) .eq. 0 ) ) THEN
	    CALL DRFINI ( iubfmn, 1, 1, '<STGDSNDM>' )
	    CALL UFBSEQ ( iubfmn, r8sgds, 4, 1, nlv, 'STGDSNDM' )
	END IF
	CALL UFBINT ( iubfmn, r8gmth, 1, 1, nlv, 'GMITH' )
C*
	RETURN
	END