source: trunk/src/q2m_correction_ncdf.pro @ 17

Last change on this file since 17 was 12, checked in by pinsard, 13 years ago

fix for graph in PDF

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