source: trunk/src/t2m_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.6 KB
Line 
1;+
2;
3; .. _t2m_correction_ncdf.pro:
4;
5; =======================
6; t2m_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 t2m_correction_ncdf {
18;           graph [
19;           rankdir="LR",
20;           ]
21;
22;           file_t2m [shape=ellipse,fontname=Courier,label="/Volumes/Iomega_HDD/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc"];
23;
24;           ncfile [shape=ellipse,fontname=Courier,label="/Volumes/Iomega_HDD/TropFlux/input_cor/full_cor/TropFlux_t2m_19890101_20091231_v20.nc"];
25;
26;           t2m_correction_ncdf [shape=box,
27;           fontname=Courier,
28;           color=blue,
29;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/t2m_correction_ncdf.pro",
30;           label="${TROPFLUX}/src/t2m_correction_ncdf.pro"];
31;
32;           {file_t2m} -> {t2m_correction_ncdf} -> {ncfile}
33;
34;        }
35;
36; SEE ALSO
37; ========
38;
39; EXAMPLES
40; ========
41;
42; ::
43;
44;  IDL> t2m_correction_ncdf
45;
46; TODO
47; ====
48;
49; hard coded directory - usage of ${TROPFLUX_ID}
50;
51; coding rules
52;
53; EVOLUTIONS
54; ==========
55;
56; - fplod 20101215T114503Z 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 t2m_correction_ncdf
70@common
71da1=19890101 & da2=20091231
72
73file='/Volumes/Iomega_HDD/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc'
74initncdf, file
75t2m=read_ncdf('t2m',da1,da2,file=file,/nostr) & t2m=t2m-273.15
76help, t2m
77
78t2m_mean=grossemoyenne(t2m,'t',/nan)
79help, w_mean
80
81tt=time & jpt=n_elements(time)
82caldat, time,mon,day,yea
83t2m_m=t2m*0.
84bias_cor=t2m*0.
85
86;; line fit ->  -0.0755589x + 1.71090   ;; (2000-2008)
87;; line fit ->  -0.0741607x + 1.67601   ;; (2000-2009)
88
89for jt=0,jpt-1 do begin
90  jtt=(time(jt)-julday(1,1,yea(jt))) < 364
91  t=reform(t2m_mean(*,*))
92  t2m_m(*,*,jt)=t
93  bias_cor(*,*,jt)=(((t-22.6)*0.4004896/(28-22.6)) > 0.) <0.4     ;; (2000-2009)
94endfor
95help, t2m_m,bias_cor
96
97t2m_ano=t2m-t2m_m
98
99;; correction for mean based on scatter
100
101help, t2m_ano
102
103;; applying the correction for varyability based on the scatter
104;t2m_ano=t2m_ano*(1/0.916484)    ;; (2000-2008)
105t2m_ano=t2m_ano*(1/0.918085)     ;; (2000-2009)
106
107;; applying the correction for varyability based on the scatter
108t2m_m=t2m_m+bias_cor
109
110t2m_new=t2m_m+t2m_ano+273.15
111help, t2m_new
112
113;writing field
114lat=reform(gphit(0,0:jpj-1))
115lon=reform(glamt(0:jpi-1,0))
116time=timegen(7670, units='days', start=julday(1,1,1989)) & jpt=n_elements(time)
117
118cda0=string(jul2date(time(0)),format='(i8.8)')
119cda1=string(jul2date(time(jpt-1)),format='(i8.8)')
120
121time=time-julday(1,1,1950) & jpt=n_elements(time)
122
123;ncfile='!/Volumes/Iomega_HDD/TropFlux/input_cor/full_cor/TropFlux_t2m_19890101_20091231_v20.nc'
124ncfile='!/Users/pkb/data/TropFlux/TropFlux_t2m_19890101_20091231_v50.nc'
125lon_attr={units:'degrees_east',long_name:'Longitude'}
126lat_attr={units:'degrees_north',long_name:'Latitude'}
127time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:'1950-JAN-01 00:00:00'}
128t2m_attr={units:'degK',missing_value:1.e20,long_name:'Air Temperature at 2m',short_name:'t2m',axis:'TYX'}
129globattr={source:'Basic data obtained from ERAI.  Mean correction for air temperautre bias and correction for variability are applied',timerange:cda0+' - '+cda1}
130
131
132ncfields = 't2m[longitude,latitude,time]=t2m_new:t2m_attr; ' $
133                      + 'longitude[]=lon:lon_attr; ' $
134                      + 'latitude[]=lat:lat_attr; ' $
135                      + 'time[*time]=time:time_attr ' $
136                      + ' @ globattr'
137
138@ncdf_quickwrite
139
140end
Note: See TracBrowser for help on using the repository browser.