1 | ;+ |
---|
2 | ; |
---|
3 | ; .. _interp_olr_30n30s_1989_2009.pro: |
---|
4 | ; |
---|
5 | ; =============================== |
---|
6 | ; interp_olr_30n30s_1989_2009.pro |
---|
7 | ; =============================== |
---|
8 | ; |
---|
9 | ; .. graphviz:: |
---|
10 | ; |
---|
11 | ; digraph interp_olr_30n30s_1989_2009{ |
---|
12 | ; graph [ |
---|
13 | ; rankdir="LR", |
---|
14 | ; ] |
---|
15 | ; file_in [shape=ellipse,fontname=Courier,label="/Users/pkb/data/heat_budget/NOAA_OLR/new/olr.day.mean_new.nc"]; |
---|
16 | ; |
---|
17 | ; mask [shape=ellipse,fontname=Courier,label="${PROJECT_ID}/mask_oaflux_30N30S.nc"]; |
---|
18 | ; |
---|
19 | ; ncfile [shape=ellipse,fontname=Courier,label="/Users/pkb/data/heat_budget/NOAA_OLR/newolr_oafluxgrid_30n30s_19890101_20091231.nc"]; |
---|
20 | ; |
---|
21 | ; interp_olr_30n30s_1989_2009 [shape=box, |
---|
22 | ; fontname=Courier, |
---|
23 | ; color=blue, |
---|
24 | ; URL="http://forge.ipsl.jussieu.fr/tropflux/browser/trunk/src/interp_olr_30n30s_1989_2009.pro", |
---|
25 | ; label="${PROJECT}/src/interp_olr_30n30s_1989_2009.pro"]; |
---|
26 | ; |
---|
27 | ; {file_in mask} -> {interp_olr_30n30s_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_olr_30n30s_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 | ; pb with mixing interpolated and uninterpolated OLR data |
---|
63 | ; |
---|
64 | ; uninterpolated OLR is more timely |
---|
65 | ; |
---|
66 | ; cf. pk and jv to solve this issue |
---|
67 | ; |
---|
68 | ; test of existence of fullfilename_msk not very efficient because |
---|
69 | ; MUST_EXIST keyword of :func:`isafile <saxo:isafile>` not yet implemented |
---|
70 | ; |
---|
71 | ; EVOLUTIONS |
---|
72 | ; ========== |
---|
73 | ; |
---|
74 | ; - fplod 20101217T140745Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
75 | ; |
---|
76 | ; * remove hard coded directory for mask_oaflux_30N30S.nc |
---|
77 | ; |
---|
78 | ; - fplod 20101215T113118Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
79 | ; |
---|
80 | ; * add graph in header |
---|
81 | ; |
---|
82 | ; - fplod 20101214T093615Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
83 | ; |
---|
84 | ; * minimal header |
---|
85 | ; |
---|
86 | ; - pbk 2008 |
---|
87 | ; |
---|
88 | ; * creation |
---|
89 | ; |
---|
90 | ;- |
---|
91 | pro interp_olr_30n30s_1989_2009 |
---|
92 | @common |
---|
93 | ; |
---|
94 | ; check for input directory |
---|
95 | ; |
---|
96 | ; test if ${PROJECT_ID} defined |
---|
97 | CASE project_id_env OF |
---|
98 | '' : BEGIN |
---|
99 | msg = 'eee : ${PROJECT_ID} is not defined' |
---|
100 | ras = report(msg) |
---|
101 | STOP |
---|
102 | END |
---|
103 | ELSE: BEGIN |
---|
104 | msg = 'iii : ${PROJECT_ID} is ' + project_id_env |
---|
105 | ras = report(msg) |
---|
106 | END |
---|
107 | ENDCASE |
---|
108 | ; |
---|
109 | iodirin = isadirectory(project_id_env) |
---|
110 | ; |
---|
111 | ; existence and protection of ${PROJECT_ID} |
---|
112 | IF (FILE_TEST(iodirin, /DIRECTORY, /EXECUTABLE, /READ) EQ 0) THEN BEGIN |
---|
113 | msg = 'eee : the directory' + iodirin + ' is not accessible.' |
---|
114 | ras = report(msg) |
---|
115 | STOP |
---|
116 | ENDIF |
---|
117 | ; |
---|
118 | ; build mask filename |
---|
119 | filename_msk='mask_oaflux_30N30S.nc' |
---|
120 | ; |
---|
121 | ; check if this file exists |
---|
122 | fullfilename_msk = isafile(iodirin + filename_msk, NEW=0, /MUST_EXIST) |
---|
123 | IF fullfilename_msk[0] EQ '' THEN BEGIN |
---|
124 | msg = 'eee : the file ' + fullfilename_msk + ' was not found.' |
---|
125 | ras = report(msg) |
---|
126 | STOP |
---|
127 | ENDIF |
---|
128 | |
---|
129 | filein='/Users/pkb/data/heat_budget/NOAA_OLR/new/olr.day.mean_new.nc' |
---|
130 | |
---|
131 | initncdf, filein |
---|
132 | domdef |
---|
133 | latin=reform(gphit(0,*)) & lonin=reform(glamt(*,0)) |
---|
134 | print, 'lat grid ',min(latin),max(latin),latin(1)-latin(0) |
---|
135 | print, 'lon grid ',min(lonin),max(lonin),lonin(1)-lonin(0) |
---|
136 | olrin=read_ncdf("olr",19881231, 20091231, file=filein,/nostr) |
---|
137 | |
---|
138 | mskin=glamt*0.+1. |
---|
139 | |
---|
140 | timein=time & jptin=jpt |
---|
141 | |
---|
142 | initncdf, fullfilename_msk |
---|
143 | domdef |
---|
144 | latout=reform(gphit(0,*)) & lonout=reform(glamt(*,0)) |
---|
145 | print, 'lat grid ',min(latout),max(latout),latout(1)-latout(0) |
---|
146 | print, 'lon grid ',min(lonout),max(lonout),lonout(1)-lonout(0) |
---|
147 | mskout=read_ncdf("msk", file=fullfilename_msk,/nostr) |
---|
148 | |
---|
149 | help, olrin,lonin,latin,mskin,lonout,latout,mskout |
---|
150 | |
---|
151 | olrout=fltarr(jpi,jpj,jptin) |
---|
152 | |
---|
153 | for jt=0,jptin-1 do begin |
---|
154 | |
---|
155 | print, 'Interpolation jt=',jt,' / ',jptin-1 |
---|
156 | tab_olr=reform(olrin(*,*,jt)) |
---|
157 | |
---|
158 | olrout(*,*,jt)=call_interp2d(tab_olr,lonin,latin,mskin,lonout,latout,method='bilinear') |
---|
159 | |
---|
160 | olrout(*,*,jt)=olrout(*,*,jt)*mskout+(1.-mskout)*1.e20 |
---|
161 | |
---|
162 | endfor |
---|
163 | |
---|
164 | |
---|
165 | timein=timein & jptin=jpt |
---|
166 | |
---|
167 | timein=timein-julday(1,1,1950,00,00) |
---|
168 | |
---|
169 | lat=latout |
---|
170 | lon=lonout |
---|
171 | ncfile='!/Users/pkb/data/heat_budget/NOAA_OLR/newolr_oafluxgrid_30n30s_19890101_20091231.nc' |
---|
172 | lon_attr={units:'degrees_east',long_name:'Longitude'} |
---|
173 | lat_attr={units:'degrees_north',long_name:'Latitude'} |
---|
174 | time_attr={units:'days since 1950-01-01 00:00:00',long_name:'Time axis',time_origin:' 1950-JAN-01 00:00:00'} |
---|
175 | olr_attr={units:'w/m^2',missing_value:1e20,long_name:'Outgoing Longwave Radiation',short_name:'olr',axis:'TYX'} |
---|
176 | olra_attr={units:'w/m^2',missing_value:1e20,long_name:'Outgoing Longwave Radiation Anomaly',short_name:'olra',axis:'TYX'} |
---|
177 | globattr={source:'NOAA OLR, cf http://www.cdc.noaa.gov/cdc/data.interp_OLR.html, interpolated to 1x1 degree grid and with oaflux mask'} |
---|
178 | |
---|
179 | |
---|
180 | ncfields = 'olr[longitude,latitude,time]=olrout:olr_attr; ' $ |
---|
181 | + 'longitude[]=lon:lon_attr; ' $ |
---|
182 | + 'latitude[]=lat:lat_attr; ' $ |
---|
183 | + 'time[*time]=timein:time_attr ' $ |
---|
184 | + ' @ globattr' |
---|
185 | |
---|
186 | @ncdf_quickwrite |
---|
187 | |
---|
188 | |
---|
189 | end |
---|