Presentation is loading. Please wait.

Presentation is loading. Please wait.

Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%% validation section initialization section navigation section.

Similar presentations


Presentation on theme: "Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%% validation section initialization section navigation section."— Presentation transcript:

1 Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%% validation section initialization section navigation section

2 %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%

3

4 %nakedsoftware.org opensource license, copyright 2010 % %developed by Stephane Poirier, M.Sc. Optical Physics, Remote Sensing Application Software Developer ( ) % %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\affiche_carte application (lauched with ar\sp\affiche_carte.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 , Journal of Geophysical Research - Atmosphere, %Submitted June 2009, 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_ zip % %this function is used by affiche_carte.m to automaticaly identify format of the raw microwave raster data (for NSIDC's SMMR and SSMI %satellite data, ref. as well as the derived data products, intermediate analysis matrices and final paper results % %fonction enabling to navigate in the folders/filename tree %fonction qui permet de naviguer dans l'arbre des dossiers/nomfichiers % %version 3.2, 2009dec16, spi, with jdjf and moyecarttype datasets, should not switch year on arrow key left or right and should update display on arrow key up or down %version 3.1: 2009dec16, spi, prevent navigation to inexisting filename and/or folder, return safely with output same as input %version 3.0: 2009dec15, spi, yearmax=2008 %version 0.1: 2007junXX, spi, [cheminsortie,fichiersortie]=navigue_dossier(cheminentree,fic hierentree,direction) % %nakedsoftware.org opensource license, copyright 2010

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

6 function [cheminsortie,fichiersortie]=navigue_dossier(cheminentree,fic hierentree,direction)

7 validation section

8 if(nargin<3) direction='down'; end %direction='down' if(nargin<2) fichierentree=''; end if nargin<1 disp('usage: navigue_dossier(''cheminentree'',''nomfichierentree'',''direc tion=down'')'); return; end

9 initialization section

10 cheminsortie=cheminentree; fichiersortie=fichierentree; cheminentree_name_prev=''; yearmax=2008;

11 navigation section

12

13 fichiers=dir(cheminentree); %fullfile(cheminentree,fichierentree) [nombredefichiers,nn]=size(fichiers); if(strcmp(fichierentree,'')==0) %fichierentree est specifie indicefichier=-1; for i=3:nombredefichiers if strcmp(fichiers(i).name,fichierentree)==1 indicefichier=i; break; end end if indicefichier==-1 return; end %{ indicefichier=strfind(fichiers,fichierentree); indicefichier=strmatch(fichierentree,fichiers,'exact'); %} %{ if isdir(fichiers(indice)) %fichierentree est un dossier else %fichierentree n'est pas un dossier end %} if strcmp(lower(direction),'up')==1 %remonte dans la liste de fichiers, i.e. jj-1 ou pentade-1 cheminsortie=cheminentree; if(indicefichier-1)<3 %2009dec16, spi, begin cheminsortie=cheminentree; fichiersortie=fichierentree; %2009dec16, spi, begin return; end fichiersortie=fichiers(indicefichier-1).name; elseif strcmp(lower(direction),'down')==1 %descend dans la liste de fichiers, i.e. jj+1 ou pentade+1 cheminsortie=cheminentree; if(indicefichier+1)>nombredefichiers %2009dec16, spi, begin cheminsortie=cheminentree; fichiersortie=fichierentree; %2009dec16, spi, begin return; end fichiersortie=fichiers(indicefichier+1).name; elseif strcmp(lower(direction),'left')==1 || strcmp(lower(direction),'right')==1 %2009dec16, spi, with jdjf and moyecarttype datasets, should not switch year on arrow key left or right and should update display on arrow key up or down, begin %disable year switch response for left or right arrow key hit if(~isempty(findstr(cheminentree,'jdjf'))||(~isempty(findstr( cheminentree,'moyecarttype')))) cheminsortie=cheminentree; fichiersortie=fichierentree; disp('navigue_dossier: folder to folder switching disabled, use arrow up or down for year to year switching'); return; end %2009dec16, spi, with jdjf and moyecarttype datasets, should not switch year on arrow key left or right and should update display on arrow key up or down, end %remonter ou descendre dans l'arbre de dossiers, i.e. an-1 (left) ou an+1 (right) %1) en premier, il faut remonter jusqu'au dossier racine des annees [cheminentree_pathstr,cheminentree_name,cheminentree_ext,chem inentree_versn]=fileparts(cheminentree); if ~isempty(findstr(cheminentree_name,'GHz')) || ((~isempty(findstr(cheminentree_name,'_')))&&(~isempty(findst r(cheminentree_name,'D')))) cheminentree_name_prev=cheminentree_name; %2)dossier des frequences ou pentades, continuer de remonter jusqu'au dossier des annees [cheminentree_pathstr,cheminentree_name,cheminentree_ext,chem inentree_versn]=fileparts(cheminentree_pathstr); %if (size(cheminentree_name,2)==4 && str2num(cheminentree_name)>1986 && str2num(cheminentree_name)<2007) if (size(cheminentree_name,2)==4 && str2num(cheminentree_name)>(1978-1) && str2num(cheminentree_name)<(yearmax+1)) %3)dossier racine des annees localise ok else %2009dec16, spi, begin cheminsortie=cheminentree; fichiersortie=fichierentree; %2009dec16, spi, begin disp('navigue_dossier: case not supported'); return; end %elseif size(cheminentree_name)==4 && str2num(cheminentree_name)>1986 && str2num(cheminentree_name)<2007 elseif size(cheminentree_name,2)==4 && str2num(cheminentree_name)>(1978-1) && str2num(cheminentree_name)<(yearmax+1) %3)dossier racine des annees localise ok else %2009dec16, spi, begin cheminsortie=cheminentree; fichiersortie=fichierentree; %2009dec16, spi, begin disp('navigue_dossier: case not supported'); return; end %4) lire les fichiers du dossier racine des annees fichiers_dossierracine=dir(cheminentree_pathstr); [nombredefichiers_dossierracine,nnn]=size(fichiers_dossierrac ine); indicefichiers_dossierracine=-1; for i=3:nombredefichiers_dossierracine if strcmp(fichiers_dossierracine(i).name,cheminentree_name)==1 indicefichiers_dossierracine=i; break; end end if indicefichiers_dossierracine==-1 %2009dec16, spi, begin cheminsortie=cheminentree; fichiersortie=fichierentree; %2009dec16, spi, begin return; end if strcmp(lower(direction),'left')==1 %remonter dans l'arbre des dossiers racines annees if(indicefichiers_dossierracine-1)<3 %2009dec16, spi, begin cheminsortie=cheminentree; fichiersortie=fichierentree; %2009dec16, spi, begin return; end cheminsortie=fichiers_dossierracine(indicefichiers_dossierrac ine-1).name; elseif strcmp(lower(direction),'right')==1 %descendre dans l'arbre des dossiers racines annees if(indicefichiers_dossierracine+1)>nombredefichiers_dossierra cine %2009dec16, spi, begin cheminsortie=cheminentree; fichiersortie=fichierentree; %2009dec16, spi, begin return; end cheminsortie=fichiers_dossierracine(indicefichiers_dossierrac ine+1).name; else disp('case incoherent'); return; end %5) reconstruire le nom du dossier complet if ~strcmp(cheminentree_name_prev,'')==1 cheminsortie=fullfile(cheminentree_pathstr,cheminsortie,chemi nentree_name_prev); else cheminsortie=fullfile(cheminentree_pathstr,cheminsortie); end %2009dec16, spi, prevent navigation to inexisting filename and/or folder, return safely with output same as input, begin %{ if ~isdir(cheminsortie) cheminsortie=cheminentree; return; end fichiersortie=fichierentree; if~exist(fullfile(cheminsortie,fichiersortie),'file') return; end %} %2009dec16, spi, prevent navigation to inexisting filename and/or folder, return safely with output same as input, end end %2009dec16, spi, prevent navigation to inexisting filename and/or folder, return safely with output same as input, begin %check if propose file and folder exist, if don't exist keep ouput parameters the same as entry parameters if~exist(fullfile(cheminsortie,fichiersortie),'file') display('navigue_dossier() defaulting safely, attempt to go to an inexisting file or folder'); cheminsortie=cheminentree; fichiersortie=fichierentree; return; end %2009dec16, spi, prevent navigation to inexisting filename and/or folder, return safely with output same as input, end else %fichierentree n'est pas specifie end end %function


Download ppt "Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%% validation section initialization section navigation section."

Similar presentations


Ads by Google