SUBROUTINE MA_TIDE ( marrpt, ipt, iret ) C************************************************************************ C* MA_TIDE * C* * C* This subroutine decodes the tide data group which immediately follows* C* the characters 'TIDE' in a CMAN report. The four digit number rep- * C* resents hundreths of feet above Mean Lower Low Water (MLLW) minus * C* 1000. When the water's at MLLW, the encoded number will be 1000. A * C* report of 1132 is 1.32 feet above MLLW. A report of 0832 is 1.68 ft * C* below MLLW (1000 - 0832 = 168). It is a 6-minute average water level* C* that ends at the top of the hour. Continuous marrpts of 6-minute * C* water levels are measured; however, only the one ending at the top * C* of the hour is transmitted in real time. * C* * C* MA_TIDE ( MARRPT, IPT, IRET ) * C* * C* Input parameters: * C* MARRPT CHAR* Report array * C* * C* Input and Output parameters: * C* IPT INTEGER On input, points to 'E' in * C* 'TIDE'; on output, points to * C* last digit in group * C* * C* Output parameters: * C* RIVALS(IRTLLW) REAL Tide above/below mean lower low * C* water (reported in feet x 100, * C* stored in BUFR in meters). * C* IRET INTEGER Return code * C* 0 = Normal return * C* 1 = Problems * C* * C** * C* Log: * C* C. Caruso Magee/NCEP 02/04 New subroutine. * C************************************************************************ INCLUDE 'GEMPRM.PRM' INCLUDE 'macmn.cmn' C* CHARACTER*(*) marrpt C* CHARACTER fld4*4 C------------------------------------------------------------------------ iret = 0 C C* Check length of field. If not 4 digits, return. C lens = INDEX (marrpt(ipt:), ' ') - 1 IF ( lens .ne. 4 ) THEN ipt = ipt + lens RETURN END IF fld4 = marrpt ( ipt:ipt+3 ) CALL ST_INTG ( fld4, itide, ier ) IF ( ier .ne. 0 ) THEN ipt = ipt + 3 RETURN END IF C IF ( itide .lt. 1000 ) then C C* Tide is below mean lower low water level. Convert to feet. C itide = 1000 - itide rivals ( irtllw ) = -1.0 * ( FLOAT ( itide ) * .01 ) ELSE C C* Tide is at or above mean lower low water level. Convert to feet. C itide = itide - 1000 rivals ( irtllw ) = FLOAT ( itide ) * .01 END IF ipt = ipt + 4 C* RETURN END