function [data,x,y,t,grd] = roms_zslice(file,var,time,depth,grd) % $Id: roms_zslice.m 358 2008-04-07 14:15:03Z zhang $ % Get a constant-z slice out of a ROMS history, averages or restart file % [data,x,y] = roms_zslice(file,var,time,depth,grd) % % Inputs % file = his or avg nc file % var = variable name % time = time index in nc file % depth = depth in metres of the required slice % grd (optional) is the structure of grid coordinates from get_roms_grd % % Outputs % % data = the 2d slice at requested depth % x,y = horizontal coordinates % t = time in days for the data % % John Wilkin depth = -abs(depth); % open the history or averages file %nc = netcdf(file); if ~nc_isvar(file,var) error([ 'Variable ' var ' is not present in file ' file]) end % get the time time_variable = nc_attget(file,var,'time'); if isempty(time_variable) time_variable = 'scrum_time'; % doubt this is really of any use any more end if nc_varsize(file,time_variable)