source: trunk/src/interp_erai_lwr_1989_2009.pro @ 26

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

sphinx intermapping with SAXO

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="${TROPFLUX_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="${TROPFLUX}/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:`tropflux_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 ${TROPFLUX_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 ${TROPFLUX_ID} defined
91tropflux_id_env=GETENV('TROPFLUX_ID')
92CASE tropflux_id_env OF
93    ''  :  BEGIN
94     msg = 'eee : ${TROPFLUX_ID} is not defined'
95     ras = report(msg)
96     STOP
97           END
98 ELSE: BEGIN
99     msg = 'iii : ${TROPFLUX_ID} is ' + tropflux_id_env
100     ras = report(msg)
101       END
102ENDCASE
103;
104iodirin = isadirectory(tropflux_id_env)
105;
106; existence and protection of ${TROPFLUX_ID}
107IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN
108   msg = 'eee : the directory' + iodirin  + ' is not accessible.'
109   ras = report(msg)
110   STOP
111ENDIF
112;
113; build mask filename
114filename_msk='mask_oaflux_30N30S.nc'
115;
116; check if this file exists
117fullfilename_msk = isafile(iodirin + filename_msk, NEW=0, /MUST_EXIST)
118IF fullfilename_msk[0] EQ '' THEN BEGIN
119   msg = 'eee : the file ' + fullfilename_msk + ' was not found.'
120   ras = report(msg)
121   STOP
122ENDIF
123
124st=19890101 & en=20090801
125
126filein='/Volumes/PRAVEEN/ERAI_global/20c3m_erai_str_TROP_1989_2009.nc'
127initncdf, filein
128lwrin=read_ncdf("str",0,7668,/timestep,file=filein,/nostr)
129lwrin=-1*lwrin
130help, lwrin
131
132initncdf, filein
133domdef
134latin=reform(gphit(0,*)) & lonin=reform(glamt(*,0))
135print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0)
136print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0)
137
138timein=time & jptin=jpt
139tab=lwrin(*,*,0)
140mskin=glamt*0.+1.
141
142initncdf, fullfilename_msk
143domdef
144latout=reform(gphit(0,*)) & lonout=reform(glamt(*,0))
145print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0)
146print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0)
147mskout=read_ncdf("msk", file=fullfilename_msk,/nostr)
148
149help, lwrin
150
151si=size(swrin)
152lwrout=fltarr(jpi,jpj,jptin)
153
154for jt=0,jptin-1 do begin
155  print, 'Interpolation jt=',jt,' / ',jptin-1
156
157  tab=reform(lwrin(*,*,jt))
158  lwrout(*,*,jt)=call_interp2d(tab,lonin,latin,mskin,lonout,latout,method='bilinear')
159  lwrout(*,*,jt)=lwrout(*,*,jt)*mskout+(1.-mskout)*1.e20
160
161endfor
162
163time=timegen(7669, start=julday(1,2,1989,0), units='days') & jpt=n_elements(time)
164tt=time & jptin=jpt
165cda0=string(jul2date(tt(0)),format='(i8.8)')
166cda1=string(jul2date(tt(jpt-1)),format='(i8.8)')
167tt=tt-julday(1,1,1950,00,00,00)
168xlon=reform(glamt(*,0) ) & ylat=reform(gphit(0,*))
169
170initncdf, fullfilename_msk
171valmask=1.e20
172
173ylat=latout
174xlon=lonout
175ncfile='!/Volumes/PRAVEEN/TropFlux/input_uncor/erai_lwr_19890102_20091231_oafluxgrid.nc'
176
177lon_attr={units:'degrees_east',long_name:'Longitude'}
178lat_attr={units:'degrees_north',long_name:'Latitude'}
179time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'}
180
181lwr_attr={units:'W/m2',missing_value:valmask,long_name:'Surface net longwave radiation ',short_name:'lwr',axis:'TYX'}
182time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'}
183globattr={source:'Tropical ocean fluxes obtained from ERA Interim',timerange:cda0+' - '+cda1}
184
185help,lwrout
186
187ncfields = 'lwr[longitude,latitude,time]=lwrout:lwr_attr; ' $
188                      + 'longitude[]=xlon:lon_attr; ' $
189                      + 'latitude[]=ylat:lat_attr; ' $
190                      + 'tt[*time]=tt:time_attr ' $
191                      + ' @ globattr'
192
193@ncdf_quickwrite
194
195return
196end
Note: See TracBrowser for help on using the repository browser.