source: trunk/northwind.pro @ 48

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

fix thanks to coding rules

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