source: trunk/src/t2m_correction_ncdf.pro @ 15

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

fix for graph in PDF

File size: 3.5 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; EXAMPLES
34; ========
35;
36; ::
37;
38;  IDL> t2m_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 20101215T114503Z 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 t2m_correction_ncdf
64@common
65da1=19890101 & da2=20091231
66
67file='/Volumes/Iomega_HDD/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc'
68initncdf, file
69t2m=read_ncdf('t2m',da1,da2,file=file,/nostr) & t2m=t2m-273.15
70help, t2m
71
72t2m_mean=grossemoyenne(t2m,'t',/nan)
73help, w_mean
74
75tt=time & jpt=n_elements(time)
76caldat, time,mon,day,yea
77t2m_m=t2m*0.
78bias_cor=t2m*0.
79
80;; line fit ->  -0.0755589x + 1.71090   ;; (2000-2008)
81;; line fit ->  -0.0741607x + 1.67601   ;; (2000-2009)
82
83for jt=0,jpt-1 do begin
84  jtt=(time(jt)-julday(1,1,yea(jt))) < 364
85  t=reform(t2m_mean(*,*))
86  t2m_m(*,*,jt)=t
87  bias_cor(*,*,jt)=(((t-22.6)*0.4004896/(28-22.6)) > 0.) <0.4     ;; (2000-2009)
88endfor
89help, t2m_m,bias_cor
90
91t2m_ano=t2m-t2m_m
92
93;; correction for mean based on scatter
94
95help, t2m_ano
96
97;; applying the correction for varyability based on the scatter
98;t2m_ano=t2m_ano*(1/0.916484)    ;; (2000-2008)
99t2m_ano=t2m_ano*(1/0.918085)     ;; (2000-2009)
100
101;; applying the correction for varyability based on the scatter
102t2m_m=t2m_m+bias_cor
103
104t2m_new=t2m_m+t2m_ano+273.15
105help, t2m_new
106
107;writing field
108lat=reform(gphit(0,0:jpj-1))
109lon=reform(glamt(0:jpi-1,0))
110time=timegen(7670, units='days', start=julday(1,1,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
117;ncfile='!/Volumes/Iomega_HDD/TropFlux/input_cor/full_cor/TropFlux_t2m_19890101_20091231_v20.nc'
118ncfile='!/Users/pkb/data/TropFlux/TropFlux_t2m_19890101_20091231_v50.nc'
119lon_attr={units:'degrees_east',long_name:'Longitude'}
120lat_attr={units:'degrees_north',long_name:'Latitude'}
121time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:'1950-JAN-01 00:00:00'}
122t2m_attr={units:'degK',missing_value:1.e20,long_name:'Air Temperature at 2m',short_name:'t2m',axis:'TYX'}
123globattr={source:'Basic data obtained from ERAI.  Mean correction for air temperautre bias and correction for variability are applied',timerange:cda0+' - '+cda1}
124
125
126ncfields = 't2m[longitude,latitude,time]=t2m_new:t2m_attr; ' $
127                      + 'longitude[]=lon:lon_attr; ' $
128                      + 'latitude[]=lat:lat_attr; ' $
129                      + 'time[*time]=time:time_attr ' $
130                      + ' @ globattr'
131
132@ncdf_quickwrite
133
134end
Note: See TracBrowser for help on using the repository browser.