get_NCEP_year.m 619 Bytes
Newer Older
Geoffrey Cowles's avatar
Geoffrey Cowles committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
function year = get_NCEP_year(file)
% Extract the year from a give NCEP file name (either 'uwnd.sig995.YYYY.nc'
% or 'vwnd.sig995.YYYY.nc'). Files are those downloaded from
% ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis/surface/.
%
% INPUT:
%   NCEP NetCDF filename (and path)
%
% OUTPUT:
%   NCEP data year
%
% Author(s):
%   Pierre Cazenave (Plymouth Marine Laboratory)
%
% Revision history:
%   2012-10-15 First version
%
%==========================================================================

[~, tmp_year, ~] = fileparts(file);
tmp_year = regexp(tmp_year, '\.', 'split');
year = str2double(tmp_year(end));