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