source: trunk/src/interp_erai_ws_1989_2009.pro @ 50

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

replace TROPFLUX by PROJECT

File size: 5.8 KB
Line 
1;+
2;
3; .. _interp_erai_ws_1989_2009.pro:
4;
5; ============================
6; interp_erai_ws_1989_2009.pro
7; ============================
8;
9;     .. graphviz::
10;
11;        digraph interp_erai_ws_1989_2009 {
12;           graph [
13;           rankdir="LR",
14;           ]
15;           file_u10 [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/ERAI_global/20c3m_erai_u10_TROP_1989_2009.nc"];
16;           file_v10 [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/ERAI_global/20c3m_erai_v10_TROP_1989_2009.nc"];
17;
18;           mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/mask_oaflux_30N30S.nc"];
19;
20;           ncfile [shape=ellipse,fontname=Courier,label="/Volumes/PRAVEEN/TropFlux/input_uncor/erai_ws_19890101_20091231_oafluxgrid.nc"];
21;
22;           interp_erai_ws_1989_2009 [shape=box,
23;           fontname=Courier,
24;           color=blue,
25;           URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_erai_ws_1989_2009.pro",
26;           label="${PROJECT}/src/interp_erai_ws_1989_2009.pro"];
27;
28;           {file_u10 file_v10 mask} -> {interp_erai_ws_1989_2009} -> {ncfile}
29;
30;        }
31;
32; SEE ALSO
33; ========
34;
35; :ref:`project_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_ws_1989_2009
52;
53;
54; TODO
55; ====
56;
57; hard coded directory - usage of ${PROJECT_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 20101215T112657Z 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_ws_1989_2009
88@common
89@cm_project
90;
91; check for input directory
92;
93; test if ${PROJECT_ID} defined
94CASE project_id_env OF
95    ''  :  BEGIN
96     msg = 'eee : ${PROJECT_ID} is not defined'
97     ras = report(msg)
98     STOP
99           END
100 ELSE: BEGIN
101     msg = 'iii : ${PROJECT_ID} is ' + project_id_env
102     ras = report(msg)
103       END
104ENDCASE
105;
106iodirin = isadirectory(project_id_env)
107;
108; existence and protection of ${PROJECT_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
126st=19880101 & en=20100930
127
128filein='/Volumes/PRAVEEN/ERAI_global/20c3m_erai_u10_TROP_1989_2009.nc'
129initncdf, filein
130u10in=read_ncdf("u10",st, en,file=filein,/nostr)
131
132filein='/Volumes/PRAVEEN/ERAI_global/20c3m_erai_v10_TROP_1989_2009.nc'
133initncdf, filein
134v10in=read_ncdf("v10",st, en,file=filein,/nostr)
135
136initncdf, filein
137domdef
138latin=reform(gphit(0,*)) & lonin=reform(glamt(*,0))
139print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0)
140print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0)
141
142timein=time & jptin=jpt
143tab=u10in(*,*,0)
144mskin=glamt*0.+1.
145
146initncdf, fullfilename_msk
147domdef
148latout=reform(gphit(0,*)) & lonout=reform(glamt(*,0))
149print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0)
150print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0)
151mskout=read_ncdf("msk", file=fullfilename_msk,/nostr)
152
153help, u10in, v10in,lonin,latin,mskin,lonout,latout,mskout
154
155si=size(u10in)
156u10out=fltarr(jpi,jpj,jptin)
157v10out=fltarr(jpi,jpj,jptin)
158
159for jt=0,jptin-1 do begin
160  print, 'Interpolation jt=',jt,' / ',jptin-1
161  tab=reform(u10in(*,*,jt))
162  u10out(*,*,jt)=call_interp2d(tab,lonin,latin,mskin,lonout,latout,method='bilinear')
163  u10out(*,*,jt)=u10out(*,*,jt)*mskout+(1.-mskout)*1.e20
164
165  tab=reform(v10in(*,*,jt))
166  v10out(*,*,jt)=call_interp2d(tab,lonin,latin,mskin,lonout,latout,method='bilinear')
167  v10out(*,*,jt)=v10out(*,*,jt)*mskout+(1.-mskout)*1.e20
168
169endfor
170
171time=timegen(7670, units='days', start=julday(1,1,1989)) & jpt=n_elements(time)
172tt=time & jptin=jpt
173cda0=string(jul2date(tt(0)),format='(i8.8)')
174cda1=string(jul2date(tt(jpt-1)),format='(i8.8)')
175tt=tt-julday(1,1,1950,00,00,00)
176xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*))
177
178initncdf, fullfilename_msk
179valmask=1.e20
180
181ylat=latout
182xlon=lonout
183ncfile='!/Volumes/PRAVEEN/TropFlux/input_uncor/erai_ws_19890101_20091231_oafluxgrid.nc'
184
185lon_attr={units:'degrees_east',long_name:'Longitude'}
186lat_attr={units:'degrees_north',long_name:'Latitude'}
187time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'}
188
189u10_attr={units:'m/s',missing_value:valmask,long_name:'10 metre u wind component',short_name:'u10',axis:'TYX'}
190v10_attr={units:'m/s',missing_value:valmask,long_name:'10 metre v wind component',short_name:'v10',axis:'TYX'}
191time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'}
192globattr={source:'Tropical ocean winds obtained from ERA Interim',timerange:cda0+' - '+cda1}
193
194help, u10out,v10out,tt,xlon,ylat
195
196ncfields = 'u10[longitude,latitude,time]=u10out:u10_attr; ' $
197          +'v10[longitude,latitude,time]=v10out:v10_attr; ' $
198                      + 'longitude[]=xlon:lon_attr; ' $
199                      + 'latitude[]=ylat:lat_attr; ' $
200                      + 'tt[*time]=tt:time_attr ' $
201                      + ' @ globattr'
202
203@ncdf_quickwrite
204
205return
206end
Note: See TracBrowser for help on using the repository browser.