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\'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 , 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 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
%%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%%%%%% %%%%%%%
function [valid, year, month, dayNb] = DateStr2Nb(dateStr); %DATESTR2NB Retourne l'année, le mois et le jour ordinal de l'année. % % [VALID, YEAR, MONTH, DAYNB] = DATESTR2NB(DATESTR) retourne l'année YEAR, % le mois MONTH et le jour ordinal de l'année DAYNB représentés par la chaîne % de caractères DATESTR. % % DATESTR est de la forme 'année/mois/jour'. % % Si DATESTR est valide, VALID = 1, sinon VALID = 0. [year, rem] = strtok(dateStr, '/'); [month, rem] = strtok(rem, '/'); [day, rem] = strtok(rem, '/'); year = str2double(year); month = str2double(month); day = str2double(day); if ~isnan(year) & ~isnan(month) & ~isnan(day) & isempty(rem)... & IsDate(year, month, day) daysInPrevMonths = [ ]; dayNb = daysInPrevMonths(month)... + ( IsLeapYear(year) & ( month > 2 ) )... + day; valid = 1; else valid = 0; year = 0; dayNb = 0; end