3      SUBROUTINE XGRID (LON1,LON2,LAT1,LAT2,LLCODE)0C_TITLE  XGRID  Plots the grid lines for MAPLOT.C_ARGUMENTS:	REAL*4 LON1        ![I] Starting longitude to be plotted.8	REAL*4 LON2        ![I] Ending longitude to be plotted.9	REAL*4 LAT1        ![I] Starting latitude to be plotted.8	REAL*4 LAT2        ![I] Ending latitutde to be plotted.E	INTEGER LLCODE(2)  ![I] Specific to subroutine MAPROJ; (see MAPROJ).C_VARIABLESA       INCLUDE 'RAD$INC:GRID.INC/LIST'	!Grid specific parameters.)C					Uses: LLON, RLON, YLATMAX, YLATMIN,C					DLON, DLAT, KPROJ, IOPT.C					Modifies: none.A       INCLUDE 'RAD$INC:LAB.INC/LIST'	!Label specific parameters.CC                                       Uses: CENT. Modifies: none.FC_DESCRIPTION  The subroutine XGRID.FOR plots grid lines; it is calledJC exclusively by MAPGRID which controls the grid lines to be plotted.  TheFC grid lines are plotted according to their line type.  If there is a IC non-modular grid line to be plotted, MAPGRID calls XGRID with an upper 1C limit just slighty larger than the lower limit.3C	The philosophy behind this routine is as follows.           HC  PLOTTING LONGITUDES:  Given LON1, LON2, go from LON1 to LON2 plotting7C           		  each longitude from YLATMIN TO YLATMAX.HC  PLOTTING LATITUDES:   Given LAT1, LAT2, go from LAT1 to LAT2 plotting8C                         each latitude from LON TO RLONLC         e.g. LAT1= 130.0, LAT2=130.001, DLON=10.0 FOR--- DO LAT1,LAT2,DLONBC XGRID is called everytime a range of grid lines for Latitude or .C longitude is needed to be plotted on a grid.?C_CALLS  MAPROJ  FRSTPT  VECTOR  MAPLAB  LINE  CIRCINIT  CIRCUS)C_HISTORY  86April08  R.Gurule  FlagstaffC_END$      LOGICAL PFLG,SFLG,LONLAB,PIFLG      DATA NPTS/1/      CLON = CENT(1)      CLAT = CENT(2)-!-----Only used for a rectangular projection.1D     TYPE*, ' XGRID>',LON1,LON2,LAT1,LAT2,LLCODE/      CALL MAPROJ(1, LLON, YLATMIN, XMIN, YMIN)/      CALL MAPROJ(1, RLON, YLATMAX, XMAX, YMAX),!-----Check for absolute Longitudinal range.+      XDIF= ABS(LLON-CLON) + ABS(RLON-CLON)-      IF(LLON.LT.360.0.AND.RLON.LT.360.0)THEN	IFL = 1      ELSE 	IFL = 0      ENDIF	 '!-----Set PIFLG If range = 360 degrees.      IF(XDIF .GE. 360.0)THEN         PIFLG = .TRUE.
      ELSE        PIFLG = .FALSE.      ENDIF!-----Check Sinusoidal case.=       IF ( (LLCODE(1) .EQ. 3) .AND. (LLCODE(2) .EQ. 1)) THEN        XP=XMIN        YP=YMIN !----Plot the longitude lines.        DO X=LON1, LON2, DLON          IFLG= .TRUE.#          DO Y=YLATMIN,YLATMAX,DLAT&           CALL MAPROJ(NPTS,X,Y,XP,YP)             IF (IFLG) THEN!               CALL FRSTPT(XP,YP)               IFLG = .FALSE.             ELSE$               CALL VECTOR(XP,YP)                ENDIF!             IF(Y .EQ. CLAT) THEN!               CALL FRSTPT(XP,YP)4               CALL MAPLAB(XP,YP,X,LLCODE(1),.TRUE.)!               CALL FRSTPT(XP,YP)             ENDIF                    END DO        END DO                               !------Plot the latitude lines.       DO Y=LAT1,LAT2,DLAT)        CALL MAPROJ(NPTS,LLON,Y,XP,YP)   (        CALL MAPROJ(NPTS,RLON,Y,XP1,YP1)&        CALL LINE(XP,YP,XP1,YP1)      .        CALL MAPLAB(XP,YP,Y,LLCODE(1),.FALSE.)
       END DO=      ELSE IF( LLCODE(1) .EQ. 3  .AND. LLCODE(2) .EQ. 3 )THEN      ;        DO Y= -90.0,90.0,DLAT/2.0		!PLOT THE LATITUDE LINES           SFLG = .TRUE."           DO X=360.0,0.0,DLON/2.0&           CALL MAPROJ(NPTS,X,Y,XP,YP)%           IF(YP. GT. 1.0E6)GO TO 200             IF(SFLG)THEN!               CALL FRSTPT(XP,YP)               SFLG= .FALSE.     	     ELSE!               CALL VECTOR(XP,YP)             ENDIF            IF(X.EQ.CLON)THEN!               CALL FRSTPT(XP,YP)5               CALL MAPLAB(XP,YP,Y,LLCODE(1),.FALSE.)!               CALL FRSTPT(XP,YP)            ENDIF           GO TO 250  200      SFLG = .TRUE.  250      END DO      	ENDDO   8        DO X=360.0,0.0,DLON			!Plot the Longitude lines.        SFLG= .TRUE.  !         DO Y=-90.0,90.0,DLAT/2.0(           CALL MAPROJ(NPTS, X,Y, XP,YP)-           IF(YP .GT. 1.0E6) GO TO 300                  IF(SFLG) THEN             CALL FRSTPT(XP,YP)             SFLG= .FALSE.           ELSE             CALL VECTOR(XP,YP)           ENDIF             IF(Y.EQ.CLAT)THEN!               CALL FRSTPT(XP,YP)%	       IF(IFL.EQ.0.AND.X.NE.360)THEN2	         CALL MAPLAB(XP,YP,X,LLCODE(1),1,.FALSE.)
	       ENDIF!               CALL FRSTPT(XP,YP)             ENDIF           GO TO 350  300      SFLG= .TRUE.  350     ENDDO  	ENDDO!      ELSE IF(LLCODE(2).EQ.2)THEN!-----plot the longitude lines."           DO X = LON1, LON2, DLON              XT = XB	      IF(X.EQ.LON2)XT=X+.001               !Add a small increment?	                                           !for ending amount.1              CALL MAPROJ(1, XT, YLATMAX, XP, YP)3              CALL MAPROJ(1, XT, YLATMIN, XP1, YP1)               CALL FRSTPT(XP,YP)"              CALL VECTOR(XP1,YP1)	      IF(YLATMIN.GE.0.0)THEN5                CALL MAPLAB(XP,YP,X,LLCODE(1),.TRUE.)	      ELSE7                CALL MAPLAB(XP1,YP1,X,LLCODE(1),.TRUE.)
	      ENDIF	           END DOB!-----plot the latitude lines for Lambert and Polar Stereographic.-        DO Y=YLATMIN,YLATMAX,DLAT            =         CALL CIRCINIT(RR,A1,A2,DD,RP,ASTART,ADEL,NCH,Y,CLON)4         CALL CIRCUS(RR,A1,A2,DD,RP,ASTART,ADEL,NCH)(         CALL MAPROJ(1, LLON, Y, XP, YP)1         CALL MAPLAB(XDUM,YP,Y,LLCODE(1),.FALSE.)        END DO!      ELSE IF(LLCODE(1).EQ.1)THEN:           DO X=LON1,LON2,DLON			!PLOT THE LONGITUDE LINESJ           IF( (PIFLG).AND.(X.EQ.LON2))THEN	!Check for case of 2 pi, where6             XT=LON2 + .1		        !RLON-CLON >= 180.0.             CALL MAPROJ(NPTS,XT,DUMY,XP,DUMY)'             CALL LINE(XP,YMIN,XP,YMAX)4             CALL MAPLAB(XP,YDUM,X,LLCODE(1),.TRUE.)           ELSE,            CALL MAPROJ(NPTS,X,DUMY,XP,DUMY)3            CALL MAPLAB(XP,YDUM,X,LLCODE(1),.TRUE.)&            CALL LINE(XP,YMIN,XP,YMAX)'D           WRITE(*,1100)XP,X,YMIN,YMAXHD1100       FORMAT(' LONGITUDE LIMITS (GRID LINES), X,XPLOTTER ',4F10.3)           ENDIF          ENDDO      END IF3D      TYPE*, LAT1,LAT2,DLAT   ,'    XGRID   YLAT '/      IF((LLCODE(2).EQ.1).AND.(KPROJ.NE.2))THEN9          DO Y=LAT1,LAT2,DLAT			!PLOT THE LATITUDE LINES.,            CALL MAPROJ(NPTS,DUMX,Y,DUMX,YP)5             CALL MAPLAB(XMIN,YP,Y,LLCODE(1),.FALSE.) D            WRITE(LOG,1010)Y,YP&            CALL LINE(XMIN,YP,XMAX,YP):D1010     FORMAT(' LATITUDE LIMITS ARE Y,YPLOTTER',4F10.3)          ENDDO      ENDIF      RETURN	      END