SUBROUTINE GTMTIC(MSGUN,ITIM,MXNMJR,NMJR,PMJR,LBL,NLBC,NMNR) C This routine determines tick marks for time axis labelling. C It is set up to return the following options: C Tmax-Tmin Labelled ticks every Unlabelled: C ----------- -------------------- ---------------- C < 0 -> (error stop) C 0 -> 1 hr 1/4 hr (units=hr) 5 min (MINR_=2) C -> 2 hr 1/2 hr 5 min (MINR_=5) C -> 12 hr 1 hr 1/4 hr (MINR_=3) C -> 24 hr 2 hr 1 hr (MINR_=1) C -> 48 hr 4 hr 1 hr 3 C -> 72 hr 6 hr 1 hr 5 C -> 6 days 12 hr 2 hr 5 C -> 12 days 1 day (units=day) 1/4 day 3 C -> 24 days 2 day 1/2 day 2 C > 24 days -> (error stop) C INPUTS: C MSGUN = Fortran unit number to print any error diagnostics C ITIM = Begin and end time (8 element integer array with C 4 elements for each, in form yyyy mmdd hhmm csec) C MXNMJR = Maximum number of labelled ticks allowed (array C dimension of PMJR and LBL). C RETURNS: C NMJR = Number of computed major tick marks. C PMJR = Fractional positions (domain: 0. -> 1.) of computed C tick marks which are to be labelled. C LBL = Labels for major ticks. C NLBC = Maximum number of characters per label (2 or 4) C NMNR = Number of unlabelled ticks to be inserted between C major (labelled) ticks. C Declarations for formal arguments: DIMENSION PMJR(MXNMJR) , ITIM(8) CHARACTER*4 LBL(MXNMJR) C Local declarations: DIMENSION IOLDT(4), NEWT(4) CHARACTER*3 UNITS C Determine which option is to be used (IDIF and IDT are in C units of centiseconds) CALL TIMEDIF(ITIM(1),ITIM(5),ITOTCS) TOTCS = FLOAT( ITOTCS ) IF(ITOTCS .LT. 0)THEN GO TO 9100 ELSEIF(ITOTCS .LE. 360000)THEN IDT = 90000 NMNR = 2 NLBC = 4 UNITS= 'qtr' ELSEIF(ITOTCS .LE. 720000)THEN IDT = 180000 NMNR = 5 NLBC = 4 UNITS= 'haf' ELSEIF(ITOTCS .LE. 4320000)THEN IDT = 360000 NMNR = 3 NLBC = 2 UNITS= 'hr ' ELSEIF(ITOTCS .LE. 8640000)THEN IDT = 720000 NMNR = 1 NLBC = 2 UNITS= 'hr ' ELSEIF(ITOTCS .LE. 17280000)THEN IDT = 1440000 NMNR = 3 NLBC = 2 UNITS= 'hr ' ELSEIF(ITOTCS .LE. 25920000)THEN IDT = 2160000 NMNR = 5 NLBC = 2 UNITS= 'hr ' ELSEIF(ITOTCS .LE. 51840000)THEN IDT = 4320000 NMNR = 5 NLBC = 2 UNITS= 'hr ' ELSEIF(ITOTCS .LE.103680000)THEN IDT = 8640000 NMNR = 3 NLBC = 2 UNITS= 'day' ELSEIF(ITOTCS .LE.207360000)THEN IDT = 17280000 NMNR = 3 NLBC = 2 UNITS= 'day' ELSE GO TO 9200 ENDIF C Round up to find the value and position of the first label C To round up, start with a 00:00 UT of the begin date and C test that time against the begin time; if it is less C than the begin time, add IDT to it and test agein. Continue C adding and testing until it is greater. IOLDT(1) = ITIM(1) IOLDT(2) = ITIM(2) IOLDT(3) = 0 IOLDT(4) = 0 NEWT (1) = ITIM(1) NEWT (2) = ITIM(2) NEWT (3) = 0 NEWT (4) = 0 CALL TIMEDIF(IOLDT,ITIM,IDCS) IF(IDCS .LE. 0)GO TO 200 100 CALL NEWTIME(IOLDT,NEWT,IDT,MSGUN) CALL TIMEDIF(NEWT,ITIM,IDCS) IF(IDCS .LE. 0)GO TO 200 DO 150 I=1,4 150 IOLDT(I) = NEWT(I) GO TO 100 200 IF(UNITS .EQ. 'qtr' .OR. UNITS .EQ. 'haf')THEN ILB = NEWT(3) WRITE(LBL(1),'(I4)')ILB ELSEIF(UNITS .EQ. 'hr ')THEN ILB = NEWT(3) / 100 WRITE(LBL(1),'(I2,2X)')ILB ELSEIF(UNITS .EQ. 'day')THEN ILB = NEWT(2) - (NEWT(2)/100) * 100 WRITE(LBL(1),'(I2,2X)')ILB ENDIF CALL TIMEDIF(ITIM,NEWT,ITHCS) PMJR(1) = FLOAT(ITHCS) / TOTCS NMJR = 1 C Build the rest of the labels DO 400 I=2,MXNMJR DO 300 J=1,4 300 IOLDT(J) = NEWT(J) CALL NEWTIME(IOLDT,NEWT,IDT,MSGUN) CALL TIMEDIF(NEWT,ITIM(5),IDCS) IF(IDCS .LT. 0)GO TO 401 IF(UNITS .EQ. 'qtr' .OR. UNITS .EQ. 'haf')THEN ILB = NEWT(3) IF(ILB .EQ. 0)ILB = 2400 WRITE(LBL(I),'(I4)')ILB ELSEIF(UNITS .EQ. 'hr ')THEN ILB = NEWT(3) / 100 IF(ILB .EQ. 0)ILB = 24 WRITE(LBL(I),'(I2,2X)')ILB ELSEIF(UNITS .EQ. 'day')THEN ILB = NEWT(2) - (NEWT(2)/100) * 100 WRITE(LBL(I),'(I2,2X)')ILB ENDIF CALL TIMEDIF(ITIM,NEWT,ITHCS) PMJR(I) = FLOAT(ITHCS) / TOTCS NMJR = NMJR + 1 400 CONTINUE 401 CONTINUE RETURN C Error trap diagnostics: 9100 WRITE(MSGUN,9150)(ITIM(I),I=1,8) 9150 FORMAT('0Subroutine GTTTIC is not smart enough to calculate ', + 'time tick marks for', + ' a reversed scale; Tbeg must be < Tend but',/, + ' Tbeg =',4I5,' and',/, + ' Tend =',4I5) STOP 'mor cod' 9200 WRITE(MSGUN,9250)(ITIM(I),I=1,8) 9250 FORMAT('0Subroutine GTTTIC is not smart enough to calculate ', + 'time tick marks when', + ' the range exceeds 24 days; Tbeg =',4I5,' and',/, + ' Tend =',4I5) STOP 'mor cod' END