Home > utilities > get_NCEP_year.m

get_NCEP_year

PURPOSE ^

Extract the year from a give NCEP file name (either 'uwnd.sig995.YYYY.nc'

SYNOPSIS ^

function year = get_NCEP_year(file)

DESCRIPTION ^

 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

==========================================================================

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function year = get_NCEP_year(file)
0002 % Extract the year from a give NCEP file name (either 'uwnd.sig995.YYYY.nc'
0003 % or 'vwnd.sig995.YYYY.nc'). Files are those downloaded from
0004 % ftp://ftp.cdc.noaa.gov/Datasets/ncep.reanalysis/surface/.
0005 %
0006 % INPUT:
0007 %   NCEP NetCDF filename (and path)
0008 %
0009 % OUTPUT:
0010 %   NCEP data year
0011 %
0012 % Author(s):
0013 %   Pierre Cazenave (Plymouth Marine Laboratory)
0014 %
0015 % Revision history:
0016 %   2012-10-15 First version
0017 %
0018 %==========================================================================
0019 
0020 [~, tmp_year, ~] = fileparts(file);
0021 tmp_year = regexp(tmp_year, '\.', 'split');
0022 year = str2double(tmp_year(end));

Generated on Wed 20-Feb-2019 16:06:01 by m2html © 2005