Commit 8dd0ada7 authored by Pierre Cazenave's avatar Pierre Cazenave

Remove the redundant check on the numeric value of the extracted year

parent 1c05a377
...@@ -2,24 +2,21 @@ function year = get_NCEP_year(file) ...@@ -2,24 +2,21 @@ 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)
error('Could not parse the NCEP year from the NCEP file name. Expecting ''uwnd.sig995.YYYY.nc'' or ''vwnd.sig995.YYYY.nc''')
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