source: trunk/SRC/ToBeReviewed/PLOTS/DESSINE/pltsc.pro

Last change on this file was 495, checked in by pinsard, 10 years ago

fix thanks to coding rules; typo; dupe empty lines; trailing blanks

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.1 KB
Line 
1;+
2; @file_comments
3;
4; @categories
5;
6; @param TAB1
7;
8; @param TAB2
9;
10; @param MIN1
11;
12; @param MAX1
13;
14; @param MIN2
15;
16; @param MAX2
17;
18; @param VARNAME2
19;
20; @keyword BOXZOOM
21; Vector indicating the geographic zone on which we want to cut the map.
22;  If BOXZOOM has :
23; 1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]]
24; 2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]]
25; 4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])]
26; 5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]]
27; 6 elements: The extraction is made on Boxzoom
28;
29; @keyword COL1D
30;
31; @keyword STY1D
32;
33; @keyword OV1D
34;
35; @keyword _EXTRA
36; Used to pass keywords
37;
38; @returns
39;
40; @uses
41;
42; @restrictions
43;
44; @examples
45;
46; @history
47;
48; @version
49; $Id$
50;
51; @todo seb
52;
53;-
54PRO pltsc, tab1, tab2, min1, max1, min2, max2, varname2, BOXZOOM=boxzoom, $
55           COL1D=col1d, STY1D=sty1d, OV1D=ov1d, _EXTRA=ex
56;
57; scatter plot (inspired from plt1d)
58;
59  compile_opt idl2, strictarrsubs
60;
61@cm_4mesh
62@cm_4data
63  IF NOT keyword_set(key_forgetold) THEN BEGIN
64@updatenew
65@updatekwd
66  ENDIF
67
68; Comment: We do not reinitialize when we call back pltsc
69   if NOT keyword_set(ov1d) then reinitplt
70   ; reduce data xyzt domain
71
72   if keyword_set(boxzoom) then BEGIN
73     Case 1 Of
74       N_Elements(Boxzoom) Eq 1:bte = [lon1, lon2, lat1, lat2, 0., boxzoom[0]]
75       N_Elements(Boxzoom) Eq 2:bte = [lon1, lon2, lat1, lat2, boxzoom[0], boxzoom[1]]
76       N_Elements(Boxzoom) Eq 4:bte = [Boxzoom, vert1, vert2]
77       N_Elements(Boxzoom) Eq 5:bte = [Boxzoom[0:3], 0, Boxzoom[4]]
78       N_Elements(Boxzoom) Eq 6:bte = Boxzoom
79       Else: Begin
80         ras = report('Wrong Definition of Boxzoom')
81         return
82       End
83     endcase
84     savedbox = 1b
85     saveboxparam, 'boxparam4pltsc.dat'
86     domdef, bte, GRIDTYPE = vargrid
87   ENDIF
88
89; extract indexes to plot
90
91   indexm = where(tab1 LE valmask/10.)
92   tab1 = tab1[indexm]
93   tab2 = tab2[indexm]
94
95   npts = (size(indexm))[1]
96
97; deal with  min and max of plot
98   IF finite(min1) EQ 0 THEN min1 = min(tab1)
99   IF finite(max1) EQ 0 THEN max1 = max(tab1)
100   IF finite(min2) EQ 0 THEN min2 = min(tab2)
101   IF finite(max2) EQ 0 THEN max2 = max(tab2)
102
103; init plot if not overlay
104
105   IF NOT keyword_set(ov1d) THEN placedessin, 'yfx', posfenetre, posbar, $
106    contour = contour, _extra = ex
107   yy = tab1
108   xx = tab2
109
110; axis range
111   !x.range = [min2-abs(max2-min2)/5.,max2+abs(max2-min2)/5.]
112   !y.range = [min1-abs(max1-min1)/5.,max1+abs(max1-min1)/5.]
113
114   IF (NOT keyword_set(sty1d)) THEN sty1d = 0
115   IF (NOT keyword_set(col1d)) THEN col1d = 0
116   IF  NOT keyword_set(ov1d) THEN  BEGIN
117      legende, min1, max1, 'yfx', VARNAME2 = varname2, NPTS = npts, _EXTRA = ex
118;
119      plot,xx,yy, background = 255, psym = sty1d+1, color=col1d, thick=2 $
120       , title = '', subtitle = '',_extra = ex
121
122      if n_elements(ex) NE 0 then BEGIN
123; To have a 0 colored frame and trace a line at y=0
124         if (where(tag_names(ex) EQ 'COLOR'))[0] NE -1 then ex.COLOR = 0
125         if (where(tag_names(ex) EQ 'LINESTYLE'))[0] NE -1 then ex.LINESTYLE= 0
126       ENDIF
127       plot, !x.range, [0, 0], /noerase, /nodata, xstyle = 1, ystyle = 1, _extra = ex
128; trace a line at x=0
129      plot, [0, 0], !y.range, /noerase, /nodata, title = '', subtitle = '', _extra = ex
130   ENDIF ELSE oplot,xx,yy,color=col1d,linestyle=sty1d,thick=2, _extra = ex
131;------------------------------------------------------------
132;------------------------------------------------------------
133; 3rd part: Possible print
134;------------------------------------------------------------
135;------------------------------------------------------------
136fini:
137   terminedessin, _extra = ex
138  if keyword_set(savedbox) THEN restoreboxparam, 'boxparam4pltsc.dat'
139;------------------------------------------------------------
140   if n_elements(key_performance) NE 0 then $
141    IF key_performance EQ 1 THEN print, 'temps plt1d', systime(1)-tempsun
142;------------------------------------------------------------
143;------------------------------------------------------------
144;------------------------------------------------------------
145   return
146end
Note: See TracBrowser for help on using the repository browser.