&      SUBROUTINE MAPGRID (LLCODE,CLON)6C_TITLE  MAPGRID  Controls the plotting of grid lines.C_ARGUMENTS?	INTEGER LLCODE(2)  ! [I] Line type indicators for X, and Y as 			   ! passed from MAPROJ.E	REAL CLON(8)       ! [I] Central longitude (equivalent to PARMAP(6))C_VARIABLES"        INCLUDE 'RAD$INC:GRID.INC':C			      !Uses: LLON, RLON, YLATMIN, YLATMAX, DLON, DLAT.C			      !Modifies: none.!        INCLUDE 'RAD$INC:LAB.INC'
C_DESCRIPTIONHC This Module does not actually plot grid lines, rather it controls the LC lines to be plotted.  The actually plotting is done by module XGRID.  ThisOC routine controls the limits of the grid to plot as well as the grid and labelNC increments.  It determines whether module XGRID needs to be called more thanOC once for different ranges of longitudes. e.g. 240.0 to 0.0, and 0.0 to 240.0.PC This module also calls XGRID with different parameters which control how XGRIDC is to plot the lines.CIC This routine will determine the line shape, according to the projectionHC code.  If the projection code is 1 then we know all grid lines will be C straight. 2=circles, 3= other.CC_CALLS  XGRID  MAPROJ'C_HISTORY  85Nov06  R.Gurule  FlagstaffC_END      LOGICAL IFLG.      DATA DUMY,DUMX/10.0,10.0/,NPTS/1/,WAY/1/      RAD= 3.1415927 / 180.0      CENTER = CENT(1)!!-----SAVE OUR ORIGINAL VARIABLES      X1 = LLON      X2 = RLON      Y1 = YLATMIN      Y2 = YLATMAX      DX = DLON      DY = DLON      WAY = -1.0!----Check for view projection.     5      IF (LLCODE(1).EQ.3 .AND. LLCODE(2) .EQ. 3 )THEN         X1 = 360.0         X2 =  0.0         Y1 = -90.0         Y2 =  90.0 *         CALL XGRID(X1,X2,Y1,Y2,LLCODE(1))         RETURN       ENDIFG!-----Check for a grid whose dlon, and dlat don't end on LLON, or RLON.    (          CALL MAPROJ(1,X1,YDUM,XP,YDUM)(          CALL MAPROJ(1,X2,YDUM,XP,YDUM)?      	  X2FLG= ABS (AMOD ( X2,ABS(DLON)))	!RIGHT LON REMAINDER<          X1FLG= ABS (AMOD ( X1,ABS(DLON)))	!LEFT LON  "   "<          Y2FLG= ABS (AMOD ( Y2,ABS(DLAT)))	!TOP LAT   "   "<          Y1FLG= ABS (AMOD ( Y1,ABS(DLAT)))	!BOTTOM LAT "  "L!-----Check the lat, llon for modularity with standard 10 degree increments.          X1 = LLON          X2 = RLON          Y1 = 0.0          Y2 = 0.0E!-----Assume that (rlon - llon) will be greater than rlon-clon unless!     plotting 2 pi.            ATEST= (RLON - LLON)"          IF (X1FLG .NE. 0.0) THEN             XSTRT= X1'             XEND= XSTRT + (.001 * WAY)G!-----Break problem into small segments, plot from LLON to RLON, unless!     crossing the zero line..      	     IF(ATEST .GT. (RLON - CENTER))THEN4              CALL XGRID(XSTRT,XEND,Y1,Y2,LLCODE(1))             ENDIF             ENDIF
          "          IF (X2FLG .NE. 0.0) THEN             XSTRT= X2(             XEND=  XSTRT + (.001 * WAY)-   	     IF (ATEST .GT. (RLON - CENTER)) THEN4              CALL XGRID(XSTRT,XEND,Y1,Y2,LLCODE(1))             ENDIF      	  ENDIF          Y1 = YLATMIN          Y2 = YLATMAX          X1= 0.0          X2= 0.0"          IF (Y1FLG .NE. 0.0) THEN             YSTRT = Y1              YEND= YSTRT + .001 6             CALL XGRID(X1,X2, YSTRT, YEND, LLCODE(1))          ENDIF  "          IF (Y2FLG .NE. 0.0) THEN             YSTRT = Y2!             YEND = YSTRT + .001 6             CALL XGRID(X1,X2, YSTRT, YEND, LLCODE(1))          ENDIFF!---------end of section for mon-modular grid lines.  Now do all other!         grid lines.!!---------PICK OUR NEW BOUNDARIES=!-----  Now start at the new boundary, even multiples of 10.0              X2 = RLON - X2FLG&              X1 = FLOATJ(JNINT(LLON))"              Y1 = YLATMIN + Y1FLG"              Y2 = YLATMAX - Y2FLGI!-----	Break out longitude into two ranges if we go across 0.0 longitude.A!	otherwise don't worry about it and only plot from LLON TO RLON.       7        IF(CENTER .LT. LLON .AND. CENTER .LT. RLON)THEN,          CALL XGRID(X1,0.0,Y1,Y2,LLCODE(1)).          CALL XGRID(360.0,X2,Y1,Y2,LLCODE(1))        ELSE+          CALL XGRID(X1,X2,Y1,Y2,LLCODE(1))
        ENDIF
       RETURN      END           