source: trunk/procs/saxo_mods/pltsc.pro @ 205

Last change on this file since 205 was 205, checked in by pinsard, 14 years ago

homegenize THEN BEGIN ... ENDIF

  • Property svn:keywords set to Id
File size: 5.2 KB
Line 
1;+
2;
3; scatter plot (inspired from plt1d)
4;
5; @param TAB1 {in}{required}{type=array of floats}
6;
7; @param TAB2 {in}{required}{type=array of floats}
8;
9; @param MIN1 {inout}{type=float}
10;
11; @param MAX1 {inout}{type=float}
12;
13; @param MIN2 {inout}{type=float}
14;
15; @param MAX2 {inout}{type=float}
16;
17; @param VARNAME2 {in}{required}{type=string}
18;
19; @keyword BOITE
20;
21; @keyword COL1D
22;
23; @keyword STY1D
24;
25; @keyword OV1D
26;
27; @keyword THICKN
28;
29; @keyword FRACTION
30;
31; @keyword _EXTRA
32; Used to pass keywords
33;
34; @uses
35; <pro>common</pro>
36; <pro>domdef</pro>
37;
38; @history
39; - fplod 20091209T094630Z aedon.locean-ipsl.upmc.fr (Darwin)
40;
41;   * check parameters
42;
43; @version
44; $Id$
45;
46;-
47PRO pltsc,tab1,tab2, min1, max1, min2, max2, varname2 $
48    , BOITE=boite $
49    , COL1D=col1d $
50    , STY1D=sty1d $
51    , OV1D=ov1d $
52    , THICKN=thickn $
53    , FRACTION=fraction $
54    , _EXTRA=extra
55;
56  compile_opt idl2, strictarrsubs
57;
58@common
59
60usage='pltsc, tab1, tab2, min1, max1, min2, max2, varname2 ' $
61    + ', BOITE=boite ' $
62    + ', COL1D=col1d ' $
63    + ', STY1D=sty1d ' $
64    + ', OV1D=ov1d ' $
65    + ', THICKN=thickn ' $
66    + ', FRACTION=fraction ' $
67    + ', _EXTRA=extra'
68
69 nparam = N_PARAMS()
70 IF (nparam LT 7) THEN BEGIN
71    ras = report(['Incorrect number of arguments.' $
72          + '!C' $
73          + 'Usage : ' + usage])
74    stop
75 ENDIF
76
77 arg_type = size(tab1,/type)
78 IF (arg_type NE 4) THEN BEGIN
79   ras = report(['Incorrect arg type tab1' $
80          + '!C' $
81          + 'Usage : ' + usage])
82   stop
83 ENDIF
84
85 arg_type = size(tab2,/type)
86 IF (arg_type NE 4) THEN BEGIN
87   ras = report(['Incorrect arg type tab2' $
88          + '!C' $
89          + 'Usage : ' + usage])
90   stop
91 ENDIF
92
93 arg_type = size(varname2,/type)
94 IF (arg_type NE 7) THEN BEGIN
95   ras = report(['Incorrect arg type varname2' $
96          + '!C' $
97          + 'Usage : ' + usage])
98   stop
99 ENDIF
100
101c_cote = 0
102
103; Rq: on ne reinitialise pas qd on rapelle pltsc
104   IF NOT keyword_set(ov1d) THEN BEGIN
105    reinitplt
106   ENDIF
107   IF NOT keyword_set(thickn) THEN BEGIN
108    thickn = 2
109   ENDIF
110   IF NOT keyword_set(fraction) THEN BEGIN
111    fraction = 1.
112   ENDIF
113   ;; reduce data xyzt domain
114
115   oldboite = [lon1, lon2, lat1, lat2, prof1, prof2]
116   IF keyword_set(boite) THEN BEGIN
117      IF n_elements(integration3d) EQ 0 THEN BEGIN
118       integration3d = n_elements(boite) NE 4
119      ENDIF
120      CASE 1 Of
121         N_Elements(Boite) Eq 1:bte=[lon1, lon2, lat1, lat2, 0.,boite[0]]
122         N_Elements(Boite) Eq 2:bte=[lon1, lon2, lat1, lat2, boite[0],boite[1]]
123         N_Elements(Boite) Eq 4:bte=[Boite, prof1, prof2]
124         N_Elements(Boite) Eq 5:bte=[Boite[0:3], 0, Boite[4]]
125         N_Elements(Boite) Eq 6:bte=Boite
126         ELSE: BEGIN
127            ras = report('Mauvaise Definition de Boite')
128            stop
129         END
130      ENDCASE
131   ENDIF ELSE  bte=[lon1, lon2, lat1, lat2, prof1, prof2]
132
133   domdef, bte,GRILLE=vargrid
134
135; extract indexes to plot
136
137   indexm = where(tab1 LE valmask/10.)
138   tab1 = tab1[indexm]
139   tab2 = tab2[indexm]
140
141   npts = (size(indexm))[1]
142
143; deal with min and max of plot
144   IF finite(min1) EQ 0 THEN BEGIN
145    min1 = min(tab1)
146   ENDIF
147   IF finite(max1) EQ 0 THEN BEGIN
148    max1 = max(tab1)
149   ENDIF
150   IF finite(min2) EQ 0 THEN BEGIN
151    min2 = min(tab2)
152   ENDIF
153   IF finite(max2) EQ 0 THEN BEGIN
154    max2 = max(tab2)
155   ENDIF
156
157
158; init plot if not overlay
159
160   IF NOT keyword_set(ov1d) THEN BEGIN
161    placedessin, 'yfx', posfenetre, posbar, $
162    contour = contour, _EXTRA=EXTRA
163   ENDIF
164   yy = tab1
165   xx = tab2
166
167; axis range
168
169   fraction = 0.
170
171   !x.range = [min2-fraction*abs(max2-min2)/5.,max2+fraction*abs(max2-min2)/5.]
172   !y.range = [min1-fraction*abs(max1-min1)/5.,max1+fraction*abs(max1-min1)/5.]
173
174   IF (NOT keyword_set(sty1d)) THEN BEGIN
175    sty1d = 0
176   ENDIF
177   IF (NOT keyword_set(col1d)) THEN BEGIN
178    col1d = 0
179   ENDIF
180   IF NOT keyword_set(ov1d) THEN BEGIN
181      legende, min1, max1, 'yfx', VARNAME2 = varname2, NPTS = npts, _EXTRA=extra
182;
183      plot,xx,yy, background = 255, psym = sty1d+1, color=col1d, thick=thickn $
184       , title = '', subtitle = '',_EXTRA=extra
185
186      IF n_elements(ex) NE 0 THEN BEGIN
187; pour avoir un cadre de la couleur c_cote et trace une ligne a y=0
188         IF (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 THEN BEGIN
189          ex.COLOR = c_cote
190         ENDIF
191         IF (where(tag_names(ex) EQ 'LINESTYLE'))[0] NE -1 THEN BEGIN
192          ex.LINESTYLE= 0
193         ENDIF
194      ENDIF
195      plot, !x.range, [0, 0],/noerase,color=c_cote, xstyle = 1, ystyle = 1, _EXTRA=extra
196; trace une ligne a x=0
197      plot, [0, 0],!y.range ,/noerase,color=c_cote, title = '', subtitle = '', _EXTRA=extra
198   ENDIF ELSE oplot,xx,yy,color=col1d,psym=sty1d+1,thick=thickn, _EXTRA=extra
199;------------------------------------------------------------
200;------------------------------------------------------------
201; 3eme partie: impression eventuelle
202;------------------------------------------------------------
203;------------------------------------------------------------
204fini:
205   domdef, oldboite,GRILLE=vargrid
206   terminedessin, _EXTRA=extra
207;------------------------------------------------------------
208   IF n_elements(key_performance) NE 0 THEN BEGIN
209    IF key_performance EQ 1 THEN BEGIN
210     print, 'temps plt1d', systime(1)-tempsun
211    ENDIF
212   ENDIF
213END
Note: See TracBrowser for help on using the repository browser.