SUBROUTINE UA_HYCK ( iret ) C************************************************************************ C* UA_HYCK * C* * C* This subroutine checks decoded mandatory level heights to make sure * C* that they are hydrostatically consistent with each other. * C* Any heights that are found to be hydrostatically inconsistent are * C* corrected. * C* * C* UA_HYCK ( IRET ) * C* * C* Output parameters: * C* RIVALS (IRHGTM) REAL Height in meters * C* IRET INTEGER Return code: * C* 0 = normal return * C** * C* Log: * C* J. Ator/NCEP 03/96 * C* J. Ator/NCEP 07/97 Add check at 10mb level * 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* REAL pxx ( 5 ) C* LOGICAL exist, done C------------------------------------------------------------------------ iret = 0 nlev = INT ( rivals ( irnlev ) ) C C* Make sure that NLEV > 0 C IF ( nlev .le. 0 ) THEN RETURN END IF C DO jj = 1, nlev C C* Is this level a mandatory level? C IF ( INT ( rivals ( irvsig ( jj ) ) ) .eq. 32 ) THEN C C* Only certain mandatory levels where the leading digit of C* the height is not encoded within the report need to be C* checked for hydrostatic consistency. Each such level is C* checked by comparing it against a neighboring level whose C* leading height digit is known. C C* Determine if this mandatory level is one that needs to be C* checked, and, if so, assign one or more choices of C* neighboring levels that it could be checked against. C npxx = 0 presyy = rivals ( irpres ( jj ) ) C IF ( prttyp .eq. CC ) THEN IF ( INT ( presyy ) .eq. 10 ) THEN npxx = 4 pxx (1) = 5.0 pxx (2) = 3.0 pxx (3) = 20.0 pxx (4) = 30.0 END IF ELSE IF ( ( INT ( presyy ) .eq. 925 ) .or. + ( INT ( presyy ) .eq. 850 ) ) THEN npxx = 2 pxx (1) = 1000.0 pxx (2) = 500.0 ELSE IF ( INT ( presyy ) .eq. 700 ) THEN npxx = 3 pxx (1) = 500.0 pxx (2) = 1000.0 pxx (3) = 400.0 END IF END IF C IF ( npxx .gt. 0 ) THEN C C* This mandatory level needs to be checked against one C* of its neighboring levels. Check it against the first C* neighboring level (i.e. primary choice) in the list, C* then the second one (i.e. secondary choice), and so on, C* until a neighboring level is found that contains enough C* data to do a hydrostatic comparison. C done = .false. DO ii = 1, npxx IF ( .not. done ) THEN C C* Does the neighboring level of next-choice in C* the list exist in this report? C llxx = 1 exist = .false. DO WHILE ( ( .not. exist ) .and. + ( llxx .le. nlev ) ) ixvsig = INT ( rivals ( irvsig ( llxx ) ) ) ixpres = INT ( rivals ( irpres ( llxx ) ) ) IF ( ( ixpres .eq. INT ( pxx ( ii ) ) ) + .and. ( ixvsig .eq. 32 ) ) THEN exist = .true. ELSE llxx = llxx + 1 END IF END DO C IF ( exist ) THEN CALL UA_HYLV ( jj, llxx, ierhlv ) IF ( ierhlv .eq. 0 ) THEN C C* This neighboring level contained enough C* data to do a hydrostatic comparison. C done = .true. END IF END IF C END IF END DO END IF C END IF END DO C* RETURN END