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