SUBROUTINE MA_WSPD ( marrpt, iparam, ipt, iret ) C************************************************************************ C* MA_WSPD * C* * C* This subroutine decodes the wind speed in the Nddff group, the wind * C* gust in the 910ff, 911ff, or 912ff groups, the 10 meter extrapolated * C* wind in the 11fff group, and the 20 meter extrapolated wind in the * C* 22fff group. If the speed is reported in knots, it is converted to * C* meters per second. When the speed is greater than 98 units, the ff * C* is set to 99, and a 00fff group follows. In this case the fff * C* contains the wind speed. * C* * C* MA_WSPD ( MARRPT, IPARAM, IPT, IRET ) * C* * C* Input parameters: * C* MARRPT CHAR* Report array * C* IPARAM INTEGER Flag set to 0, 1, 2, 3, 4, or * C* 5, if decoding, respectively, * C* the groups Nddff, 910ff, * C* 912ff, 11fff, 22fff, or 911ff * C* RIVALS (IRISWS) REAL Indicator for source and * C* units of wind speed * C* (WMO Code Table 1855) * C* XM907 REAL Duration of reference period * C* for gust * C* IFLGCO INTEGER Flag set to 1, if US or * C* Canadian report; otherwise 0 * 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* RIVALS(IRNSPW) REAL Number of supplementary wind * C* groups * C* RIVALS(IRSPWP) REAL Duration in minutes of wind * C* periods * C* RIVALS(IRSPWS) REAL Supplementary winds in m/sec * C* RIVALS(IRSPWT) REAL NCEP Code Table to indicate * C* whether gust from 910ff, 911ff, * C* or 912ff group * C* RIVALS(IRXS10) REAL Wind speed in m/sec from 11fff * C* RIVALS(IRXS20) REAL Wind speed in m/sec from 22fff * C* IRET INTEGER Return code * C* 0 = Normal return * C* 1 = Problems * C* * C** * C* Log: * C* R. Hollern/NCEP 4/96 * C* R. Hollern/NCEP 11/96 Added call to PR_KNMS * C* D. Kidwell/NCEP 4/97 Removed interface calls, reorganized * C* header and comments * C* D. Kidwell/NCEP 10/97 Changed interface * C* R. Hollern/NCEP 11/99 Added call to MA_SPWD * C* J. Ator/NCEP 01/02 Use ISWS for units of wind speed * C* C. C. Magee/NCEP 01/04 Remove refs to XDTFVM, GUMS, WDGFLG, and* C* rivals array elements irgum0, irgum1, * C* and irgum2 (obsolete) * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'macmn.cmn' C* CHARACTER*(*) marrpt 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 ( iparam .eq. 0 .or. iparam .eq. 1 .or. + iparam .eq. 2 .or. iparam .eq. 5 ) THEN C IF ( marrpt ( ipt:ipt ) .ne. '/' .and. + marrpt ( ipt+1:ipt+1 ) .ne. '/' ) THEN fld2 = marrpt ( ipt:ipt+1 ) CALL ST_INTG ( fld2, ival, ier ) ipt = ipt + 1 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 + 1 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 ( marrpt ( ipt:ipt+2 ) .eq. ' 00' ) THEN ipt = ipt + 3 fld3 = marrpt ( ipt:ipt+2 ) CALL ST_INTG ( fld3, jval, ier ) ipt = ipt + 2 IF ( ier .eq. 0 ) THEN xval = jval ELSE RETURN END IF END IF END IF C END IF C IF ( iparam .eq. 3 .or. iparam .eq. 4 ) THEN C C* Get 10 or 20 meter extrapolated wind. C IF ( marrpt ( ipt:ipt+2 ) .ne. '///' ) THEN fld3 = marrpt ( ipt:ipt+2 ) CALL ST_INTG( fld3, ival, ier ) ipt = ipt + 2 IF ( ier .eq. 0 ) THEN IF ( rivals ( irisws ) .gt. 2 ) THEN C C* Units are in whole knots. C xval = FLOAT ( ival ) ELSE C C* Convert from tenths of m/sec to m/sec. C xval = .1 * FLOAT ( ival ) END IF ELSE RETURN END IF ELSE ipt = ipt + 2 RETURN END IF C 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 IF ( iparam .eq. 0 ) THEN rivals ( irsped ) = wdspd ELSE IF ( iparam .eq. 1 ) THEN C CALL MA_SPWD ( iparam, wdspd, iret ) C ELSE IF ( iparam .eq. 2 ) THEN C CALL MA_SPWD ( iparam, wdspd, iret ) C ELSE IF ( iparam .eq. 5 ) THEN C CALL MA_SPWD ( iparam, wdspd, iret ) C ELSE IF ( iparam .eq. 3 ) THEN C C* Get 10 meter extrapolated wind speed. C rivals ( irxs10 ) = wdspd ELSE IF ( iparam .eq. 4 ) THEN C C* Get 20 meter extrapolated wind speed. C rivals ( irxs20 ) = wdspd END IF C* RETURN END