source: trunk/src/t2m_correction_ncdf.pro @ 26

Last change on this file since 26 was 20, checked in by pinsard, 13 years ago

sphinx intermapping with SAXO

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