Home > omviz > zsliceuv.m

zsliceuv

PURPOSE ^

ZSLICEUV: Returns horizontal velocity slice from SCRUM or ECOM Netcdf file.

SYNOPSIS ^

function [w,x,y]=zsliceuv(cdf,timestep,zdepth)

DESCRIPTION ^

ZSLICEUV:  Returns horizontal velocity 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_zsliceuv" or
 "scrum_zsliceuv".

 USAGE: [w,x,y]=zsliceuv(cdf,time,zdepth)
    cdf:  name of SCRUM or ECOM NetCDF file.
    time:  time index, must be zero-based
    zdepth:  depth in meters (e.g -10.)

 see also ZSLICE
 hint: use PSLICEUV to plot the results of ZSLICEUV

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [w,x,y]=zsliceuv(cdf,timestep,zdepth)
0002 %ZSLICEUV:  Returns horizontal velocity 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_zsliceuv" or
0006 % "scrum_zsliceuv".
0007 %
0008 % USAGE: [w,x,y]=zsliceuv(cdf,time,zdepth)
0009 %    cdf:  name of SCRUM or ECOM NetCDF file.
0010 %    time:  time index, must be zero-based
0011 %    zdepth:  depth in meters (e.g -10.)
0012 %
0013 % see also ZSLICE
0014 % hint: use PSLICEUV to plot the results of ZSLICEUV
0015 
0016 if ( nargin ~= 3 )
0017     help zslice;
0018     return;
0019 end
0020 
0021 ncid = ncmex('open', cdf, 'nowrite');
0022 if ( ncid == -1 )
0023     fprintf ( 'Could not open %s.\n', cdf );
0024     return;
0025 end
0026 
0027 %
0028 % Assume that a SCRUM file will always contain the 'xi_rho' dimension.
0029 % If we find it, assume that we've got a SCRUM file.
0030 [dimid, rcode] = ncmex('dimid', ncid, 'xi_rho');
0031 if ( dimid ~= -1 )
0032     [w,x,y]=scrum_zsliceuv(cdf,timestep,zdepth);
0033     ncmex ( 'close', ncid );
0034     return;
0035 end
0036 
0037 %
0038 % Assume that an ECOM file will always contain the 'xpos' dimensions.
0039 % If we find it, assume it is an ECOM file.
0040 [dimid, rcode] = ncmex('dimid', ncid, 'xpos');
0041 if ( dimid ~= -1 )
0042     [w,x,y]=ecom_zsliceuv(cdf,timestep,zdepth);
0043     ncmex ( 'close', ncid );
0044     return;
0045 end
0046 
0047 
0048 %
0049 % If we get this far, then neither file was recognizable.
0050 fprintf ( 'I can''t make sense out of %s???\n', cdf );
0051 help zslice;
0052 return;
0053 
0054

Generated on Thu 01-Dec-2005 08:50:35 by m2html © 2003