function [field,x,y,z]=oaggui_islice(filein,iindex,time,var)

%       USAGE: [field,x,y,z]=hops_islice(filein,iindex,time,time)
%
% HOPS_ISLICE  Returns a matrix containing a vertical slice (field),
%   of the variable var and the  position (y,z) at a 
%   specified jindex and time step from an HOPS output (PE) file. 
%
%   In case of a non-oblique domain iindex represent a fixed longitude
% inputs: 	
% 		filein -- the .nc file
% 		time -- time of teh simulatio
%		var -- string with the variable name
%		iindex = I index along which slice is taken
%
% Pedro Velez (UIB-IEO), July 1999



if  strcmp('potden',strrep(var,' ',''))
[temp,x,y,z]=oaggui_islice(filein,iindex,time,'temp');
[salt,x,y,z]=oaggui_islice(filein,iindex,time,'salt');
field=potden80(salt,potemp80(salt,temp,-repmat(z',size(y,1),1)),-repmat(z',size(y,1),1));
return;
end





x=getnc(filein,'grid2',[1 -1 1],[1 -1 1],1,1,2);
y=getnc(filein,'grid2',[-1 1 2],[-1 1 2],1,1,2);
z=getnc(filein,'zout',[-1 3],[-1 3],1,1,2);
field=getnc(filein,var,[time -1 iindex -1],[time -1 iindex -1],1,1,2);
field(find(field==0))=NaN;


