La présentation est en train de télécharger. S'il vous plaît, attendez

La présentation est en train de télécharger. S'il vous plaît, attendez

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

Présentations similaires


Présentation au sujet: "Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%"— Transcription de la présentation:

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 %version 0.6: spi, xxxx 2007, version pour faire une sortie graphique speciale pour alain (cette version n'est pas la plus recente) %version 0.5: spi, aout 2007, implantation sousfonction figure_surface_callback(), support callback WindowButtonDownFcn %version 0.4: spi, aout 2007, affiche_carte(chemin,nomfichier,naffiche,ndemimoniteur) %version 0.3: spi, aout 2007, affiche_carte(chemin,nomfichier,naffiche) %version 0.2: spi, juin 2007, affiche_carte(chemin,nomfichier)/autodimformat(directory,nomf ichier) %version 0.1: spi, juin 2007, affiche_carte(chemin,nomfichier) %version 0.0: spi, fonction qui permet d'afficher les donnees brutes %version 0.0, 20yymmmdd, spi, initial function draft % %nakedsoftware.org opensource license, copyright 2010 stephane.poirier@oifii.org

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

6

7 function affiche_carte_alain(chemin,nomfichier,naffiche,ndemimoniteur) if nargin<1 disp('usage: affiche_carte_alain(''chemin'',''nomfichier'',naffiche=- 1,ndemimoniteur=-1)'); return; end %heures = [' 0h00';' 6h00';'12h00';'18h00']; %heures des estimes de temperature du modele era40 heures = [' 0h00';' 3h00';' 6h00';' 9h00';'12h00';'15h00';'18h00';'21h00']; %heures des estimes de temperature du modele narr heure = cellstr(heures); %validation if(nargin<4) ndemimoniteur=-1; end %ndemimoniteur=-1 if(nargin<3) naffiche=-1; end %naffiche=-1 pour afficher toutes les couches, 0<naffiche<1 pour afficher une fraction des couches, naffiche entier pour afficher une couche en particulier if(nargin<2) if findstr(chemin,'snowcover') nomfichier='001'; %les valeures sont alors les bytes d'un masque de couverture de neige end if ~isempty(strfind(lower(chemin),'160x240')) || ~isempty(strfind(lower(chemin),'canada')) region='canada'; cote=mask(1,2); elseif strfind(lower(chemin),'russie') region='russie'; disp('case not supported yet'); return; elseif strfind(lower(chemin),'tibet') region='tibet'; disp('case not supported yet'); return; elseif ~isempty(strfind(lower(chemin),'721x721')) || ~isempty(strfind(lower(chemin),'nsidc')) region='721x721'; disp('warning, detected ''nsidc'' in the path, assuming 721x721 nsidc easegrid north data, case partially supported'); else disp('case not supported yet'); return; end %format, dim1 et dim2 sont a identifier [d1 d2 f] = autodimformat(chemin,nomfichier); dim = [d1 d2]; format = f; %positionnement figure par default deffigpos=get(0,'DefaultFigurePosition'); x0=deffigpos(1); y0=deffigpos(2); width0=deffigpos(3); height0=deffigpos(4); if ndemimoniteur==-1 %positionnement figure sur la premiere moitie de l'ecran primaire (pour spi, 1280x768) set(0,'DefaultFigurePosition',[(1280-2*width0)/3 height0+(768-height0)/2 width0 height0]); elseif ndemimoniteur>0 && ndemimoniteur<5 %support d'un moniteur secondaire disp('allumer second moniteur'); moniteursmultiple=get(0,'MonitorPosition'); moniteurprimaire=moniteursmultiple(1,:); %moniteur primaire (pour spi, 1 1 1280 768) moniteursecondaire=moniteursmultiple(2,:); %moniteur secondaire (pour spi, -1023 1 0 768) x1=moniteursmultiple(2,1)+abs(moniteursmultiple(2,3)- moniteursmultiple(2,1)-2*width0)/3; %cote gauche fenetre lorsque place dans premiere moitie du premier moniteur (pour spi, moniteur secondaire) y1=height0+(moniteursmultiple(2,4)-height0)/2; %cote bas fenetre lorsque place dans premiere moitie du premier moniteur (pour spi, moniteur secondaire) width1=width0; %largeur fenetre height1=height0; %hauteur fenetre %x2=moniteursmultiple(2,1)+2*(moniteursmultiple(2,3)- moniteursmultiple(2,1)-2*width0)/3; %cote gauche fenetre lorsque place dans seconde moitie du premier moniteur (pour spi, moniteur secondaire) x2=moniteursmultiple(2,1)+width0+2*abs(moniteursmultiple(2,3) -moniteursmultiple(2,1)-2*width0)/3; %cote gauche fenetre lorsque place dans seconde moitie du premier moniteur (pour spi, moniteur secondaire) y2=height0+(moniteursmultiple(2,4)-height0)/2; %cote bas fenetre lorsque place dans seconde moitie du premier moniteur (pour spi, moniteur secondaire) width2=width0; %largeur fenetre height2=height0; %hauteur fenetre x3=moniteursmultiple(1,1)+(moniteursmultiple(1,3)- 2*width0)/3; %cote gauche fenetre lorsque place dans premiere moitie du deuxieme moniteur (pour spi, moniteur primaire) y3=height0+(moniteursmultiple(1,4)-height0)/2; %cote bas fenetre lorsque place dans premiere moitie du deuxieme moniteur (pour spi, moniteur primaire) width3=width0; %largeur fenetre height3=height0; %hauteur fenetre x4=moniteursmultiple(1,1)+width0+2*(moniteursmultiple(1,3)- 2*width0)/3; %cote gauche fenetre lorsque place dans seconde moitie du deuxieme moniteur (pour spi, moniteur primaire) y4=height0+(moniteursmultiple(1,4)-height0)/2; %cote bas fenetre lorsque place dans seconde moitie du deuxieme moniteur (pour spi, moniteur primaire) width4=width0; %largeur fenetre height4=height0; %hauteur fenetre if ndemimoniteur==1 set(0,'DefaultFigurePosition',[x1 y1 width1 height1]); elseif ndemimoniteur==2 set(0,'DefaultFigurePosition',[x2 y2 width2 height2]); elseif ndemimoniteur==3 set(0,'DefaultFigurePosition',[x3 y3 width3 height3]); elseif ndemimoniteur==4 set(0,'DefaultFigurePosition',[x4 y4 width4 height4]); end else disp('ndemimoniteur non valide'); return; end %combiner chemin et nomfichier %if(~strcmp(chemin(end),filesep)) chemin = [chemin, filesep]; cheminnomfichier=[chemin,nomfichier]; end cheminnomfichier=fullfile(chemin,nomfichier); fid=fopen(cheminnomfichier, 'r'); if(fid~=-1) matrice=fread(fid,[1 inf],format); %fread(fid,[dim(1,1) dim(1,2)],format); fclose(fid); end 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 n = str2num(strtok(format, '*')); if(dim(1,1)~=0 && dim(1,2)~=0) matrice=reshape(matrice,dim(1,1),dim(1,2),n); end %valider naffiche if naffiche~=-1 if naffiche==0 warning('case not supported'); end if naffiche 0 if naffiche~=0.5 && naffiche~=0.25 && naffiche~=0.125 warning('case not supported'); end end if naffiche>=1 if naffiche>n warning('naffiche cannot be greater than the number of layers'); end end %afficher n figures for i=1:n %filtrer avec naffiche (aucun filtrage si naffiche=- 1) if naffiche>=1 && naffiche~=i continue; end %skips all layers but the one selected with naffiche if naffiche 0 if mod(i-1,1/naffiche)~=0 continue; end end % Create nth figure and specify a callback figure('WindowButtonDownFcn',{@figure_surface_callback,region,chemin,nomfichier,i},... %{} because adding chemin,nomfichier 'KeyPressFcn',{@figure_keypress_callback,chemin,nomfichier}); cmap=colormap; if(d1==160 && d2==240) imagesc(rot90(matrice(:,:,i)')); colorbar; hold on; contour(rot90(cote'),1,'k'); elseif (d1==721 && d2==721) imagesc(matrice(:,:,i)); colorbar; else warning('case not supported'); end if(n==4) title(strcat(cheminnomfichier,' : ',heure(2*i-1)), 'Interpreter','none', 'Color','b'); elseif(n==8) title(strcat(cheminnomfichier,' : ',heure(i)), 'Interpreter','none', 'Color','b'); elseif(n==24) hrs_str = sprintf('%2d',i-1); title(strcat(cheminnomfichier,' : ',hrs_str,'h00'), 'Interpreter','none', 'Color','b'); else warning('case not supported'); end end else %display one figure %create one figure and specify a callback i=-1; %one figure only figure('WindowButtonDownFcn',{@figure_surface_callback,region,chemin,nomfichier,i},... %{} because adding chemin,nomfichier 'KeyPressFcn',{@figure_keypress_callback,chemin,nomfichier}); %caxis([cmin cmax]); %color axis scaling, for future implementation cmap = colormap; if(dim(1,1)~=0 && dim(1,2)~=0) matrice=reshape(matrice,dim(1,1),dim(1,2)); matrice=matrice./10; indiceszero=find(matrice==0); indicesdiff=find(matrice~=0); matrice(indiceszero)=matrice(indiceszero)-150.00; matrice(indicesdiff)=matrice(indicesdiff)-273.16; if (d1==160 && d2==240) imagesc(rot90(matrice')); colorbar; hold on; contour(rot90(cote'),1,'k'); %contour(rot90(cote'),1,'k'); elseif (d1==721 && d2==721) imagesc(matrice); colorbar; else warning('case not supported'); end end title(cheminnomfichier, 'Interpreter','none', 'Color','b'); end clear fid nomfichier matrice; if nargin==1 && findstr(chemin,'snowcover') hold on; for i=2:366 pause(0.05); nomfichier = sprintf('%03d',i); fid=fopen([chemin nomfichier], 'r'); if(fid~=-1) if(dim(1,1)~=0 && dim(1,2)~=0) matrice=fread(fid,[dim(1,1) dim(1,2)],format); fclose(fid); if (d1==160 && d2==240) imagesc(rot90(matrice')); elseif (d1==721 && d2==721) imagesc(matrice); else warning('case not supported'); end end title(nomfichier, 'Interpreter','none', 'Color','b'); drawnow; clear fid nomfichier matrice; end %sortie set(0,'DefaultFigurePosition',[x0 y0 width0 height0]); fclose('all'); clear all; end %fonction % Callback subfunction defines two input arguments function figure_surface_callback(src,eventdata,region,chemin,nomfichie r,i) v = get(gca,'CurrentPoint') %; x_pixel=v(1,1); y_pixel=v(1,2); string=autodatavalue(x_pixel,y_pixel,region,chemin,nomfichier,i); disp(string); [x_pix y_pix]=pixel2pix(x_pixel,y_pixel,region); [alon, alat]=pix2latlon(x_pix,y_pix); %upperleft upperright bottomright bottomleft string = sprintf('longitude: %f',alon(1,1)); disp(string); string = sprintf('latitude: %f',alat(1,1)); disp(string); end function figure_keypress_callback(src,evnt,chemin,nomfichier) if evnt.Key=='downarrow' || evnt.Key=='rightarrow' %fichiers=dir(fullfile(chemin,'TS_D*')); elseif evnt.Key=='uparrow' || evnt.Key=='leftarrow' end %{ if evnt.Character == 'e' print ('-deps',['-f' num2str(src)]) elseif length(evnt.Modifier) == 1 & strcmp(evnt.Modifier{:}, 'control') & evnt.Key == 't' print ('-dtiff','-r200',['-f' num2str(src)]) end %} end %function


Télécharger ppt "Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%"

Présentations similaires


Annonces Google