~ubuntu-branches/debian/jessie/eso-midas/jessie

« back to all changes in this revision

Viewing changes to prim/table/libsrc/tdscale.for

  • Committer: Package Import Robot
  • Author(s): Ole Streicher
  • Date: 2014-04-22 14:44:58 UTC
  • Revision ID: package-import@ubuntu.com-20140422144458-okiwi1assxkkiz39
Tags: upstream-13.09pl1.2+dfsg
ImportĀ upstreamĀ versionĀ 13.09pl1.2+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
C @(#)tdscale.for       19.1 (ES0-DMD) 02/25/03 14:11:20
 
2
C===========================================================================
 
3
C Copyright (C) 1995 European Southern Observatory (ESO)
 
4
C
 
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.
 
9
C
 
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.
 
14
C
 
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, 
 
18
C MA 02139, USA.
 
19
C
 
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 
 
26
C                       GERMANY
 
27
C===========================================================================
 
28
C
 
29
C++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 
30
C
 
31
C.COPYRIGHT: Copyright (c) 1987 European Southern Observatory,
 
32
C                                         all rights reserved
 
33
C
 
34
C.VERSION: 1.0  ESO-FORTRAN Conversion, AA  18:30 - 11 DEC 1987
 
35
C
 
36
C.LANGUAGE: F77+ESOext
 
37
C
 
38
C.AUTHOR: J.D.PONZ
 
39
C
 
40
C.IDENTIFICATION        TDSCALE.FOR
 
41
C.KEYWORDS           TABLE, APPLICATIONS
 
42
C.ENVIRONMENT  MIDAS
 
43
C.PURPOSE
 
44
C  FINDS NICE LIMITS, DISTANCE BETWEEN TICS AND NUMBER OF TIC MARKS
 
45
C  FOR PLOTTING AND OTHER DISPLAY PURPOSES.
 
46
C
 
47
C
 
48
C------------------------------------------------------------------
 
49
      SUBROUTINE TDSCAL(DMIN,DMAX,SCAL,XLOW,XUPP,ID,DTIC,NLAB)
 
50
      IMPLICIT NONE
 
51
      REAL DMIN  !   IN : minimum value
 
52
      REAL DMAX  !   IN : maximum value
 
53
      REAL SCAL  !   IN : scaling factor
 
54
      REAL XLOW  !   OUT: mantisa of lower limit 
 
55
      REAL XUPP  !   OUT: mantisa of upper limit
 
56
      INTEGER ID  !   OUT: exponent of XLOW and XUPP
 
57
      REAL DTIC  !   OUT: distance between tic marks
 
58
      INTEGER NLAB   ! OUT : number of tic marks
 
59
C
 
60
      REAL DELTA,XMIN,XMAX,XDIF
 
61
      REAL OFFSET,SCALE,POTFAC
 
62
      REAL RLMIN,RLMAX
 
63
      INTEGER LMIN,LMAX,LDIF
 
64
      DATA DELTA/0.00001/
 
65
C
 
66
      NLAB   = -1
 
67
      XMIN   = MIN(DMIN,DMAX)
 
68
      XMAX   = MAX(DMIN,DMAX)
 
69
      SCALE  = SCAL
 
70
      IF (DMIN.GT.DMAX) SCALE  = -SCALE
 
71
      IF (XMIN.EQ.XMAX .OR. SCALE.EQ.0.) RETURN
 
72
      XDIF   = XMAX - XMIN
 
73
      OFFSET = XDIF/ABS(SCALE*2.0) - 0.5*XDIF
 
74
      XMIN   = XMIN - OFFSET
 
75
      XMAX   = XMAX + OFFSET
 
76
      POTFAC = ALOG10(XDIF/2.0)
 
77
      IF (POTFAC.LT.0.) POTFAC = POTFAC - 1.0 + DELTA
 
78
      ID     = INT(POTFAC)
 
79
      POTFAC = 10.0**ID
 
80
      RLMIN  = XMIN/POTFAC
 
81
      IF (RLMIN.LT.0.) RLMIN  = RLMIN - 1.0 + DELTA
 
82
      LMIN   = INT(RLMIN)
 
83
      RLMAX  = XMAX/POTFAC + 1.0 - DELTA
 
84
      IF (RLMAX.LT.0.) RLMAX  = RLMAX - 1.0 + DELTA
 
85
      LMAX   = INT(RLMAX)
 
86
      LDIF   = LMAX - LMIN
 
87
      IF (LDIF.GT.5) GO TO 10
 
88
      DTIC   = 0.2
 
89
      NLAB   = 5
 
90
      GO TO 30
 
91
 
 
92
   10 IF (LDIF.GT.10) GO TO 20
 
93
      IF (LMIN.LT.0) LMIN   = LMIN - 1
 
94
      LMIN   = (LMIN/2)*2
 
95
      IF (LMAX.LT.0) LMAX   = LMAX - 1
 
96
      LMAX   = (LMAX/2+1)*2
 
97
      DTIC   = 0.5
 
98
      NLAB   = 4
 
99
      GO TO 30
 
100
 
 
101
   20 IF (LMIN.LT.0) LMIN   = LMIN - 4
 
102
      LMIN   = INT(LMIN/5)*5
 
103
      IF (LMAX.LT.0) LMAX   = LMAX - 4
 
104
      LMAX   = INT((LMAX+4)/5)*5
 
105
      DTIC   = 1.0
 
106
      NLAB   = 5
 
107
   30 IF (SCALE.LT.0) GO TO 40
 
108
      XLOW   = LMIN - DTIC
 
109
      XUPP   = LMAX + DTIC
 
110
      DTIC   = POTFAC*DTIC
 
111
      RETURN
 
112
 
 
113
   40 CONTINUE
 
114
      XLOW   = LMAX + DTIC
 
115
      XUPP   = LMIN - DTIC
 
116
      DTIC   = -POTFAC*DTIC
 
117
      RETURN
 
118
 
 
119
      END