1 | function [t,lat,dataconcatenees]=hovmullerlat(dataset,yyyymmddb,yyyymmdde,lon,latmin,latmax) |
---|
2 | |
---|
3 | %+ |
---|
4 | % |
---|
5 | % |
---|
6 | % ============== |
---|
7 | % hovmullerlat.m |
---|
8 | % ============== |
---|
9 | % |
---|
10 | % .. function:: hovmullerlat(dataset,yyyymmddb,yyyymmdde,lon,latmin,latmax) |
---|
11 | % |
---|
12 | % DESCRIPTION |
---|
13 | % =========== |
---|
14 | % |
---|
15 | % :param dataset: dateset EPSAT MSG TRMM |
---|
16 | % :type dataset: string |
---|
17 | % :raise dataset: required |
---|
18 | % |
---|
19 | % :param yyyymmddb: date début yyyymmdd |
---|
20 | % :type yyyymmddb: double |
---|
21 | % :raise yyyymmddb: required |
---|
22 | % |
---|
23 | % :param yyyymmdde: date fin yyyymmdd |
---|
24 | % :type yyyymmdde: double |
---|
25 | % :raise yyyymmdde: required |
---|
26 | % |
---|
27 | % :param lon: longitude, W < 0 |
---|
28 | % :units lon: deg |
---|
29 | % :type lon: double |
---|
30 | % :raise lon: required |
---|
31 | % |
---|
32 | % :param latmin: latitude min, N > 0 |
---|
33 | % :units latmin: deg |
---|
34 | % :type latmin: double |
---|
35 | % :raise latmin: required |
---|
36 | % |
---|
37 | % :param latmax: latitude max, N > 0 |
---|
38 | % :units latmax: deg |
---|
39 | % :type latmax: double |
---|
40 | % :raise latmax: required |
---|
41 | % |
---|
42 | % If **dateset** is set to ``EPSAT``, `hovmullerlat`` read daily EPSAT files |
---|
43 | % :file:`${PROJECT_ID}/EPSAT/yyyy/mm/surf-rr_epsat-sg_multi-sat_010d_30min_yyyymmdd_v*.nc` |
---|
44 | % between **yyyymmddb** and **yyyymmdde** |
---|
45 | % |
---|
46 | % If **dateset** is set to ``MSG``, `hovmullerlat`` read daily MSG files |
---|
47 | % :file:`${PROJECT_ID}/MSG/yyyy/mm/msg-tb108-yyyy-mm-dd_15min.nc` |
---|
48 | % between **yyyymmddb** and **yyyymmdde** |
---|
49 | % |
---|
50 | % If **dateset** is set to ``TRMM``, `hovmullerlat`` read daily TRMM files |
---|
51 | % :file:`${PROJECT_ID}/TRMM/3B40/yyyy/mm/3B40RT.yyyymmdd.5.nc` |
---|
52 | % between **yyyymmddb** and **yyyymmdde** |
---|
53 | % |
---|
54 | % It plot an hovmüller diagram between **latmin** and **latmax** for |
---|
55 | % the constant longitude **lon**. |
---|
56 | % |
---|
57 | % EXAMPLES |
---|
58 | % ======== |
---|
59 | % |
---|
60 | % To plot an hovmüller diagram of EPSAT between 20060801 and 20060802: |
---|
61 | % |
---|
62 | % see demo 1 |
---|
63 | % |
---|
64 | % To plot an hovmüller diagram of MSG between 20060801 and 20060802: |
---|
65 | % |
---|
66 | % see demo 2 |
---|
67 | % |
---|
68 | % To plot an hovmüller diagram of TRMM between 20060801 and 20060802: |
---|
69 | % |
---|
70 | % see demo 3 |
---|
71 | % |
---|
72 | % SEE ALSO |
---|
73 | % ======== |
---|
74 | % |
---|
75 | % :ref:`data_msg` |
---|
76 | % :ref:`data_epsat` |
---|
77 | % |
---|
78 | % :ref:`varamma_startup.m` |
---|
79 | % |
---|
80 | % use : |
---|
81 | % :func:`EPSATread` |
---|
82 | % :func:`MSGread` |
---|
83 | % :func:`TRMMread` |
---|
84 | % |
---|
85 | % TODO |
---|
86 | % ==== |
---|
87 | % |
---|
88 | % scientific check : EPSAT demo all blue (0), TRMM blue and < 0 |
---|
89 | % |
---|
90 | % if lon given in arg is not exactly a longitude step of original data file, no data will be output from |
---|
91 | % MSGread or EPSATread. this is the case of -15 not found in EPSAT data; -15.05 exists |
---|
92 | % |
---|
93 | % test on more than one day |
---|
94 | % |
---|
95 | % externalize *read |
---|
96 | % |
---|
97 | % don't to how to initialize ficlist because of variable length |
---|
98 | % according to PROJECT_ID value |
---|
99 | % |
---|
100 | % save figure |
---|
101 | % |
---|
102 | % get rid of mlint output |
---|
103 | % |
---|
104 | % status de retour |
---|
105 | % |
---|
106 | % split reading and calculate and plot |
---|
107 | % |
---|
108 | % check argument |
---|
109 | % |
---|
110 | % understand this line :: |
---|
111 | % |
---|
112 | % dataconcatenees(find(dataconcatenees == 655.35))=NaN; |
---|
113 | % |
---|
114 | % missing value is DATA:missing_value = 32767s and they are |
---|
115 | % supposed to be set to NaN by MSGread now (20110607) |
---|
116 | % |
---|
117 | % do we need to build filename here ? no so sure !! |
---|
118 | % |
---|
119 | % EVOLUTIONS |
---|
120 | % ========== |
---|
121 | % |
---|
122 | % $Id$ |
---|
123 | % |
---|
124 | % $URL$ |
---|
125 | % |
---|
126 | % - fplod 20110609T132558Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
127 | % |
---|
128 | % * introduce TRMM dataset |
---|
129 | % * force lonmin lonmax for TRMM dataset (see pb selection of data in *read) |
---|
130 | % |
---|
131 | % - fplod 20110609T124630Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
132 | % |
---|
133 | % * no more dimension pb for MSG one day demo |
---|
134 | % * lat/lon domaine reduction is now done by reading module |
---|
135 | % * force lonmin lonmax for EPSAT dataset (see pb selection of data in EPSATread/MSGread) |
---|
136 | % |
---|
137 | % - fplod 20110609T095307Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
138 | % |
---|
139 | % * add dataset parameter |
---|
140 | % * Temps is now julian date |
---|
141 | % * remove unused calculation of "nb de pixels froids" |
---|
142 | % * time is a reserved word |
---|
143 | % * introduce EPSAT dataset |
---|
144 | % |
---|
145 | % - pinsard 2011-06-08T15:43:37Z loholt1.ipsl.polytechnique.fr (Linux) |
---|
146 | % |
---|
147 | % * new arg for MSGread |
---|
148 | % |
---|
149 | % - fplod 20110607T154319Z cratos.locean-ipsl.upmc.fr (Linux) |
---|
150 | % |
---|
151 | % * correction for nbfic computation (was always not null) |
---|
152 | % |
---|
153 | % - fplod 20110607T094651Z cratos.locean-ipsl.upmc.fr (Linux) |
---|
154 | % |
---|
155 | % * make it work with octave 3.4.0 : explicit num2str format for date |
---|
156 | % conversion, call for datetick |
---|
157 | % * correction for more than one day |
---|
158 | % |
---|
159 | % - pinsard 2011-06-07T07:11:27Z loholt1.ipsl.polytechnique.fr (Linux) |
---|
160 | % |
---|
161 | % * example move to demo |
---|
162 | % * indentation |
---|
163 | % * replace datedebut parameter by yyyymmddb, replace datefin parameter by yyyymmdde |
---|
164 | % * fix for path of MSG files |
---|
165 | % * use of netcdf.open on climserv |
---|
166 | % * loop on yime like in evolution_msg.m |
---|
167 | % * usage of MSGread |
---|
168 | % |
---|
169 | % nb : seems to be ok on climserv |
---|
170 | % |
---|
171 | % - pinsard 2011-05-26T07:52:18Z loholt1.ipsl.polytechnique.fr |
---|
172 | % |
---|
173 | % * image is a function (reserve word) |
---|
174 | % |
---|
175 | % - fplod 20110224T091457Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
176 | % |
---|
177 | % * add a missing end statement |
---|
178 | % |
---|
179 | % - fplod 20110121T134332Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
180 | % |
---|
181 | % * complement on header |
---|
182 | % |
---|
183 | % - fplod 20100608T124102Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
184 | % |
---|
185 | % * no more datetick if running octave 3.0.2 |
---|
186 | % |
---|
187 | % * make it work running with matlab 7.4 |
---|
188 | % now :: |
---|
189 | % |
---|
190 | % Value must be a column or row vector. |
---|
191 | % |
---|
192 | % - fplod 20100604T092417Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
193 | % |
---|
194 | % * minimize mlint output |
---|
195 | % |
---|
196 | % - fplod 20100604T083004Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
197 | % |
---|
198 | % * add usage of varamma_startup : no more chemin parameter, VARAMMA_ID value |
---|
199 | % used instead |
---|
200 | % |
---|
201 | % - fplod 20100526T122950Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
202 | % |
---|
203 | % * fix error: octcdf: indexes must be contiguous |
---|
204 | % |
---|
205 | % - fplod 20100525T143201Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
206 | % |
---|
207 | % * rename to hovmullerlat.m to avoid message like :: |
---|
208 | % |
---|
209 | % warning: function name \`hovmullerlat\' does not agree with function file name \`/.autofs/home/fplod/incas/varamma/varamma_ws/src/hovmuller.m\' |
---|
210 | % |
---|
211 | % * add example (not ok) |
---|
212 | % |
---|
213 | % - fplod 20100521T150917Z aedon.locean-ipsl.upmc.fr (Darwin) |
---|
214 | % |
---|
215 | % * minimal header |
---|
216 | % |
---|
217 | % - lelod 20100521 |
---|
218 | % |
---|
219 | % * creation |
---|
220 | %- |
---|
221 | global application; |
---|
222 | global application_version; |
---|
223 | global netcdf_open_available |
---|
224 | global PROJECT_ID; |
---|
225 | % |
---|
226 | arg_info=whos('dataset'); |
---|
227 | if ~strcmp(arg_info.class,'char') |
---|
228 | disp(['Incorrect type of arg dataset ' arg_info.class]); |
---|
229 | whos dataset |
---|
230 | error(usage); |
---|
231 | end |
---|
232 | clear arg_info |
---|
233 | % |
---|
234 | switch dataset |
---|
235 | case {'EPSAT'} |
---|
236 | case {'MSG'} |
---|
237 | case {'TRMM'} |
---|
238 | otherwise |
---|
239 | error(['eee : unknown dataset ' dataset]) |
---|
240 | end |
---|
241 | % |
---|
242 | arg_info=whos('yyyymmddb'); |
---|
243 | if ~strcmp(arg_info.class,'double') |
---|
244 | disp(['Incorrect type of arg yyyymmddb ' arg_info.class]); |
---|
245 | whos yyyymmddb |
---|
246 | error(usage); |
---|
247 | end |
---|
248 | clear arg_info |
---|
249 | % |
---|
250 | arg_info=whos('yyyymmdde'); |
---|
251 | if ~strcmp(arg_info.class,'double') |
---|
252 | disp(['Incorrect type of arg yyyymmdde ' arg_info.class]); |
---|
253 | whos yyyymmddb |
---|
254 | error(usage); |
---|
255 | end |
---|
256 | clear arg_info |
---|
257 | % |
---|
258 | datenum_current=datenum(num2str(yyyymmddb,'%8.8d'),'yyyymmdd'); |
---|
259 | datenum_end=datenum(num2str(yyyymmdde,'%8.8d'),'yyyymmdd'); |
---|
260 | addtodate_f='day'; |
---|
261 | addtodate_q=1; |
---|
262 | nb_fich_max=999; |
---|
263 | % ++ don't to how to initialze because of cariable lengtgh according to PROJECT_ID value |
---|
264 | % ++ficlist=repmat('z',nb_fich_max,1); |
---|
265 | %++whos ficlist |
---|
266 | yyyy_slist=repmat('9999',nb_fich_max,1); |
---|
267 | mm_slist=repmat('99',nb_fich_max,1); |
---|
268 | dd_slist=repmat('99',nb_fich_max,1); |
---|
269 | ifich=0; |
---|
270 | % liste des fichiers sur période choisie |
---|
271 | while datenum_current < datenum_end |
---|
272 | disp(['iii : looking for ', datestr(datenum_current,'yyyymmdd')]); |
---|
273 | yyyy_s=datestr(datenum_current,'yyyy'); |
---|
274 | mm_s=datestr(datenum_current,'mm'); |
---|
275 | dd_s=datestr(datenum_current,'dd'); |
---|
276 | switch dataset |
---|
277 | case {'EPSAT'} |
---|
278 | filename=['surf-rr_epsat-sg_multi-sat_010d_30min_' yyyy_s mm_s dd_s '_v3.1-02c.nc']; |
---|
279 | fullfilename=[PROJECT_ID 'EPSAT/' yyyy_s '/' mm_s '/' filename]; |
---|
280 | case {'MSG'} |
---|
281 | filename=['msg-tb108_' yyyy_s '-' mm_s '-' dd_s '_15min.nc']; |
---|
282 | fullfilename=[PROJECT_ID 'MSG/' yyyy_s '/' mm_s '/' filename]; |
---|
283 | case {'TRMM'} |
---|
284 | trmm_version='5'; |
---|
285 | filename=['3B40RT.' yyyy_s mm_s dd_s '.' trmm_version '.nc']; |
---|
286 | fullfilename=[PROJECT_ID 'TRMM/' '3B40/' yyyy_s '/' mm_s '/' filename]; |
---|
287 | otherwise |
---|
288 | error(['eee : unknown dataset ' dataset]) |
---|
289 | end |
---|
290 | if (exist(fullfilename)) |
---|
291 | ifich=ifich+1; |
---|
292 | ficlist(ifich,:)=fullfilename; |
---|
293 | yyyy_slist(ifich,:)=yyyy_s; |
---|
294 | mm_slist(ifich,:)=mm_s; |
---|
295 | dd_slist(ifich,:)=dd_s; |
---|
296 | disp(['iii : data found in ', fullfilename]); |
---|
297 | else |
---|
298 | disp(['iii : no fullfilename ', fullfilename]); |
---|
299 | end |
---|
300 | % next step |
---|
301 | datenum_current=addtodate(datenum_current,addtodate_q, addtodate_f); |
---|
302 | clear yyyy_s |
---|
303 | clear mm_s |
---|
304 | clear dd_s |
---|
305 | clear filename |
---|
306 | clear fullfilename |
---|
307 | end |
---|
308 | clear datenum_current |
---|
309 | clear datenum_end |
---|
310 | % |
---|
311 | % test if at least one file |
---|
312 | nbfic=ifich; |
---|
313 | if (nbfic == 0) |
---|
314 | error(['eee : no files found during [' num2str(yyyymmddb,'%6.6d') ',' num2str(yyyymmdde,'%6.6d') '[']); |
---|
315 | end |
---|
316 | |
---|
317 | timeconcatene=[]; |
---|
318 | dataconcatenees=[]; |
---|
319 | % |
---|
320 | lonmax=lon; |
---|
321 | lonmin=lon; |
---|
322 | % |
---|
323 | for ijour=1:nbfic |
---|
324 | switch dataset |
---|
325 | case {'EPSAT'} |
---|
326 | lonmax=lon+0.1; |
---|
327 | lonmin=lon; |
---|
328 | disp(['www : lonmin and lonmax forced to ', num2str(lonmin) ' ' num2str(lonmax)]) |
---|
329 | [data, my_time, longitude, latitude, yyyy_s, mm_s, dd_s] = EPSATread(yyyy_slist(ijour,:), mm_slist(ijour,:), dd_slist(ijour,:),lonmin, lonmax, latmin, latmax); |
---|
330 | %++ pour debug en attandat extarnalisation de EPSATread mais pas ok |
---|
331 | % index_simulation=int8(2); |
---|
332 | %[longitude, latitude, my_time, datestr_value, data] = simul_epsat(index_simulation); |
---|
333 | case {'MSG'} |
---|
334 | [data, my_time, longitude, latitude, yyyy_s, mm_s, dd_s] = MSGread(yyyy_slist(ijour,:), mm_slist(ijour,:), dd_slist(ijour,:),lonmin, lonmax, latmin, latmax); |
---|
335 | %++ pour debug en attandat extarnalisation de MSGread mais pas ok |
---|
336 | % index_simulation=int8(3); |
---|
337 | % [longitude, latitude, my_time, datestr_value, data] = simul_msg(index_simulation); |
---|
338 | case {'TRMM'} |
---|
339 | lonmax=lon+0.2; |
---|
340 | lonmin=lon; |
---|
341 | disp(['www : lonmin and lonmax forced to ', num2str(lonmin) ' ' num2str(lonmax)]) |
---|
342 | [data, my_time, longitude, latitude, yyyy_s, mm_s, dd_s] = TRMMread(yyyy_slist(ijour,:), mm_slist(ijour,:), dd_slist(ijour,:),lonmin, lonmax, latmin, latmax); |
---|
343 | otherwise |
---|
344 | error(['eee : unknown dataset ' dataset]) |
---|
345 | end |
---|
346 | dataconcatenees=[dataconcatenees; data]; |
---|
347 | timeconcatene=[timeconcatene; my_time]; |
---|
348 | end |
---|
349 | |
---|
350 | switch dataset |
---|
351 | case {'EPSAT'} |
---|
352 | case {'MSG'} |
---|
353 | dataconcatenees(find(dataconcatenees == 655.35))=NaN; |
---|
354 | case {'TRMM'} |
---|
355 | otherwise |
---|
356 | error(['eee : unknown dataset ' dataset]) |
---|
357 | end |
---|
358 | [t,lat]=meshgrid(timeconcatene,latitude); |
---|
359 | my_image=permute(dataconcatenees,[3 1 2]); |
---|
360 | switch application |
---|
361 | case {'matlab'} |
---|
362 | imagesc(timeconcatene,latitude,my_image); |
---|
363 | case {'octave'} |
---|
364 | imagesc(t,lat,my_image); |
---|
365 | otherwise |
---|
366 | error('unknown application running'); |
---|
367 | end |
---|
368 | shading flat; |
---|
369 | xlabel('time'); |
---|
370 | ylabel('latitude'); |
---|
371 | xlim([min(timeconcatene) max(timeconcatene)]) |
---|
372 | set(gca,'Ydir','reverse') |
---|
373 | switch application |
---|
374 | case {'matlab'} |
---|
375 | datetick('x',6); |
---|
376 | case {'octave'} |
---|
377 | switch application_version |
---|
378 | case {'3.0.2'} |
---|
379 | disp(['no datetick available using ', application , application_version]); |
---|
380 | case {'3.4.0'} |
---|
381 | datetick('x',6); |
---|
382 | otherwise |
---|
383 | error(['unknown application version running ', application , application_version]); |
---|
384 | end |
---|
385 | otherwise |
---|
386 | error('unknown application running'); |
---|
387 | end |
---|
388 | colorbar('SouthOutside'); |
---|
389 | |
---|
390 | end |
---|
391 | |
---|
392 | %!demo |
---|
393 | %! % To plot an hovmüller diagram of EPSAT between 20060801 and 20060802:: |
---|
394 | %! clear all |
---|
395 | %! close all |
---|
396 | %! varamma_startup |
---|
397 | %! more off |
---|
398 | %! dataset='EPSAT'; |
---|
399 | %! lon=-15; |
---|
400 | %! latmin=10; |
---|
401 | %! latmax=15; |
---|
402 | %! yyyymmddb=20060801; |
---|
403 | %! yyyymmdde=20060802; |
---|
404 | %! [t,lat,dataconcatenees]=hovmullerlat(dataset,yyyymmddb,yyyymmdde,lon,latmin,latmax); |
---|
405 | |
---|
406 | %!demo |
---|
407 | %! % To plot an hovmüller diagram of MSG between 20060801 and 20060802:: |
---|
408 | %! clear all |
---|
409 | %! close all |
---|
410 | %! varamma_startup |
---|
411 | %! more off |
---|
412 | %! dataset='MSG'; |
---|
413 | %! lon=-15; |
---|
414 | %! latmin=10; |
---|
415 | %! latmax=15; |
---|
416 | %! yyyymmddb=20060801; |
---|
417 | %! yyyymmdde=20060802; |
---|
418 | %! [t,lat,dataconcatenees]=hovmullerlat(dataset,yyyymmddb,yyyymmdde,lon,latmin,latmax); |
---|
419 | |
---|
420 | %!demo |
---|
421 | %! % To plot an hovmüller diagram of TRMM between 20060801 and 20060802:: |
---|
422 | %! clear all |
---|
423 | %! close all |
---|
424 | %! varamma_startup |
---|
425 | %! more off |
---|
426 | %! dataset='TRMM'; |
---|
427 | %! lon=-15; |
---|
428 | %! latmin=10; |
---|
429 | %! latmax=15; |
---|
430 | %! yyyymmddb=20060801; |
---|
431 | %! yyyymmdde=20060802; |
---|
432 | %! [t,lat,dataconcatenees]=hovmullerlat(dataset,yyyymmddb,yyyymmdde,lon,latmin,latmax); |
---|