1 | ; |
---|
2 | ; NAME: northwind.pro |
---|
3 | ; |
---|
4 | ; PURPOSE: Check on in the intput field the level of coherence of winds nearby north pole, |
---|
5 | ; and corrects it. Thi stask is performed before interpolation |
---|
6 | ; |
---|
7 | ; CATEGORY: Subroutine |
---|
8 | ; |
---|
9 | ; CALLING SEQUENCE: northwind |
---|
10 | ; |
---|
11 | ; INPUTS: |
---|
12 | ; |
---|
13 | ; |
---|
14 | ; KEYWORD PARAMETERS: None |
---|
15 | ; |
---|
16 | ; OUTPUTS: |
---|
17 | ; zresul : the same wind field with its upward stripe |
---|
18 | ; corrected in order to get coherence of winds on north polte |
---|
19 | ; |
---|
20 | ; COMMON BLOCKS: |
---|
21 | ; common_interp.pro |
---|
22 | ; |
---|
23 | ; |
---|
24 | PRO northwind, datglo,zdata_name,t |
---|
25 | |
---|
26 | @common_interp |
---|
27 | |
---|
28 | ; Treatment of north pole stripe |
---|
29 | |
---|
30 | |
---|
31 | ; Get from global array, the last stripe and the last but one stripe |
---|
32 | |
---|
33 | ; Initialising data arrays |
---|
34 | |
---|
35 | datglo_rect = replicate(0.,2,jpiatm) |
---|
36 | datglo_rectb = replicate(0.,2,jpiatm) |
---|
37 | |
---|
38 | ; Put data of the last two stripes into arrays |
---|
39 | |
---|
40 | |
---|
41 | datglo_rect(0,*) = datglo(*,jpjatm-1,0) |
---|
42 | datglo_rect(1,*) = datglo(*,jpjatm-1,1) |
---|
43 | |
---|
44 | datglo_rectb(0,*)= datglo(*,jpjatm-2,0) |
---|
45 | datglo_rectb(1,*)= datglo(*,jpjatm-2,1) |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | ; Converts data of these two lines into polar coordinates |
---|
50 | |
---|
51 | add_angle=0. |
---|
52 | |
---|
53 | if (zdata_name EQ data_u_name) then add_angle=!PI/2 |
---|
54 | |
---|
55 | |
---|
56 | datglo_polar=CV_COORD(FROM_RECT=datglo_rect,/TO_POLAR) |
---|
57 | datglo_polar(0,*)=datglo_polar(0,*)+2*!PI*indgen(jpiatm)/jpiatm |
---|
58 | |
---|
59 | datglo_polarb=CV_COORD(FROM_RECT=datglo_rect,/TO_POLAR) |
---|
60 | datglo_polarb(0,*)=datglo_polar(0,*)+2*!PI*indgen(jpiatm)/jpiatm |
---|
61 | |
---|
62 | |
---|
63 | ; Coherence of the last line needs to be corrected |
---|
64 | |
---|
65 | print, 'CHECKING LAST LINE COHERENCE...' |
---|
66 | |
---|
67 | mean_mod=replicate(total(datglo_polar(1,*))/jpiatm,jpiatm) |
---|
68 | mean_arg=replicate((total(datglo_polar(0,*))/jpiatm+2*!PI*west_lon/360.+!PI*(jpiatm-1.)/float(jpiatm)) ,jpiatm) |
---|
69 | mean_argb=replicate((total(datglo_polarb(0,*))/jpiatm+2*!PI*west_lon/360.+!PI*(jpiatm-1.)/float(jpiatm)) ,jpiatm) |
---|
70 | |
---|
71 | |
---|
72 | |
---|
73 | ; Checks whether module is about the same on the North Pole line : |
---|
74 | |
---|
75 | test_mod=abs(mean_mod-datglo_polar(1,*)) |
---|
76 | |
---|
77 | IF ( max(test_mod)/mean_mod(0) ) GT 0.01 THEN BEGIN |
---|
78 | |
---|
79 | print, 'MODULE IS NOT COHERENT AND WILL BE CORRECTED TO A MEAN VALUE OF :', mean_mod(0) |
---|
80 | |
---|
81 | datglo_polar(1,*)=mean_mod |
---|
82 | |
---|
83 | ENDIF |
---|
84 | |
---|
85 | |
---|
86 | ; Checks whether argument is coherent on the North Pole line : |
---|
87 | |
---|
88 | test_arg=abs(mean_arg-datglo_polar(0,*)) |
---|
89 | |
---|
90 | IF ( max(test_arg)/mean_arg(0)) GT 0.01 THEN BEGIN |
---|
91 | |
---|
92 | print, 'ARGUMENT IS NOT COHERENT AND WILL BE CORRECTED TO A MEAN VALUE :', mean_argb(0) |
---|
93 | |
---|
94 | datglo_polar(0,*)=mean_argb-!PI/2-(2*!PI*indgen(jpiatm)/float(jpiatm)+replicate(2.*!PI*west_lon/360.,jpiatm)) |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | ; Cross Corellation Method for wind coherence on North Pole |
---|
99 | |
---|
100 | all_phases=indgen(jpiatm) |
---|
101 | |
---|
102 | Ux=mean_mod*cos(all_phases*2.*!PI/jpiatm) |
---|
103 | Uy=mean_mod*sin(all_phases*2.*!PI/jpiatm) |
---|
104 | |
---|
105 | phyx=C_CORRELATE(Ux,datglo(*,jpjatm-2,0),all_phases) |
---|
106 | |
---|
107 | phyy=C_CORRELATE(Uy,datglo(*,jpjatm-2,1),all_phases) |
---|
108 | |
---|
109 | |
---|
110 | deph_x=where(phyx EQ max(phyx)) |
---|
111 | deph_y=where(phyy EQ max(phyy)) |
---|
112 | |
---|
113 | deph_x=deph_x(0) |
---|
114 | deph_y=deph_y(0) |
---|
115 | |
---|
116 | |
---|
117 | |
---|
118 | |
---|
119 | Ux=shift(Ux,deph_x) |
---|
120 | Uy=shift(Uy,deph_y) |
---|
121 | |
---|
122 | datglo(*,jpjatm-1,0)=Ux |
---|
123 | datglo(*,jpjatm-1,1)=Uy |
---|
124 | |
---|
125 | |
---|
126 | ENDIF |
---|
127 | |
---|
128 | |
---|
129 | |
---|
130 | |
---|
131 | end |
---|