source: trunk/src/lwr_correction_ncdf.pro @ 67

Last change on this file since 67 was 50, checked in by pinsard, 13 years ago

replace TROPFLUX by PROJECT

File size: 3.3 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="${PROJECT}/src/lwr_correction_ncdf.pro"];
24;
25;           {file_in} -> {lwr_correction_ncdf} -> {ncfile}
26;
27;        }
28;
29; SEE ALSO
30; ========
31;
32; :func:`initncdf <saxo:initncdf>`
33; :func:`read_ncdf <saxo:read_ncdf>`
34; :func:`grossemoyenne <saxo:grossemoyenne>`
35; :func:`julday <saxo:julday>`
36; :func:`caldat <saxo:caldat>`
37; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>`
38;
39; EXAMPLES
40; ========
41;
42; ::
43;
44;  IDL> lwr_correction_ncdf
45;
46;
47; TODO
48; ====
49;
50; hard coded directory - usage of ${PROJECT_ID}
51;
52; coding rules
53;
54; EVOLUTIONS
55; ==========
56;
57; - fplod 20101215T113707Z aedon.locean-ipsl.upmc.fr (Darwin)
58;
59;   * add graph in header
60;
61; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin)
62;
63;   * minimal header
64;
65; - pbk 2008
66;
67;   * creation
68;
69;-
70pro lwr_correction_ncdf
71@common
72da1=19880101 & da2=20091231
73
74file='/Volumes/PRAVEEN/TropFlux/input_uncor/erai_lwr_19890102_20091231_oafluxgrid.nc'
75initncdf, file
76lwr=read_ncdf('lwr',da1,da2,file=file,/nostr)
77help, lwr
78
79lwr_mean=grossemoyenne(lwr,'t',/nan)
80help,lwr_mean
81
82tt=time & jpt=n_elements(time)
83caldat, time,mon,day,yea
84lwr_m=lwr*0.
85
86for jt=0,jpt-1 do begin
87  jtt=(time(jt)-julday(1,1,yea(jt))) < 364
88  t=reform(lwr_mean(*,*))
89  lwr_m(*,*,jt)=t
90endfor
91help, lwr_m
92
93lwr_ano=lwr-lwr_m
94
95;; correction for mean based on scatter
96lwr_m=lwr_m+4.61667
97
98help, lwr_ano
99
100;; applying the correction for varyability based on the scatter
101lwr_ano=lwr_ano*(1/0.760667)
102
103;; applying the correction for varyability based on the scatter
104
105lwr_new=lwr_m+lwr_ano
106help, lwr_new
107
108;writing field
109lat=reform(gphit(0,0:jpj-1))
110lon=reform(glamt(0:jpi-1,0))
111time=timegen(7669, units='days', start=julday(1,2,1989)) & jpt=n_elements(time)
112
113cda0=string(jul2date(time(0)),format='(i8.8)')
114cda1=string(jul2date(time(jpt-1)),format='(i8.8)')
115
116time=time-julday(1,1,1950) & jpt=n_elements(time)
117
118ncfile='!/Volumes/PRAVEEN/TropFlux/input_cor/full_cor/TropFlux_lwr_19890101_20091231_v1.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'}
122lwr_attr={units:'degK',missing_value:1.e20,long_name:'Air Temperature at 2m',short_name:'lwr',axis:'TYX'}
123globattr={source:'Basic data obtained from ERAI.  Mean correction for  bias and correction for variability are applied',timerange:cda0+' - '+cda1}
124
125
126ncfields = 'lwr[longitude,latitude,time]=lwr_new:lwr_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.