source: trunk/SRC/ToBeReviewed/PLOTS/DIVERS/autoscale.pro @ 157

Last change on this file since 157 was 157, checked in by navarro, 18 years ago

header improvements + xxx doc

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.8 KB
Line 
1;------------------------------------------------------------
2;------------------------------------------------------------
3;------------------------------------------------------------
4;+
5;
6; @file_comments
7; We give a min and a max, and the procedure send back
8; the good contour interval and labels's value.
9;
10; @categories
11; Graphics
12;
13; @param MIN {in}{required}
14; A reel number specifying above what value we want to trace a contour
15;
16; @param MAX {in}{required}
17; A reel number specifying below what value we want to trace a contour
18;
19; @param CI. {out}
20; It is a reel number giving the contour interval. Use it in CONTOUR with the keyword LEVEL.
21;
22; @restrictions
23; CI is a multiple of the unity in unity log of 10.
24; It force the number of contour to be even.
25;
26; @history
27; G. Roullet / aout 99 (gr\@lodyc.jussieu.fr)
28;
29; @version
30; $Id$
31;
32;-
33;------------------------------------------------------------
34;------------------------------------------------------------
35;------------------------------------------------------------
36PRO autoscale, min, max, ci
37;
38;  Estimation of a first CI, notice the presence of the floor (Inferior round)
39; This CI is a multiple of the unity in unity log of 10.
40;
41;
42  compile_opt idl2, strictarrsubs
43;
44    ci = (max-min)/20.
45    ci = 10.^floor(alog10(ci))
46
47    n = 0
48    ci0 = ci
49;
50    coef = [2, 2.5, 5, 10]
51;
52; We test differents CI (contour intervals), i.e. 1, 2, 2.5, 5 and 10
53; until the number of contour is inferior to 30.
54;
55    WHILE ceil((max-min)/ci) GE 30 DO BEGIN
56          ci = ci0*coef[n]
57          n = n+1
58    ENDWHILE
59
60    min = floor(min/ci/2)*ci*2
61    max = ceil(max/ci/2)*ci*2
62   
63    nlevels = round((max-min)/ci)   
64
65;
66;  We force the number of contour to be even
67;
68    IF nlevels MOD 2 EQ 1 THEN BEGIN
69          nlevels = nlevels+1
70          max = max+ci
71    END
72
73
74END
75
76
77
78
Note: See TracBrowser for help on using the repository browser.