SUBROUTINE UA_DDTE ( report, lenr, irptr, iret ) C************************************************************************ C* UA_DDTE * C* * C* This subroutine decodes the date (day/hour). * C* * C* UA_DDTE ( REPORT, LENR, IRPTR, IRET ) * C* * C* Input parameters: * C* REPORT CHAR* Report * C* LENR INTEGER Length of REPORT * C* * C* Input and output parameters: * C* IRPTR INTEGER Pointer within REPORT * C* * C* Output parameters: * C* RIVALS (IRDAYS) REAL Report day * C* RIVALS (IRHOUR) REAL Report hour * C* RIVALS (IRA4ME) REAL Type of measuring equipment * C* RIVALS (IRTIWM) REAL Type of instrumentation for * C* wind measurement * C* (WMO BUFR Table 0 02 002) * C* IDFLAG CHAR Id wind level flag * C* IRET INTEGER Return code: * C* 0 = normal return * C* -1 = critical error in REPORT * C* or reached end of REPORT * C** * C* Log: * C* J. Ator/NCEP 03/96 * C* J. Ator/NCEP 10/96 Removed ERRRPT * C* J. Ator/NCEP 12/97 New interface format, style changes * C* J. Ator/NCEP 10/99 Clean up function declarations * C* J. Ator/NCEP 01/02 wspdu -> RIVALS (IRTIWM) * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'uacmn.cmn' C* CHARACTER*(*) report C* CHARACTER field*(MXLENF) C------------------------------------------------------------------------ iret = -1 C C* Get the date group. C CALL UA_GFLD ( report, lenr, irptr, field, lenf, ier ) IF ( ier .ne. 0 ) THEN RETURN ELSE IF ( lenf .ne. 5 ) THEN logmsg = 'date group ' // field (1:lenf) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF C C* Decode the day of the month from the date group. C C* If the day of the month is encoded as (50 + day of the month), C* then wind speeds within this report are encoded in units of C* knots. Otherwise, wind speeds within this report are encoded C* in units of meters per second. C CALL ST_INTG ( field (1:2), idays, ier ) IF ( ier .ne. 0 ) THEN logmsg = 'report day ' // field (1:2) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF C IF ( idays .gt. 50 ) THEN C C* Wind speeds are reported in knots. C idays = idays - 50 rivals ( irtiwm ) = 4. ELSE C C* Wind speeds are reported in meters per second. C rivals ( irtiwm ) = 0. END IF C IF ( ( idays .lt. 0 ) .or. ( idays .gt. 31 ) ) THEN logmsg = 'report day ' // field (1:2) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF rivals ( irdays ) = FLOAT ( idays ) C C* Decode the hour from the date group. C CALL ST_INTG ( field (3:4), ihour, ier ) IF ( ( ier .ne. 0 ) .or. + ( ( ihour .lt. 0 ) .or. ( ihour .gt. 23 ) ) ) THEN logmsg = 'report hour ' // field (3:4) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF rivals ( irhour ) = FLOAT ( ihour ) C C* Decode the fifth character from the date group. C IF ( ( cftyp .eq. TEMP ) .and. + ( ( prttyp .eq. AA ) .or. ( prttyp .eq. CC ) ) ) THEN C C* The fifth character of the date group is the C* Id wind level flag. C idflag = field (5:5) ELSE C C* The fifth character of the date group indicates C* the type of measuring equipment used. C C* This value is stored in the interface format as C* a code figure from WMO Code Table 0265. C CALL ST_INTG ( field (5:5), ia4me, ier ) IF ( ier .eq. 0 ) THEN rivals ( ira4me ) = FLOAT ( ia4me ) END IF END IF C iret = 0 C* RETURN END