Ticket #63: autoscale_ld.pro

File autoscale_ld.pro, 1.7 kB (added by mgalloy, 2 years ago)

File containing example code with problem

Line 
1pro autoscale_ld,samens
2;+
3;PURPOSE:
4;   To autoscale CNOFS Lightning detector data
5;INPUT:
6;   SAMENS: 'yes' - same scales for North and South
7;           else  - differentent scale for North and South
8;
9; $LastChangedBy: kenb-mac $
10; $LastChangedDate: 2008-06-18 19:39:36 -0400 (Wed, 18 Jun 2008) $
11; $LastChangedRevision: 943 $
12; $URL: svn+ssh://svn@macvefi/reposvefi/trunk/vefigse/idl/cvefi/autoscale_ld.pro $
13;-
14for p=0,1 do begin
15   if p eq 0 then pole='N' else pole='S'
16   get_data,'LD_'+pole+'_0',data=data
17   tr=timerange(/current)
18   if tr(0) eq 0 then begin
19      tr(0)=data.x(0)
20      tr(1)=data.x(n_elements(data.x))
21   endif
22   pos=where(data.x ge tr(0) and data.x le tr(1),pp)
23   if pp lt 2 then begin
24      m=dialog_message('Problem autoscaling raw E data, scales not changed')
25      return
26   endif
27   data=data.y(pos)
28   np=n_elements(data)
29   data=fltarr(7,np)
30   for i=0,6 do begin
31      quan='LD_'+pole+'_'+strtrim(string(i),2)
32      get_data,quan,data=dat
33      data(i,*)=dat.y(pos)
34   endfor
35   getyranges,data,dmin,dmax,equal=3
36   dmin=dmin(0) > 0
37   dmax=dmax(0)
38   lrange=[dmin(0),dmax(0)]
39   options,'LD_'+pole+'_?',yrange=lrange
40   crange=long(lrange-lrange/10.)/20*20
41   options,'LD_'+pole,zrange=crange
42endfor
43if samens eq 'yes' then begin
44   get_data,'LD_N_0',limits=nlimits
45   get_data,'LD_S_0',limits=slimits
46   ymin=nlimits.yrange(0) < slimits.yrange(0)
47   ymax=nlimits.yrange(1) > slimits.yrange(1)
48   options,'LD_?_?',yrange=[ymin,ymax]
49   get_data,'LD_N',limits=nlimits
50   get_data,'LD_S',limits=slimits
51   zmin=nlimits.zrange(0) < slimits.zrange(0)
52   zmax=nlimits.zrange(1) > slimits.zrange(1)
53   options,'LD_?',zrange=[zmin,zmax]
54endif
55return
56end