


ZSLICE: Returns horizontal slice from SCRUM or ECOM Netcdf file.
This is a wrapper m-file that determines whether the input file is of
type SCRUM or ECOM. Depending on the result, it calls "ecom_zslice" or
"scrum_zslice".
USAGE: [u,x,y]=zslice(cdf,var,time,zdepth)
cdf: name of SCRUM or ECOM NetCDF file.
var: name of variable.
time: time index, must be zero-based
zdepth: depth in meters (e.g -10.)
see also ZSLICEUV,
hint: use PSLICE to plot the results of ZSLICE

0001 function [u,x,y]=zslice(cdf,var,timestep,zdepth) 0002 %ZSLICE: Returns horizontal slice from SCRUM or ECOM Netcdf file. 0003 % 0004 % This is a wrapper m-file that determines whether the input file is of 0005 % type SCRUM or ECOM. Depending on the result, it calls "ecom_zslice" or 0006 % "scrum_zslice". 0007 % 0008 % USAGE: [u,x,y]=zslice(cdf,var,time,zdepth) 0009 % cdf: name of SCRUM or ECOM NetCDF file. 0010 % var: name of variable. 0011 % time: time index, must be zero-based 0012 % zdepth: depth in meters (e.g -10.) 0013 % 0014 % see also ZSLICEUV, 0015 % hint: use PSLICE to plot the results of ZSLICE 0016 0017 if ( nargin ~= 4 ) 0018 help zslice; 0019 return; 0020 end 0021 0022 ncid = ncmex('open', cdf, 'nowrite'); 0023 if ( ncid == -1 ) 0024 fprintf ( 'Could not open %s.\n', cdf ); 0025 return; 0026 end 0027 0028 % 0029 % Assume that a SCRUM file will always contain the 'xi_rho' dimension. 0030 % If we find it, assume that we've got a SCRUM file. 0031 [dimid, rcode] = ncmex('dimid', ncid, 'xi_rho'); 0032 if ( dimid ~= -1 ) 0033 [u,x,y]=scrum_zslice(cdf,var,timestep,zdepth); 0034 ncmex ( 'close', ncid ); 0035 return; 0036 end 0037 0038 % 0039 % Assume that an ECOM file will always contain the 'xpos' dimensions. 0040 % If we find it, assume it is an ECOM file. 0041 [dimid, rcode] = ncmex('dimid', ncid, 'xpos'); 0042 if ( dimid ~= -1 ) 0043 [u,x,y]=ecom_zslice(cdf,var,timestep,zdepth); 0044 %u = u'; 0045 %x = x'; 0046 %y = y'; 0047 ncmex ( 'close', ncid ); 0048 return; 0049 end 0050 0051 0052 % 0053 % If we get this far, then neither file was recognizable. 0054 fprintf ( 'I can''t make sense out of %s???\n', cdf ); 0055 help zslice; 0056 return; 0057 0058