SUBROUTINE UA_DLLM ( report, lenr, irptr, iret ) C************************************************************************ C* UA_DLLM * C* * C* This subroutine decodes the latitude, longitude, and marsden square. * C* * C* UA_DLLM ( REPORT, LENR, IRPTR, IRET ) * C* * C* Input parameters: * C* REPORT CHAR* Report * C* LENR INTEGER Length of REPORT * C* * C* Input and output parameters: * C* IRPTR INTEGER Pointer within REPORT * C* * C* Output parameters: * C* RIVALS (IRSLAT) REAL Latitude in degrees * C* RIVALS (IRSLON) REAL Longitude in degrees * C* RIVALS (IRMRSQ) REAL Marsden square * C* IRET INTEGER Return code: * C* 0 = normal return * C* -1 = critical error in REPORT * C* or reached end of REPORT * C** * C* Log: * C* J. Ator/NCEP 03/96 * C* J. Ator/NCEP 10/96 Removed ERRRPT * C* J. Ator/NCEP 12/97 New interface format, style changes * C* J. Ator/NCEP 10/99 Clean up function declarations * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'uacmn.cmn' C* CHARACTER*(*) report C* CHARACTER la, lo, ula, ulo, field*(MXLENF) C------------------------------------------------------------------------ iret = -1 C C* Get the latitude group. C CALL UA_GFLD ( report, lenr, irptr, field, lenf, ier ) IF ( ier .ne. 0 ) THEN RETURN ELSE IF ( lenf .ne. 5 ) THEN logmsg = 'latitude group ' // field (1:lenf) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN ELSE IF ( field (1:2) .ne. '99' ) THEN logmsg = 'latitude group indicator ' // field (1:2) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF C C* Decode the latitude from the latitude group. C CALL ST_INTG ( field (3:5), islat, ier ) IF ( ier .ne. 0 ) THEN logmsg = 'latitude ' // field (3:5) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF C C* Store the units digit of the latitude for later use. C la = field (4:4) C C* Get the longitude group. C CALL UA_GFLD ( report, lenr, irptr, field, lenf, ier ) IF ( ier .ne. 0 ) THEN RETURN ELSE IF ( lenf .ne. 5 ) THEN logmsg = 'longitude group ' // field (1:lenf) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF C C* Decode the longitude from the longitude group. C CALL ST_INTG ( field (2:5), islon, ier ) IF ( ier .ne. 0 ) THEN logmsg = 'longitude ' // field (2:5) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF C C* Store the units digit of the longitude for later use. C lo = field (4:4) C C* The first character of the longitude group contains the C* globe quadrant indicator, which is used to properly sign C* the decoded latitude and longitude. C IF ( field (1:1) .eq. '1' ) THEN ELSE IF ( field (1:1) .eq. '3' ) THEN islat = islat * (-1) ELSE IF ( field (1:1) .eq. '5' ) THEN islat = islat * (-1) islon = islon * (-1) ELSE IF ( field (1:1) .eq. '7' ) THEN islon = islon * (-1) ELSE logmsg = 'globe quadrant indicator ' // field (1:1) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF C C* Store the latitude. C rivals ( irslat ) = FLOAT ( islat ) / 10. C C* Store the longitude. C rivals ( irslon ) = FLOAT ( islon ) / 10. C C* Get the marsden square group. C CALL UA_GFLD ( report, lenr, irptr, field, lenf, ier ) IF ( ier .ne. 0 ) THEN RETURN ELSE IF ( lenf .ne. 5 ) THEN logmsg = 'marsden square group ' // field (1:lenf) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF C C* Decode the marsden square from the marsden square group. C CALL ST_INTG ( field (1:3), imrsq, ier ) IF ( ier .ne. 0 ) THEN logmsg = 'marsden square ' // field (1:3) CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF C C* Store the marsden square. C C* This value is stored in the interface format as C* a code figure from WMO Code Table 2590. C rivals ( irmrsq ) = FLOAT ( imrsq ) C C* The units digit of the latitude and the units digit of the C* longitude are re-encoded in the fourth and fifth characters, C* respectively, of the marsden square group. Check to make C* sure that these characters match what was encoded previously. C ula = field (4:4) ulo = field (5:5) IF ( ( la .ne. ula ) .or. ( lo .ne. ulo ) ) THEN logmsg = 'failed lat/long units digit test' CALL DC_WLOG ( 2, 'UA', -1, logmsg, ierwlg ) RETURN END IF C iret = 0 C* RETURN END