Presentation is loading. Please wait.

Presentation is loading. Please wait.

Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%

Similar presentations


Presentation on theme: "Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%"— Presentation transcript:

1 Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%

2

3

4 %nakedsoftware.org opensource license, copyright 2010 stephane.poirier@oifii.org % %developed by Stephane Poirier, M.Sc. Optical Physics, Remote Sensing Application Software Developer (1991-2010) % %this function is part of oifii.org's ar\sp\ Microwave- derived 30-year Canada-Alaska Daily Temperature and Snowcover Databases library % %this function is part of oifii.org's ar\sp\'this folder' application (lauched with ar\sp\'this file'.m) %oifii.org's ar\sp\affiche_carte application is part of the oifii.org's ar\sp set of applications which %may also contain similar variant versions of this function with identical filename. % %A geophysical research paper about this work has been submitted in June 2009 for publication in JGR-Atmosphere %Royer, A. and Poirier S., Surface temperature spatial and temporal variations in North America from homogenized %satellite SMMR-SSM/I microwave measurements and reanalysis for 1979-2008, Journal of Geophysical Research - Atmosphere, %Submitted June 2009, http://www.oifii.org/tsatdb/Royer- Poirier_Microwave-derived-daily-surface- temperature_JGR2009JD012760_R2.pdf % %This study's database can be downloaded from the author web site at: %http://www.oifii.org/tsatdb/Royer-Poirier_Microwave-derived- daily-surface-temperature-db_1979-2008.zip % %this function is used to display the raw microwave raster data (NSIDC's SMMR and SSMI satellite, ref. nsidc.org) % %usage: % 20yymmmdd % %version 0.0, 20yymmmdd, spi, initial function draft % %nakedsoftware.org opensource license, copyright 2010 stephane.poirier@oifii.org

5 %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%

6

7 %version 0.5 modifications apportees par sp, 20 avril 2009, fix for various temperature maps, hold off was inserted in line 151 and could maybe be displaced on line 148 %version 0.4 modifications apportees par sp, 30 juin 2008, fix for the gradual slow down problem, hold off had to be added %version 0.3 modifications apportees par sp, 30 juin 2008, multiple codecs support %version 0.2 modifications apportees par sp, 30 juin 2008, fix for colorbar display, colorbar must not be displayed after drawing contour cote %version 0.1 modifications apportees par sp, 29 avril 2008, contour cote function genere_avi(dossierentree,dossiersortie,fichiersortie,filtreno mfichier,codecs); %heures=[' 0h00';' 6h00';'12h00';'18h00']; %heures des estimes de temperature du modele era40, voir aussi strvcat(' 0h00',' 6h00','12h00','18h00') heures=[' 0h00';' 3h00';' 6h00';' 9h00';'12h00';'15h00';'18h00';'21h00']; %heures des estimes de temperature du modele narr heure=cellstr(heures); prevdir=pwd; chdir(dossierentree); if(nargin<5) codecs=''; end %i.e. codecs='', codecs='Indeo5', codecs='Cinepak', codecs={'Indeo5';'Cinepak'}' if(nargin<4) filtrenomfichier='*.*'; end if(nargin<3) fichiersortie='test.avi'; end if(nargin<2) dossiersortie=dossierentree; end if(nargin<1) display('genere_avi(''dossierentree'',''dossiersortie'',''tes t.avi'',''*.*'')'); end h=figure; [sizechar nchar]=size(dossierentree); if(~strcmp(dossierentree(nchar),filesep)) %si chemin ne se termine pas par filesep, l'ajouter dossierentree=[dossierentree,filesep]; end [sizechar nchar]=size(dossiersortie); if(~strcmp(dossiersortie(nchar),filesep)) %si chemin ne se termine pas par filesep, l'ajouter dossiersortie=[dossiersortie,filesep]; end %update/create the avi file to be built if(exist([dossiersortie fichiersortie])) delete([dossiersortie fichiersortie]); end if(isempty(codecs)) aviobjs{1,1}=avifile([dossiersortie,fichiersortie]); elseif(~iscell(codecs)) aviobjs{1,1}=avifile([dossiersortie,fichiersortie],'compressi on',codecs); else for ic=1:numel(codecs) aviobjs{1,ic}=avifile([dossiersortie,fichiersortie,'_codec- ',codecs{1,ic},'.avi'],'compression',codecs{1,ic}); end fichiers=dir(fullfile(dossierentree,filtrenomfichier)); [nombredefichiers,nombredestructureparfichier]=size(fichiers) ; % assuming any number of subfolders could be present %sp, 29 avril 2008, begin cote=mask(1,2); firsttimeflag=-1; profile_on_count=-1; %sp, 29 avril 2008, end for n=1:nombredefichiers if ~(fichiers(n).isdir) %if the nth file is not a folder if~(strcmp(fichiers(n).name,fichiersortie)) %since this function creates a new file (possibly in the input directory) if isempty(strfind(fichiers(n).name,'.avi'))... %if the nth file is not an.avi file && isempty(strfind(fichiers(n).name,'.txt')) %if the nth file is not an.txt file nomfichier=fichiers(n).name; %sp, 29 avril 2008, begin if(firsttimeflag==-1) firsttimeflag=1; %{ %turn profiler on profile on; profile_on_count=0; %} end if(profile_on_count>- 1)profile_on_count=profile_on_count+1;end %sp, 29 avril 2008, end fid=fopen([dossierentree nomfichier],'r'); [dim1 dim2 format]=autodimformat(dossierentree,nomfichier); carte=fread(fid,[1 inf],format); fclose(fid); if ~isempty(strfind(format, '*')) %i.e. if format=='4*float32', get the standard format multiplyfing factor, in the herein example that would be the 4 nn=str2num(strtok(format, '*')); carte=reshape(carte,dim1,dim2,nn); for i=1:nn if(dim1==160 && dim2==240) %sp, 20 avril 2009, begin if(~isempty(strfind(dossierentree,'ts- norm\'))||~isempty(strfind(dossierentree,'ts-norm-narr\'))) cartei=carte(:,:,i); indiceszero=find(cartei==0); indicesnotzero=find(cartei~=0); cartei(indiceszero)=NaN; cartei(indicesnotzero)=cartei(indicesnotzero)-273.16; %display image imagesc(rot90(cartei')); hold on; axis off; %define color axis cmap=colormap; caxis manual; caxis([-50 +50]); %display colorbar if(i==1) colorbar; end %display contour contour(rot90(cote'),1,'k'); %contour(rot90(cote'),1,'k'); %sp, 20 avril 2009, end %sp, 29 avril 2008, begin elseif(~isempty(strfind(dossierentree,'\era40'))||~isempty(st rfind(dossierentree,'\narr'))) carte(:,:,i)=carte(:,:,i)- 273.16; %display image imagesc(rot90(carte(:,:,i)')); hold on; %define color axis cmap=colormap; caxis manual; caxis([-50 +50]); %display colorbar %sp, 20 avril 2009, begin %colorbar; if(i==1) colorbar; end %sp, 20 avril 2009, end %display contour contour(rot90(cote'),1,'k'); %contour(rot90(cote'),1,'k'); elseif(~isempty(strfind(dossierentree,'snowcover'))) %display image imagesc(rot90(carte(:,:,i)')); hold on; axis off; %define and edit colormap cmap=colormap(hsv(3)); cmap(1,:)=([0.0 0.0 1.0]); cmap(2,:)=([0.5 0.0 0.0]); cmap(3,:)=([1.0 1.0 1.0]); colormap(cmap); %define color axis caxis manual; caxis([-1 +1]); %display colorbar %colorbar; %display contour contour(rot90(cote'),1,'k'); %contour(rot90(cote'),1,'k'); else display('genere_avi,n*float32: case not supported'); return; end %sp, 29 avril 2008, end else imagesc(carte(:,:,i)); end if(nn==4) title([nomfichier,' - ',heure(i*2-1)],'Interpreter','none','Color','b'); elseif(nn==8) title([nomfichier,' - ',heure(i)],'Interpreter','none','Color','b'); else warning('case not supported'); end frame=getframe(gcf); for ic=1:numel(aviobjs) aviobjs{1,ic}=addframe(aviobjs{1,ic},frame); end clear frame; end %sp, 20 avril 2009, begin hold off; %sp, 20 avril 2009, end else indiceszero=find(carte==0); indicesnegative=find(carte<0); indicespositive=find(carte>0); carte=reshape(carte,dim1,dim2); if(dim1==160 && dim2==240) %sp, 20 avril 2009, begin if(~isempty(strfind(dossierentree,'ts\'))) %already in celcius degree indicesnegative=find(carte==- 100); indicespositive=find(carte==100); carte(indicespositive)=NaN; carte(indicesnegative)=NaN; %display image imagesc(rot90(carte')); hold on; %define color axis cmap=colormap; caxis manual; caxis([-50 +50]); %display colorbar colorbar; %display contour contour(rot90(cote'),1,'k'); %sp, 20 avril 2009, end %sp, 29 avril 2008, begin elseif(~isempty(strfind(dossierentree,'ts- '))||~isempty(strfind(dossierentree,'tsat'))) carte(indicespositive)=carte(indicespositive)-273.16; carte(indicesnegative)=NaN; carte(indiceszero)=NaN; %display image imagesc(rot90(carte')); hold on; %define color axis cmap=colormap; caxis manual; caxis([-50 +50]); %display colorbar colorbar; %display contour contour(rot90(cote'),1,'k'); elseif(~isempty(strfind(dossierentree,'\era40'))||~isempty(st rfind(dossierentree,'\narr'))) carte=carte-273.16; %display image imagesc(rot90(carte')); hold on; %define color axis cmap=colormap; caxis manual; caxis([-50 +50]); %display colorbar colorbar; %display contour contour(rot90(cote'),1,'k'); elseif(~isempty(strfind(dossierentree,'snowcover'))) %display image imagesc(rot90(carte')); hold on; axis off; %define and edit colormap cmap=colormap(hsv(3)); cmap(1,:)=([0.0 0.0 1.0]); cmap(2,:)=([0.5 0.0 0.0]); cmap(3,:)=([1.0 1.0 1.0]); colormap(cmap); %define color axis caxis manual; caxis([-1 +1]); %display colorbar %colorbar; %display contour contour(rot90(cote'),1,'k'); %spi, 14 avril 2009, begin elseif(~isempty(strfind(dossierentree,'ssmi\160x240'))||~isem pty(strfind(dossierentree,'smmr\160x240'))) imagesc(rot90(carte')); hold on; contour(rot90(cote'),1,'k'); %spi, 14 avril 2009, end else display('genere_avi: case not supported'); return; end %sp, 29 avril 2008, end else imagesc(carte(:,:,i)); end %display figure title if(~isempty(strfind(dossierentree,'snowcover'))||~isempty(str find(dossierentree,'tsat'))) year_str=yearfrompath(dossierentree); nomfichier=[datejj(str2num(nomfichier),str2num(year_str)),' ',year_str]; end title(nomfichier,'Interpreter','none','Color','b'); frame=getframe(gcf); %gradually slows down as the current figure is updated for ic=1:numel(aviobjs) aviobjs{1,ic}=addframe(aviobjs{1,ic},frame); end clear frame; end %sp, 30 juin 2008, begin hold off; %sp, 30 juin 2008, end clear fid nomfichier carte; if((profile_on_count>- 1)&&(profile_on_count==20)) profile off; profile viewer; display(['profiled ',num2str(profile_on_count),' loop: exiting safely']); for ic=1:numel(aviobjs) aviobjs{1,ic}=close(aviobjs{1,ic}); end close(h); chdir(prevdir); clear all; return; end for ic=1:numel(aviobjs) aviobjs{1,ic}=close(aviobjs{1,ic}); end close(h); chdir(prevdir); clear all;


Download ppt "Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%"

Similar presentations


Ads by Google