source: trunk/procs/macros/make_stddev.pro @ 17

Last change on this file since 17 was 17, checked in by kolasinski, 17 years ago

Change in the field.legend appearance

File size: 2.5 KB
Line 
1;
2; make std dev from 2D macro_base_fld monthly time serie (defined in macro_read)
3;
4FUNCTION make_stddev, file_name, ncdf_db,  TIME_1 = time_1,  TIME_2 =  time_2, ALL_DATA = all_data, ZMTYP = zmtyp
5
6@common
7@com_eg
8;
9;
10; Read time serie
11;
12   IF debug_w THEN print, 'keyword_set(ALL_DATA) : ', keyword_set(ALL_DATA)
13
14   mfld = nc_read(file_name, macro_base_fld, ncdf_db,  TIME_1 = time_1,  TIME_2 =  time_2, ALL_DATA = all_data)
15
16   mfld.data = trends(mfld.data, '412', 'xyt')
17
18   print, '    Warning: standard deviation assuming monthly time serie of base field ',macro_base_fld
19
20; Modif MK
21
22   IF stddev_mth NE '00' THEN BEGIN
23
24      mth = ['Jan',  'Feb',  'Mar',  'Apr',  'May',  'Jun',  'Jul',  'Aug', 'Sep',  'Oct', 'Nov',  'Dec']
25      CASE STRMID(stddev_mth, 0, 2) OF
26         '01': strd = 1
27         '02': strd = 2
28         '03': strd = 3
29         '04': strd = 4
30         '05': strd = 5
31         '06': strd = 6
32         '07': strd = 7
33         '08': strd = 8
34         '09': strd = 9
35         '10': strd = 10
36         '11': strd = 11
37         '12': strd = 12
38         ENDCASE
39
40     print,  '    Warning: standard deviation computed for ', mth[strd-1]
41
42; Sampling of data and computation of new numbers of values
43      data =  (mfld.data)[*, *, strd-1:*:12]       
44      nval =  (size(data))[3]
45   ENDIF ELSE BEGIN
46      data =  mfld.data
47      nval =  jpt
48   ENDELSE
49
50   std = a_timecorrelate(data, 0,/covariance)
51   std = sqrt( nval/(nval-1)*std )
52   idx =  WHERE (std GT 1.0e+10)
53
54   IF idx(0) NE -1 THEN std(idx) = valmask
55
56   IF stddev_mth NE '00' AND stddev_diff EQ 1 THEN BEGIN
57      print,  ' Warning: standard deviation diff between ', mth[strd-1],  ' and the whole serie'
58      std_tot = a_timecorrelate(mfld.data, 0,/covariance)
59      std_tot = sqrt( jpt/(jpt-1)*std_tot )
60      IF idx(0) NE -1 THEN std_tot(idx) = valmask
61      idx_diff =  WHERE (std NE valmask)
62      std(idx_diff) =  std(idx_diff) - std_tot(idx_diff)
63   ENDIF
64
65   field = {name: '', data: std, legend: '', units: '', origin: '', dim: 0, direc:''}
66   
67   field.origin = mfld.origin
68   
69   field.dim = 2
70   
71   IF stddev_mth NE '00' THEN BEGIN
72      field.legend = ' for '+mth[strd-1]+' in ['+cmdm.date1+'-'+cmdm.spec+'] -'
73      IF stddev_diff EQ 1 THEN BEGIN
74         field.legend = ' diff between '+mth[strd-1]+' and total TS ['+cmdm.date1+' - '+cmdm.spec+'] -'       
75      ENDIF
76   ENDIF ELSE BEGIN
77      field.legend = ' ['+cmdm.date1+'-'+cmdm.spec+']'
78   ENDELSE
79
80; Fin Modif MK
81
82;  data and plot are 2D
83
84   field.direc = 'xy'
85
86   return, field
87END
Note: See TracBrowser for help on using the repository browser.