SUBROUTINE UA_GRPT ( bullx, lenbx, ibxptr, report, lenr, iret ) C************************************************************************ C* UA_GRPT * C* * C* This subroutine locates and returns the next report from within an * C* upper-air bulletin. Upon entry, IBXPTR points to the character in * C* the bulletin with which to begin the search for the next report. * C* * C* UA_GRPT ( BULLX, LENBX, IBXPTR, REPORT, LENR, IRET ) * C* * C* Input parameters: * C* BULLX CHAR* Text portion of bulletin * C* LENBX INTEGER Length of BULLX * C* * C* Input and output parameters: * C* IBXPTR INTEGER Pointer within BULLX * C* * C* Output parameters: * C* CIVALS (ICPART) CHAR* Part name * C* REPORT CHAR* Report * C* LENR INTEGER Length of REPORT * C* IRET INTEGER Return code: * C* 0 = normal return * C* -1 = no more reports in bulletin* C** * C* Log: * C* J. Ator/NCEP 03/96 * C* J. Ator/NCEP 11/96 Use UT_CRID to decode dropwinsonde ID * C* J. Ator/NCEP 01/97 Check that input string to UT_CRID has * C* positive length * C* J. Ator/NCEP 02/97 Use DRP99A as dropwinsonde ID default * C* J. Ator/NCEP 12/97 New interface format, style changes * C* J. Ator/NCEP 10/98 Don't decode STID for U.S. DROP reports * C* from WMO "second header" line * C* J. Ator/NCEP 12/98 Initialize pnms, lpnms via DATA stmts * C* J. Ator/NCEP 10/99 Clean up function declarations * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'uacmn.cmn' C* CHARACTER*(*) bullx, report C* PARAMETER ( NPNMS = 28 ) C* CHARACTER pnms ( NPNMS )*4 INTEGER lpnms ( NPNMS ) C* DATA pnms + / 'TTAA', 'TTBB', 'TTCC', 'TTDD', + 'UUAA', 'UUBB', 'UUCC', 'UUDD', + 'XXAA', 'XXBB', 'XXCC', 'XXDD', + 'IIAA', 'IIBB', 'IICC', 'IIDD', + 'PPAA', 'PPBB', 'PPCC', 'PPDD', + 'QQAA', 'QQBB', 'QQCC', 'QQDD', + 'EEAA', 'EEBB', 'EECC', 'EEDD' / DATA lpnms + / 4, 4, 4, 4, + 4, 4, 4, 4, + 4, 4, 4, 4, + 4, 4, 4, 4, + 4, 4, 4, 4, + 4, 4, 4, 4, + 4, 4, 4, 4 / C------------------------------------------------------------------------ iret = 0 C C* Check for the end of the bulletin. C IF ( ibxptr .gt. lenbx ) THEN iret = -1 RETURN END IF C C* Look for the start of the next report. C CALL ST_NXTS ( bullx, ibxptr, lenbx, pnms, lpnms, NPNMS, + istart, ipnms, iernx1 ) IF ( iernx1 .ne. 0 ) THEN ibxptr = lenbx + 1 iret = -1 RETURN END IF C C* Determine the part type, station type, and code form type C* for this report. C CALL UA_TYPE ( pnms ( ipnms ), iertyp ) C C* Store the part name. C civals ( icpart ) = pnms ( ipnms ) C C* Now, look for the start of the report that follows this C* next report. C ipt1 = istart + 4 CALL ST_NXTS ( bullx, ipt1, lenbx, pnms, lpnms, NPNMS, + iend, ipnms, iernx2 ) IF ( iernx2 .ne. 0 ) THEN iend = lenbx END IF C C* Now, between the two points that were located above, C* locate the end of the next report. C ipt1 = INDEX ( bullx ( istart : iend ), '=' ) IF ( ipt1 .ne. 0 ) THEN iend = istart + ipt1 - 2 ELSE IF ( iernx2 .eq. 0 ) THEN iend = iend - 1 END IF C C* Set the output values. C report = bullx ( istart : iend ) lenr = iend - istart + 1 ibxptr = iend + 1 C* RETURN END