source: trunk/src/lwr_correction_ncdf.pro @ 11

Last change on this file since 11 was 9, checked in by pinsard, 13 years ago

add some graph - io - in headers (cont.)

File size: 3.2 KB
Line 
1;+
2;
3; .. _lwr_correction_ncdf.pro:
4;
5; =======================
6; lwr_correction_ncdf.pro
7; =======================
8;
9; .. only:: man
10;
11; Figure is visible on PDF and HTML documents only.
12;
13; .. only:: html
14;
15;     .. graphviz::
16;
17;        digraph lwr_correction_ncdf {
18;           graph [
19;           rankdir="LR",
20;           ]
21;
22;           file_in [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_lwr_19890102_20091231_oafluxgrid.nc"];
23;
24;           ncfile [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_lwr_19890101_20091231_v1.nc"];
25;           lwr_correction_ncdf [shape=box,
26;           fontname=Courier,
27;           color=blue,
28;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/lwr_correction_ncdf.pro",
29;           label="${TROPFLUX}/src/lwr_correction_ncdf.pro"];
30;
31;           {file_in} -> {lwr_correction_ncdf} -> {ncfile}
32;
33;        }
34;
35; SEE ALSO
36; ========
37;
38; EXAMPLES
39; ========
40;
41; ::
42;
43;  IDL> lwr_correction_ncdf
44;
45;
46; TODO
47; ====
48;
49; hard coded directory - usage of ${TROPFLUX_ID}
50;
51; coding rules
52;
53; EVOLUTIONS
54; ==========
55;
56; - fplod 20101215T113707Z 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 lwr_correction_ncdf
70@common
71da1=19880101 & da2=20091231
72
73file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_lwr_19890102_20091231_oafluxgrid.nc'
74initncdf, file
75lwr=read_ncdf('lwr',da1,da2,file=file,/nostr)
76help, lwr
77
78lwr_mean=grossemoyenne(lwr,'t',/nan)
79help,lwr_mean
80
81tt=time & jpt=n_elements(time)
82caldat, time,mon,day,yea
83lwr_m=lwr*0.
84
85for jt=0,jpt-1 do begin
86  jtt=(time(jt)-julday(1,1,yea(jt))) < 364
87  t=reform(lwr_mean(*,*))
88  lwr_m(*,*,jt)=t
89endfor
90help, lwr_m
91
92lwr_ano=lwr-lwr_m
93
94;; correction for mean based on scatter
95lwr_m=lwr_m+4.61667
96
97help, lwr_ano
98
99;; applying the correction for varyability based on the scatter
100lwr_ano=lwr_ano*(1/0.760667)
101
102;; applying the correction for varyability based on the scatter
103
104lwr_new=lwr_m+lwr_ano
105help, lwr_new
106
107;writing field
108lat=reform(gphit(0,0:jpj-1))
109lon=reform(glamt(0:jpi-1,0))
110time=timegen(7669, units='days', start=julday(1,2,1989)) & jpt=n_elements(time)
111
112cda0=string(jul2date(time(0)),format='(i8.8)')
113cda1=string(jul2date(time(jpt-1)),format='(i8.8)')
114
115time=time-julday(1,1,1950) & jpt=n_elements(time)
116
117ncfile='!/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_lwr_19890101_20091231_v1.nc'
118lon_attr={units:'degrees_east',long_name:'Longitude'}
119lat_attr={units:'degrees_north',long_name:'Latitude'}
120time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:'1950-JAN-01 00:00:00'}
121lwr_attr={units:'degK',missing_value:1.e20,long_name:'Air Temperature at 2m',short_name:'lwr',axis:'TYX'}
122globattr={source:'Basic data obtained from ERAI.  Mean correction for  bias and correction for variability are applied',timerange:cda0+' - '+cda1}
123
124
125ncfields = 'lwr[longitude,latitude,time]=lwr_new:lwr_attr; ' $
126                      + 'longitude[]=lon:lon_attr; ' $
127                      + 'latitude[]=lat:lat_attr; ' $
128                      + 'time[*time]=time:time_attr ' $
129                      + ' @ globattr'
130
131@ncdf_quickwrite
132
133end
Note: See TracBrowser for help on using the repository browser.