Commit 60e1dbfa authored by Pierre Cazenave's avatar Pierre Cazenave

Fix check on the year value

parent e8d84bf9
...@@ -2,24 +2,24 @@ function year = get_NCEP_year(file) ...@@ -2,24 +2,24 @@ function year = get_NCEP_year(file)
% Extract the year from a give NCEP file name (either 'uwnd.sig995.YYYY.nc' % Extract the year from a give NCEP file name (either 'uwnd.sig995.YYYY.nc'
% or 'vwnd.sig995.YYYY.nc'). Files are those downloaded from % or 'vwnd.sig995.YYYY.nc'). Files are those downloaded from
% ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis/surface/. % ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis/surface/.
% %
% INPUT: % INPUT:
% NCEP NetCDF filename (and path) % NCEP NetCDF filename (and path)
% %
% OUTPUT: % OUTPUT:
% NCEP data year % NCEP data year
% %
% Author(s): % Author(s):
% Pierre Cazenave (Plymouth Marine Laboratory) % Pierre Cazenave (Plymouth Marine Laboratory)
% %
% Revision history: % Revision history:
% 2012-10-15 First version % 2012-10-15 First version
% %
%========================================================================== %==========================================================================
[~, tmp_year, ~] = fileparts(file); [~, tmp_year, ~] = fileparts(file);
tmp_year = regexp(tmp_year, '\.', 'split'); tmp_year = regexp(tmp_year, '\.', 'split');
year = str2double(tmp_year(end)); year = str2double(tmp_year(end));
if ~isnumeric(tmp_year) if ~isnumeric(year)
error('Could not parse the NCEP year from the NCEP file name. Expecting ''uwnd.sig995.YYYY.nc'' or ''vwnd.sig995.YYYY.nc''') error('Could not parse the NCEP year from the NCEP file name. Expecting ''uwnd.sig995.YYYY.nc'' or ''vwnd.sig995.YYYY.nc''')
end end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment