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