SUBROUTINE CG_PRSN ( cgrpt, mszrpt, ipt, iret ) C************************************************************************ C* CG_PRSN * C* * C* This subroutine decodes the altimeter/pressure and remarks fields in * C* a report. It determines whether a field is alpha, numeric, or other * C* and calls CG_PRTM to decode the numeric fields (altimeter, pressure, * C* max/min temp.) and calls CG_RMKA to decode the alpha fields (tide * C* level, wind gusts, ceiling, max wave heights, swell direction). * C* * C* CG_PRSN ( CGRPT, MSZRPT, IPT, IRET ) * C* * C* Input parameters: * C* MSZRPT INTEGER Length of report in bytes * C* CGRPT CHAR* Report array * C* * C* Input and Output parameters: * C* IPT INTEGER Pointer to start of field. * C* * C* Output parameters: * C* IRET INTEGER Return code * C* 0 = Normal return * C** * C* Log: * C* C. Caruso Magee/NCEP 4/00 Original Author * C* J. Ator/NCEP 8/01 CG_BKGP -> UT_BKGP * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'cgcmn.cmn' character*(*) cgrpt character*100 stprsn, outst logical presdone, rmksdone integer length integer kret integer fldnoin, fldnoout iret = 0 C C* pressure, remarks, station name fields lie between ipt and C* iendwd (inclusive). C* compress extra blanks out of field so only single blanks separate C* each substring. C presdone = .false. rmksdone = .false. stprsn = cgrpt(ipt:mszrpt) CALL ST_RXBL ( stprsn, outst, length, kret ) IF ( length .gt. 1 ) THEN C C* split wind group into 'like-type'groups to facilitate decoding. C CALL UT_BKGP ( outst, iretbg ) IF ( iretbg .ne. 0 ) THEN ipt = mszrpt RETURN END IF IF ( nflds .eq. 0 ) THEN ipt = mszrpt RETURN ELSE IF ( itypsf(1) .eq. ALPHA ) THEN presdone = .true. IF ( lensf(1) .eq. 1 .and. fields(1) .eq. 'M' ) THEN C C* Pressure field is set to 'M' (missing). C* Check 2nd field to see if alpha or numeric (or other) C* and call the appropriate s/r (if other, skip this field). C presdone = .true. fldnoin = 2 IF ( itypsf(2) .eq. ALPHA ) THEN CALL CG_RMKA ( fldnoin, fldnoout, presdone, * rmksdone, ier ) ELSEIF ( itypsf(2) .eq. NMR ) THEN CALL CG_PRTM ( fldnoin, fldnoout, presdone, * rmksdone, ier ) END IF ipt = mszrpt RETURN ELSE C C* first field is either Remarks or Station Name. Decode C* Remarks. C fldnoin = 1 CALL CG_RMKA ( fldnoin, fldnoout, presdone, * rmksdone, ier ) ipt = mszrpt RETURN END IF ELSEIF ( itypsf(1) .eq. NMR ) THEN C C* First field is either pressure or max/min temp. in Remarks. C* Check 2nd field to see if alpha or numeric (or other) C* and call the appropriate s/r (if other, skip this field). C fldnoin = 1 CALL CG_PRTM ( fldnoin, fldnoout, presdone, * rmksdone, ier ) fldnoin = fldnoout IF ( .not. rmksdone ) THEN IF ( itypsf(fldnoin) .eq. ALPHA ) THEN CALL CG_RMKA ( fldnoin, fldnoout, presdone, * rmksdone, ier ) ELSEIF ( itypsf(fldnoin) .eq. NMR ) THEN CALL CG_PRTM ( fldnoin, fldnoout, presdone, * rmksdone, ier ) ELSE C C* character in this field may be a slash trailing C* the alti/pres field, so check the next field C* to see if it's remarks or the station name. C IF ( itypsf(fldnoin+1) .eq. ALPHA ) THEN fldnoin = fldnoin + 1 CALL CG_RMKA ( fldnoin, fldnoout, presdone, * rmksdone, ier ) ELSEIF ( itypsf(fldnoin+1) .eq. NMR ) THEN fldnoin = fldnoin + 1 CALL CG_PRTM ( fldnoin, fldnoout, presdone, * rmksdone, ier ) ELSE C C* non alpha-numeric character. Skip this field. C END IF END IF ipt = mszrpt RETURN END IF ELSE C C* character in this field may be a slash trailing C* the alti/pres field, so check the next field C* to see if it's remarks or the station name. C fldnoin = 1 IF ( itypsf(fldnoin+1) .eq. ALPHA ) THEN fldnoin = fldnoin + 1 CALL CG_RMKA ( fldnoin, fldnoout, presdone, * rmksdone, ier ) ELSEIF ( itypsf(fldnoin+1) .eq. NMR ) THEN fldnoin = fldnoin + 1 CALL CG_PRTM ( fldnoin, fldnoout, presdone, * rmksdone, ier ) ELSE C C* non alpha-numeric character. Skip this field. C c print*,' non alphanum char' END IF END IF ipt = mszrpt RETURN END IF ELSE C C* pressure/remarks/station name fields are blank or missing C ipt = mszrpt RETURN END IF ipt = mszrpt RETURN END