C--------------------------------------------------------------------
C& XINTR2  BILINEAR 2D INTERPOLATION W/FLAT EXTRAPOLATION - FCN CALL
C
      REAL FUNCTION XINTR2(XTARG,YTARG,X,NX,Y,NY,F,NF1,IEX)
C
C INPUTS:
C  XTARG,YTARG - TARGET TO INTERPOLATE TO
C
C DATA BEING INTERPOLATED:
      REAL X(NX),Y(NY),F(NF1,NY)
C
C NOTE NF1.GE.NX ***
C
C OUTPUT:
C  IEX = 1 IF FLAT EXTRAPOLATION WAS PERFORMED (IN EITHER DIRECTION)
C
C  XINTR2 = BILINEARLY INTERPOLATED RESULT
C
C-----------------------
C
      EXTERNAL XIDENT
C
C  USE XINTER SUBROUTINE TO DEFINE INTERPOLATION
C
      CALL XINTER(XIDENT,XTARG,X,NX,IX0,IX0P1,XI,XIC,IEXX)
      CALL XINTER(XIDENT,YTARG,Y,NY,IY0,IY0P1,YI,YIC,IEXY)
C
      IEX=MAX0(IEXX,IEXY)
C
      XINTR2=XIC*(F(IX0,IY0)*YIC+F(IX0,IY0P1)*YI) +
     >	       XI*(F(IX0P1,IY0)*YIC+F(IX0P1,IY0P1)*YI)
C
      RETURN
      END
C******************** END FILE XINTR0.FOR ; GROUP XINTER ******************
