SUBROUTINE BT_BSC3 ( lenrpt, report, istrs3, iret ) C************************************************************************ C* BT_BSC3 * C* * C* This subroutine decodes the groups in section 3 of the bathy report. * C* These groups, which are optional, contain the total water depth and * C* and the surface current. * C* * C* BT_BSC3 ( LENRPT, REPORT, ISTRS3, IRET ) * C* * C* Input parameters: * C* LENRPT INTEGER Length of report minus section 4* C* REPORT CHAR* Report array * C* ISTRS3 INTEGER Pointer set to start of 1ZZZZ * C* group * C* Output parameters: * C* RIVALS(IRTOWD) REAL Total water depth in meters * C* RIVALS(IRMCMS) REAL Indicator for method of current * C* measurement * C* RIVALS(IRDROC) REAL Direction of surface current in * C* degrees * C* RIVALS(IRSPOC) REAL Speed of surface current in m/s * C* RIVALS(IRDBSC) REAL Depth in meters (for current) * C* RIVALS(IRNDDC) REAL Number of levels of depth/dir/ * C* current speed found. * C* IRET INTEGER Return code * C* 0 = Normal return * C* 1 = No section 2 data * C* * C** * C* Log: * C* R. Hollern/NCEP 11/98 * C* C. C. Magee/NCEP 02/02 Rename DOCW to DROC. * C* C. C. Magee/NCEP 03/02 Save current depth and counter * C* into new Interface array * C* elements (irdbsc and irnddc). * C* Remove logical sc3cur since we * C* don't need to know whether sec. * C* 3 current data are present when * C* decoding sec. 2 data anymore. * C* C. C. Magee/NCEP 11/02 Fix comments. * C* J. Ator/NCEP 02/06 Fix comments. * C************************************************************************ INCLUDE 'btcmn.cmn' C* CHARACTER*(*) report C* CHARACTER fld1*1, fld2*2, fld4*4 C------------------------------------------------------------------------ iret = 0 lvl = 0 ip = istrs3 C C* Get the group indicator C fld1 = report ( ip:ip ) C IF ( fld1 .eq. '1' ) THEN C C* Total water depth in meters. C ip = ip + 1 fld4 = report ( ip:ip+3 ) ip = ip + 5 CALL ST_INTG ( fld4, ival, ier ) IF ( ier .eq. 0 ) THEN rivals ( irtowd ) = FLOAT ( ival ) ELSE RETURN END IF END IF C C* Check if there is a surface current group. C IF ( ( ip + 2 ) .ge. lenrpt ) THEN RETURN END IF C C* Get the indicator for the method of current C* measurement. C fld1 = report ( ip:ip ) ip = ip + 1 CALL ST_INTG ( fld1, ival, ier ) IF ( ier .eq. 0 ) THEN rivals ( irmcms ) = FLOAT ( ival ) ELSE RETURN END IF C C* Direction of surface current in tens of degrees. C fld2 = report ( ip:ip+1 ) ip = ip + 2 CALL ST_INTG ( fld2, ival, ier ) IF ( ier .eq. 0 ) THEN rivals ( irdroc ( 1 ) ) = 10. * FLOAT ( ival ) ELSE RETURN END IF C C* If code makes it to here without returning, then we have valid C* surface current data present. C* Set number of depth/direction/current speed levels to 1. C* Set depth to 0.0 meters for surface. C rivals ( irdbsc ( 1 ) ) = 0.0 rivals ( irnddc ) = 1.0 C C* Speed of the surface current in tenths of a knot. C fld2 = report ( ip:ip+1 ) ip = ip + 2 CALL ST_INTG ( fld2, ival, ier ) IF ( ier .eq. 0 ) THEN C x = .1 * FLOAT ( ival ) C C* Convert from knots to m/s. C rivals ( irspoc ( 1 ) ) = PR_KNMS ( x ) ELSE RETURN END IF C* RETURN END