1
C @(#)round.for 19.1 (ES0-DMD) 02/25/03 13:28:48
2
C===========================================================================
3
C Copyright (C) 1995 European Southern Observatory (ESO)
5
C This program is free software; you can redistribute it and/or
6
C modify it under the terms of the GNU General Public License as
7
C published by the Free Software Foundation; either version 2 of
8
C the License, or (at your option) any later version.
10
C This program is distributed in the hope that it will be useful,
11
C but WITHOUT ANY WARRANTY; without even the implied warranty of
12
C MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
C GNU General Public License for more details.
15
C You should have received a copy of the GNU General Public
16
C License along with this program; if not, write to the Free
17
C Software Foundation, Inc., 675 Massachusetss Ave, Cambridge,
20
C Corresponding concerning ESO-MIDAS should be addressed as follows:
21
C Internet e-mail: midas@eso.org
22
C Postal address: European Southern Observatory
23
C Data Management Division
24
C Karl-Schwarzschild-Strasse 2
25
C D 85748 Garching bei Muenchen
27
C===========================================================================
29
C @(#)round.for 19.1 (ESO-IPG) 02/25/03 13:28:48
30
SUBROUTINE ROUND(XMIN,XMAX,NCELLS,DELTA,INT,SCALE)
32
C Copyright (C) Andrew T. Young, 1990
34
C SPACING IN (X , CELLS)
36
C PICKS ROUND NUMBERS FOR GRAPH LIMITS. 23 AUG 1985
41
INTEGER NCELLS, INT, INTS, LOGS, I
42
REAL XMIN, XMAX, DELTA, SCALE, RECIPS, DELS, RANGE, FNM1, PEAK,
43
1 WIDTH, FULL, BOT, TOP
45
DIMENSION RECIPS(10),INTS(10),DELS(10)
48
DATA RECIPS/5.,4.,3.,2.5,2.,1.5,1.2,1.,.8,.6/
50
DATA INTS / 5, 4, 3, 5, 4, 3, 6, 5, 4, 3/
52
DATA DELS / 1.,1.,1., 2.,2., 2., 5.,5., 5.,5./
58
IF(XMIN*XMAX.LE.0.) GO TO 20
60
IF(RANGE.LT.0.) GO TO 6
62
C HERE FOR NORMAL PLOT.
63
IF(XMIN.GT.0.) GO TO 3
64
C ZERO AT TOP, ALL NEG.VALUES.
65
IF(XMAX/XMIN.GT.0.2) GO TO 20
68
C ZERO AT BOTTOM; NORMAL (ALL +.)
69
3 IF(XMAX/XMIN.LT.5.) GO TO 20
75
6 IF(XMIN.GT.0.) GO TO 8
76
C ALL NEG.,ZERO AT BOTTOM.
77
IF(XMAX/XMIN.GT.5.) GO TO 4
80
8 IF(XMAX/XMIN.LT.0.2) GO TO 2
84
20 LOGS=LOG10(ABS(RANGE)/FNM1)-98.3
85
C ENSURE MULTIPLES .GT.1
87
21 PEAK=ABS(RANGE)/SCALE
88
C PEAK IS RANGE IN SCALE UNITS.
92
IF(RECIPS(I)*WIDTH.LE.1.) GO TO 25
97
25 DELTA=SIGN(DELS(I),RANGE)
100
C FULL IS IN SCALE UNITS.
102
C TEST BOTH ENDS FOR CLEARANCE.
104
MINTIC=XMIN/(SCALE*DELS(I)) + 1.D8
105
MINTIC=MINTIC-100000000
106
IF(RANGE.LT.0. .AND. MINTIC*DELS(I)*SCALE.NE.XMIN)MINTIC=MINTIC+1
108
IF((RANGE.GT.0. .AND. BOT.LE.XMIN/SCALE) .OR.
109
1 (RANGE.LT.0. .AND. BOT.GE.XMIN/SCALE)) GO TO 28
116
28 IF(RANGE.GT.0.)THEN
118
IF(TOP.LT.XMAX/SCALE) GO TO 27
121
IF(TOP.GT.XMAX/SCALE) GO TO 27