source: trunk/src/lwr_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.1 KB
Line 
1;+
2;
3; .. _lwr_correction_ncdf.pro:
4;
5; =======================
6; lwr_correction_ncdf.pro
7; =======================
8;
9;     .. graphviz::
10;
11;        digraph lwr_correction_ncdf {
12;           graph [
13;           rankdir="LR",
14;           ]
15;
16;           file_in [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_lwr_19890102_20091231_oafluxgrid.nc"];
17;
18;           ncfile [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_lwr_19890101_20091231_v1.nc"];
19;           lwr_correction_ncdf [shape=box,
20;           fontname=Courier,
21;           color=blue,
22;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/lwr_correction_ncdf.pro",
23;           label="${TROPFLUX}/src/lwr_correction_ncdf.pro"];
24;
25;           {file_in} -> {lwr_correction_ncdf} -> {ncfile}
26;
27;        }
28;
29; SEE ALSO
30; ========
31;
32; EXAMPLES
33; ========
34;
35; ::
36;
37;  IDL> lwr_correction_ncdf
38;
39;
40; TODO
41; ====
42;
43; hard coded directory - usage of ${TROPFLUX_ID}
44;
45; coding rules
46;
47; EVOLUTIONS
48; ==========
49;
50; - fplod 20101215T113707Z 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 lwr_correction_ncdf
64@common
65da1=19880101 & da2=20091231
66
67file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_lwr_19890102_20091231_oafluxgrid.nc'
68initncdf, file
69lwr=read_ncdf('lwr',da1,da2,file=file,/nostr)
70help, lwr
71
72lwr_mean=grossemoyenne(lwr,'t',/nan)
73help,lwr_mean
74
75tt=time & jpt=n_elements(time)
76caldat, time,mon,day,yea
77lwr_m=lwr*0.
78
79for jt=0,jpt-1 do begin
80  jtt=(time(jt)-julday(1,1,yea(jt))) < 364
81  t=reform(lwr_mean(*,*))
82  lwr_m(*,*,jt)=t
83endfor
84help, lwr_m
85
86lwr_ano=lwr-lwr_m
87
88;; correction for mean based on scatter
89lwr_m=lwr_m+4.61667
90
91help, lwr_ano
92
93;; applying the correction for varyability based on the scatter
94lwr_ano=lwr_ano*(1/0.760667)
95
96;; applying the correction for varyability based on the scatter
97
98lwr_new=lwr_m+lwr_ano
99help, lwr_new
100
101;writing field
102lat=reform(gphit(0,0:jpj-1))
103lon=reform(glamt(0:jpi-1,0))
104time=timegen(7669, units='days', start=julday(1,2,1989)) & 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_lwr_19890101_20091231_v1.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'}
115lwr_attr={units:'degK',missing_value:1.e20,long_name:'Air Temperature at 2m',short_name:'lwr',axis:'TYX'}
116globattr={source:'Basic data obtained from ERAI.  Mean correction for  bias and correction for variability are applied',timerange:cda0+' - '+cda1}
117
118
119ncfields = 'lwr[longitude,latitude,time]=lwr_new:lwr_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.