Overview %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%
%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\ application (lauched with ar\sp\update_all.m) %oifii.org's ar\sp\ratio 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: % daily-surface-temperature-db_ zip % %this function backups and reproduces ts, ts_norm, ts_corr and ratio (smmr and ssmi) time series. %this function also backups and reproduces snowcover and fusioned temperature databases as well as default %jdjf_tendance() and ts_corr_anomalies() analysis. % %the reference recomputation procedure document for the surface temperature time series and databases can be found at: % daily-surface-temperature-db_ar-sp_procedure-for- recomputation.pdf % %AREFILESEXISTING Vrai pour les fichiers présents dans le répertoire. % % [bExist] = AREFILESEXISTING(DIRECTORY, FILES, IGNORECASE) retourne une matrice colonne % bExist spécifiant l'existence ou non de chacun des fichiers de FILES dans le répertoire % DIRECTORY. % % Si FILES(m, :) est présent dans le répertoire, (la recherche ignore les espaces en fin % de nom) bExist(m, 1) = 1, sinon bExist(m, 1) = 0. % % IGNORECASE est un paramètre optionnel permettant de spécifier si la recherche doit tenir % compte ou non de la casse : 0 = tenir compte de la casse % 1 = ne pas tenir compte de la casse % Par défaut, IGNORECASE = 0. % % FILES est de la forme [FILE1; FILE2; etc.] et % bExist de la forme [FILE1EXIST; FILE2EXIST; etc.]. % % Note : bExist = [] si FILES = []. % bExist = [-1] si DIRECTORY est invalide. % %usage: % % 2010mmmdd % AreFilesExisting('dir','files',0) % %version 3.0, 2010jan10, spi, load('srcimgdb_paths.mat') % %nakedsoftware.org opensource license, copyright 2010
%%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%
function [bExist]=AreFilesExisting(directory, files, ignoreCase) if nargin <= 2, ignoreCase = 0; end if isempty(files) bExist = []; return; end if ~isdir(directory) bExist = [-1]; return; end currentDirectory = cd; cd(directory); dirInfo = dir; filesInDirectory = strvcat(dirInfo.name); for n = 1:length(files(:, 1)), file = deblank(files(n, :)); if ignoreCase == 1 bExist(n, 1) = ~isempty(strmatch(upper(file), upper(filesInDirectory), 'exact')); else bExist(n, 1) = ~isempty(strmatch(file, filesInDirectory, 'exact')); end cd(currentDirectory); end%function