source: trunk/src/interp_erai_t2m_1989_2009.pro @ 20

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

sphinx intermapping with SAXO

File size: 5.0 KB
Line 
1;+
2;
3; .. _interp_erai_t2m_1989_2009.pro:
4;
5; =============================
6; interp_erai_t2m_1989_2009.pro
7; =============================
8;
9;
10;     .. graphviz::
11;
12;        digraph interp_erai_t2m_1989_2009 {
13;           graph [
14;           rankdir="LR",
15;           ]
16;           file_in [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/ERAI_global/20c3m_erai_t2_TROP_1989_2009.nc"];
17;           mask [shape=ellipse,fontname=Courier,label="${TROPFLUX_ID}/mask_oaflux_30N30S.nc"];
18;
19;           ncfile [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc"];
20;
21;           interp_erai_t2m_1989_2009 [shape=box,
22;           fontname=Courier,
23;           color=blue,
24;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_erai_t2m_1989_2009.pro"",
25;           label="${TROPFLUX}/src/interp_erai_t2m_1989_2009.pro"];
26;
27;           {file_in mask} -> {interp_erai_t2m_1989_2009} -> {ncfile}
28;
29;          }
30;
31;
32; SEE ALSO
33; ========
34;
35; :ref:`tropflux_profile.sh`
36;
37; :func:`report <saxo:report>`
38; :func:`isadirectory <saxo:isadirectory>`
39; :func:`isafile <saxo:isafile>`
40; :func:`initncdf <saxo:initncdf>`
41; :func:`read_ncdf <saxo:read_ncdf>`
42; :func:`domdef <saxo:domdef>`
43; :func:`call_interp2d <saxo:call_interp2d>`
44; :func:`ncdf_quickwrite <saxo:ncdf_quickwrite>`
45;
46; EXAMPLES
47; ========
48;
49; ::
50;
51;  IDL> interp_erai_t2m_1989_2009
52;
53;
54; TODO
55; ====
56;
57; hard coded directory - usage of ${TROPFLUX_ID}
58;
59; coding rules
60;
61; KNOWN ISSUES
62; ============
63;
64; test of existence of fullfilename_msk not very efficient because
65; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented
66;
67; EVOLUTIONS
68; ==========
69;
70; - fplod 20101217T140745Z aedon.locean-ipsl.upmc.fr (Darwin)
71;
72;   * remove hard coded directory for mask_oaflux_30N30S.nc
73;
74; - fplod 20101215T112140Z aedon.locean-ipsl.upmc.fr (Darwin)
75;
76;   * add graph in header
77;
78; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin)
79;
80;   * minimal header
81;
82; - pbk 2008
83;
84;   * creation
85;
86;-
87pro interp_erai_t2m_1989_2009
88@common
89;
90; check for input directory
91;
92; test if ${TROPFLUX_ID} defined
93tropflux_id_env=GETENV('TROPFLUX_ID')
94CASE tropflux_id_env OF
95    ''  :  BEGIN
96     msg = 'eee : ${TROPFLUX_ID} is not defined'
97     ras = report(msg)
98     STOP
99           END
100 ELSE: BEGIN
101     msg = 'iii : ${TROPFLUX_ID} is ' + tropflux_id_env
102     ras = report(msg)
103       END
104ENDCASE
105;
106iodirin = isadirectory(tropflux_id_env)
107;
108; existence and protection of ${TROPFLUX_ID}
109IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN
110   msg = 'eee : the directory' + iodirin  + ' is not accessible.'
111   ras = report(msg)
112   STOP
113ENDIF
114;
115; build mask filename
116filename_msk='mask_oaflux_30N30S.nc'
117;
118; check if this file exists
119fullfilename_msk = isafile(iodirin + filename_msk, NEW=0, /MUST_EXIST)
120IF fullfilename_msk[0] EQ '' THEN BEGIN
121   msg = 'eee : the file ' + fullfilename_msk + ' was not found.'
122   ras = report(msg)
123   STOP
124ENDIF
125
126filein='/Volumes/PRAVEEN/ERAI_global/20c3m_erai_t2_TROP_1989_2009.nc'
127
128initncdf, filein
129domdef
130latin=reform(gphit(0,*)) & lonin=reform(glamt(*,0))
131print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0)
132print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0)
133t2min=read_ncdf("t2",19880101,20100930,file=filein,/nostr)
134
135timein=time & jptin=jpt
136tab=t2min(*,*,0)
137mskin=glamt*0.+1.
138
139initncdf, fullfilename_msk
140domdef
141latout=reform(gphit(0,*)) & lonout=reform(glamt(*,0))
142print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0)
143print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0)
144mskout=read_ncdf("msk", file=fullfilename_msk,/nostr)
145
146help, t2min,lonin,latin,mskin,lonout,latout,mskout
147si=size(t2min)
148t2mout=fltarr(jpi,jpj,jptin)
149for jt=0,jptin-1 do begin
150  print, 'Interpolation jt=',jt,' / ',jptin-1
151  tab=reform(t2min(*,*,jt))
152  t2mout(*,*,jt)=call_interp2d(tab,lonin,latin,mskin,lonout,latout,method='bilinear')
153  t2mout(*,*,jt)=t2mout(*,*,jt)*mskout+(1.-mskout)*1.e20
154endfor
155
156timein=timein & jptin=jpt
157
158initncdf, fullfilename_msk
159help, t2mout
160tt=timein
161time=julday(1,1,1989)+lindgen(7670)+0.5 & jpt=n_elements(time)
162;cda0=string(jul2date(time(0)),format='(i8.8)')
163;cda1=string(jul2date(time(jpt-1)),format='(i8.8)')
164;cda0=string('19890101') & cda1=string('20091231')
165
166timein=time-julday(1,1,1950,00,00)
167
168lat=latout
169lon=lonout
170ncfile='!/Volumes/PRAVEEN/TropFlux/input_uncor/erai_t2m_19890101_20091231_oafluxgrid.nc'
171lon_attr={units:'degrees_east',long_name:'Longitude'}
172lat_attr={units:'degrees_north',long_name:'Latitude'}
173time_attr={units:'hours since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'}
174t2m_attr={units:'degK',missing_value:1e20,long_name:'Air Temperature at 2m',short_name:'t2m',axis:'TYX'}
175globattr={source:'Data are from ECMWF ERA-Interim reanalysis', timerange:cda0+' - '+cda1}
176
177
178ncfields = 't2m[longitude,latitude,time]=t2mout:t2m_attr; ' $
179                      + 'longitude[]=lon:lon_attr; ' $
180                      + 'latitude[]=lat:lat_attr; ' $
181                      + 'time[*time]=timein:time_attr ' $
182                      + ' @ globattr'
183
184@ncdf_quickwrite
185
186
187end
Note: See TracBrowser for help on using the repository browser.