source: trunk/src/ws_correction_ncdf.pro @ 70

Last change on this file since 70 was 50, checked in by pinsard, 13 years ago

replace TROPFLUX by PROJECT

File size: 3.1 KB
Line 
1;+
2;
3; .. _ws_correction_ncdf.pro:
4;
5; ======================
6; ws_correction_ncdf.pro
7; ======================
8;
9;     .. graphviz::
10;
11;        digraph ws_correction_ncdf {
12;           graph [
13;           rankdir="LR",
14;           ]
15;           file_in [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_ws_19890101_20091231_oafluxgrid.nc"];
16;           ncfile [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_ws_19890101_20091231_v20.nc"];
17;           ws_correction_ncdf [shape=box,
18;           fontname=Courier,
19;           color=blue,
20;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/ws_correction_ncdf.pro",
21;           label="${PROJECT}/src/ws_correction_ncdf.pro"];
22;
23;           {file_in} -> {ws_correction_ncdf} -> {ncfile}
24;
25;          }
26;
27; SEE ALSO
28; ========
29;
30; EXAMPLES
31; ========
32;
33; ::
34;
35;  IDL> ws_correction_ncdf
36;
37; TODO
38; ====
39;
40; hard coded directory - usage of ${PROJECT_ID}
41;
42; coding rules
43;
44; EVOLUTIONS
45; ==========
46;
47; - fplod 20101215T115916Z aedon.locean-ipsl.upmc.fr (Darwin)
48;
49;   * add graph in header
50;
51; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin)
52;
53;   * minimal header
54;
55; - pbk 2008
56;
57;   * creation
58;
59;-
60pro ws_correction_ncdf
61@common
62da1=19880101 & da2=20101231
63
64file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_ws_19890101_20091231_oafluxgrid.nc'
65initncdf, file
66u=read_ncdf('u10',da1,da2,file=file,/nostr)
67v=read_ncdf('v10',da1,da2,file=file,/nostr)
68w=sqrt(u*u+v*v)
69
70help, w
71
72w_mean=grossemoyenne(w,'t',/nan)
73help, w_mean
74
75tt=time & jpt=n_elements(time)
76caldat, time,mon,day,yea
77w_m=w*0.
78
79for jt=0,jpt-1 do begin
80  jtt=(time(jt)-julday(1,1,yea(jt))) < 364
81  q=reform(w_mean(*,*))
82  w_m(*,*,jt)=q
83endfor
84help, w_m
85
86w_ano=w-w_m
87
88;; correction for mean based on scatter
89;w_m=w_m+0.282667    ;; (2000-2008)
90w_m=w_m+0.276739     ;; (2000-2009)
91
92help, w_ano
93
94;; applying the correction for varyability based on the scatter
95;w_ano=w_ano*(1/0.897667)   ;; (2000-2008)
96w_ano=w_ano*(1/0.903587)    ;; (2000-2009)
97
98w_new=w_m+w_ano
99help, w_new
100
101;writing field
102lat=reform(gphit(0,0:jpj-1))
103lon=reform(glamt(0:jpi-1,0))
104time=timegen(7670, units='days', start=julday(1,1,1989,0)) & jpt=n_elements(time)
105
106cda0=string(jul2date(time(0)),format='(i8.8)')
107cda1=string(jul2date(time(jpt-1)),format='(i8.8)')
108
109time=time-julday(1,1,1950) & jpt=n_elements(time)
110
111ncfile='!/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_ws_19890101_20091231_v20.nc'
112lon_attr={units:'degrees_east',long_name:'Longitude'}
113lat_attr={units:'degrees_north',long_name:'Latitude'}
114time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:'1950-JAN-01 00:00:00'}
115w_attr={units:'m/s',missing_value:1.e20,long_name:'mean wind speed',short_name:'w',axis:'TYX'}
116globattr={source:'Basic data obtained from ERAI. Bias and variability correction are applied',timerange:cda0+' - '+cda1}
117
118
119ncfields = 'ws[longitude,latitude,time]=w_new:w_attr; ' $
120                      + 'longitude[]=lon:lon_attr; ' $
121                      + 'latitude[]=lat:lat_attr; ' $
122                      + 'time[*time]=time:time_attr ' $
123                      + ' @ globattr'
124
125@ncdf_quickwrite
126
127end
Note: See TracBrowser for help on using the repository browser.