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