SUBROUTINE DB_WSPD ( dburpt, ipt, iret ) C************************************************************************ C* DB_WSPD * C* * C* This subroutine decodes the wind speed in the 0ddff group. If the * C* speed is reported in knots, it is converted to meters per second. * C* When the speed is greater than 98 units, the ff is set to 99, and a * C* 00fff group follows. In this case the fff contains the wind speed. * C* * C* DB_WSPD ( DBURPT, IPT, IRET ) * C* * C* Input parameters: * C* DBURPT CHAR* Report array * C* RIVALS (IRISWS) REAL Indicator for source and * C* units of wind speed * C* (WMO Code Table 1855) * C* * C* Input and Output parameters: * C* IPT INTEGER On input, points to start of * C* data; on output, points to last * C* f in group * C* * C* Output parameters: * C* RIVALS(IRSPED) REAL Wind speed in m/sec * C* IRET INTEGER Return code * C* 0 = Normal return * C* 1 = Problems * C* * C** * C* Log: * C* R. Hollern/NCEP 12/99 * C* C. Caruso Magee/NCEP 03/2000 fixed docblock comments. * C* J. Ator/NCEP 01/02 Use ISWS for units of wind speed * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'dbcmn.cmn' C* CHARACTER*(*) dburpt C* CHARACTER fld3*3, fld2*2 C* INCLUDE 'ERMISS.FNC' C------------------------------------------------------------------------ iret = 0 C C* Check if wind indicator is missing. C IF ( ERMISS ( rivals ( irisws ) ) ) THEN ipt = ipt + 1 RETURN END IF C IF ( dburpt ( ipt:ipt ) .eq. '/' .or. + dburpt ( ipt+1:ipt+1 ) .eq. '/' ) THEN ipt = ipt + 1 RETURN END IF fld2 = dburpt ( ipt:ipt+1 ) CALL ST_INTG ( fld2, ival, ier ) ipt = ipt + 1 IF ( ier .ne. 0 ) RETURN IF ( ival .ge. 0 .and. ival .le. 99 ) THEN xval = ival ELSE RETURN END IF C C* If wind speed equals 99 units, then the next group 00fff C* contains the wind speed. C IF ( ival .eq. 99 ) THEN ipt = ipt + 1 IF ( dburpt ( ipt:ipt+2 ) .eq. ' 00' ) THEN ipt = ipt + 3 fld3 = dburpt ( ipt:ipt+2 ) CALL ST_INTG ( fld3, jval, ier ) ipt = ipt + 2 IF ( ier .ne. 0 ) RETURN xval = jval END IF END IF C IF ( rivals ( irisws ) .gt. 2 ) THEN C C* Convert from knots to m/sec. C wdspd = PR_KNMS ( xval ) ELSE wdspd = xval END IF C rivals ( irsped ) = wdspd C* RETURN END