SUBROUTINE MA_PKWD ( marrpt, ipt, iret ) C************************************************************************ C* MA_PKWD * C* * C* This subroutine decodes the 3GGgg and 4ddf(m)f(m)f(m) groups in the * C* 555 section of the report. These groups contain the time, direction, * C* and speed of the peak wind in the previous hour. For fixed buoy * C* reports the 4-group is 4ddf(m)f(m). * C* * C* MA_PKWD ( MARRPT, IPT, IRET ) * C* * C* Input parameters: * C* MARRPT CHAR* Report array * C* RIVALS (IRISWS) REAL Indicator for source and * C* units of wind speed * C* (WMO Code Table 1855) * C* IRPTDT (*) INTEGER Report date-time * C* (YYYY, MM, DD, HH, MM) * C* * C* Input and output parameters: * C* IPT INTEGER On input, points to first 'G' in* C* 3GGgg group; on output, points * C* to last 'f' in 4-group * C* * C* Output parameters: * C* RIVALS(IRPWYR) REAL Time of peak wind (5 values) * C* RIVALS(IRPWDR) REAL Peak wind direction * C* RIVALS(IRPWSP) REAL Peak wind speed, m/sec * C* IRET INTEGER Return code * C* 0 = Normal return * C* 1 = Problems * C* * C** * C* Log: * C* R. Hollern/NCEP 6/96 * C* R. Hollern/NCEP 11/96 Added call to PR_KNMS * C* R. Hollern/NCEP 12/96 Replaced ST_C2R with ST_INTG * C* D. Kidwell/NCEP 4/97 Removed interface calls, reorganized * C* header and comments * C* D. Kidwell/NCEP 10/97 Changed interface * C* J. Ator/NCEP 01/02 Use ISWS for units of wind speed * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'macmn.cmn' C* CHARACTER*(*) marrpt C* INTEGER mrptdt (5) CHARACTER fld3*3, fld2*2 C------------------------------------------------------------------------ iret = 0 C IF ( marrpt ( ipt:ipt+3 ) .eq. '////' ) THEN ipt = ipt + 3 RETURN END IF C C* Get the UTC hour and minutes after the hour of the peak wind. C fld2 = marrpt ( ipt:ipt+1 ) CALL ST_INTG ( fld2, ihh, ier ) IF ( ier .ne. 0 ) RETURN C ipt = ipt + 2 fld2 = marrpt ( ipt:ipt+1 ) CALL ST_INTG ( fld2, imm, ier ) IF ( ier .ne. 0 ) RETURN C C* Get year, month, day of month, hour, and minutes of peak wind C* observation time. C mrptdt (1) = irptdt (1) mrptdt (2) = irptdt (2) mrptdt (3) = irptdt (3) mrptdt (4) = ihh mrptdt (5) = imm C C* Check if obs time of peak wind is in previous day. C IF ( ihh .gt. irptdt (4) ) CALL TI_SUBD ( mrptdt, mrptdt, ier ) C DO i = 0, 4 rivals ( irpwyr + i ) = FLOAT ( mrptdt ( i + 1 ) ) END DO C ipt = ipt + 2 C IF ( marrpt ( ipt:ipt+1 ) .ne. ' 4' ) RETURN C C* Get true direction of peak wind in tens of degrees. C ipt = ipt + 2 fld2 = marrpt ( ipt:ipt+1 ) CALL ST_INTG ( fld2, ival, ier ) IF ( ier .eq. 0 ) THEN rivals ( irpwdr ) = 10. * FLOAT ( ival ) ELSE RETURN END IF C C* Get wind speed in meters/second. C ipt = ipt + 2 C IF ( rivals ( irisws ) .gt. 2 ) THEN C C* Have a CMAN station. C fld3 = marrpt ( ipt:ipt+2 ) ipt = ipt + 2 CALL ST_INTG ( fld3, ival, ier ) IF ( ier .eq. 0 ) rivals ( irpwsp ) = PR_KNMS (FLOAT (ival)) ELSE C C* Have a fixed buoy report. C fld2 = marrpt ( ipt:ipt+1 ) ipt = ipt + 1 CALL ST_INTG ( fld2, ival, ier ) IF ( ier .eq. 0 ) rivals ( irpwsp ) = FLOAT ( ival ) END IF C* RETURN END