SUBROUTINE BT_DDFF ( report, ipt, iret ) C************************************************************************ C* BT_DDFF * C* * C* This subroutine decodes the iddff wind data group. * C* * C* BT_DDFF ( report, ipt, iret ) * C* * C* Input parameters: * C* REPORT CHAR* Report array * C* * C* Input and Output parameters: * C* IPT INTEGER On input, points to start of * C* iddff group; on output, to start* C* of next group * C* * C* Output parameters: * C* RIVALS(IRIUWS) REAL Indicator for units of wind * C* speed and type of instrumntation* C* (WMO Code Table 1853) * C* RIVALS(IRDRCT) REAL Wind direction in degrees * C* RIVALS(IRSPED) REAL Wind speed in meters/second * C* IRET INTEGER Return code * C* 0 = Normal return * C* 1 = Problems * C* * C** * C* Log: * C* R. Hollern/NCEP 11/98 * C* J. Ator/NCEP 01/02 SUWS -> IUWS * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'btcmn.cmn' C CHARACTER*(*) report C CHARACTER fld2*2, fld1*1 C------------------------------------------------------------------------ iret = 0 wdrct = RMISSD wdspd = RMISSD ival = IMISSD ip = ipt C C* Get indicator of units of wind speed. C fld1 = report (ipt:ipt) IF ( fld1 .ne. '/' ) THEN CALL ST_INTG ( fld1, iuwind, ier ) IF ( ier .eq. 0 ) THEN ipt = ipt + 1 ELSE ipt = ipt + 6 RETURN END IF END IF C C* Get wind direction in degrees. C IF ( report ( ipt:ipt ) .ne. '/' .and. + report ( ipt:ipt+1 ) .ne. '/' ) THEN fld2 = report ( ipt:ipt+1 ) CALL ST_INTG ( fld2, ival, ier ) IF ( ier .eq. 0 ) THEN IF ( ival .ge. 0 .and. ival .le. 36 ) THEN wdrct = 10. * FLOAT ( ival ) ELSE IF ( ival .eq. 99 ) THEN C C* Direction is variable, or all directions (WMO Code C* Table 0877). C wdrct = 99. END IF END IF END IF C C* Get wind speed in meters/second. C ipt = ipt + 2 C IF ( report ( ipt:ipt ) .ne. '/' .and. + report ( ipt+1:ipt+1 ) .ne. '/' ) THEN fld2 = report ( ipt:ipt+1 ) ipt = ipt + 3 CALL ST_INTG ( fld2, ival, ier ) IF ( ier .eq. 0 ) THEN IF ( ival .ge. 0 .and. ival .le. 99 ) THEN xval = ival ELSE RETURN END IF ELSE RETURN END IF ELSE ipt = ipt + 3 RETURN END IF C IF ( iuwind .eq. 1 .or. iuwind .eq. 3 ) THEN C C* Convert from knots to m/sec. C wdspd = PR_KNMS ( xval ) ELSE IF ( iuwind .eq. 0 .or. iuwind .eq. 2 ) THEN wdspd = xval ELSE RETURN END IF C rivals ( iriuws ) = FLOAT ( iuwind ) rivals ( irsped ) = wdspd C C* If direction is variable but speed is 0, set direction to C* missing. C IF ( ival .eq. 99 .and. rivals ( irsped ) .eq. 0.0 ) THEN wdrct = RMISSD END IF C rivals ( irdrct ) = wdrct C* RETURN END