function [H]= plotELCOMcurtain(data,varname,tslice); % function [H]= plotELCOMcurtain(data,varname,tslice) % % funcion to plot ELCOM elcom curtain output % plot correct free surface level % % Inputs: % data : struct array of data from nldnc % variable : name of variable to plot eg: "SALINITY" % tslice : time slice to plot % % Outputs % ierr : error flag % % Uses: % CWRdate2matlab.m % % Written by C. Dallimore 27 July 04 % % Script for plotting ELCOM curtain outputs % % Written by C Dallimore 2/8/04 % % Setup units of various input types variable_mat = setELCOMioTypes; warning off if nargin == 3 elseif nargin == 2 tslice = 1; else error('Incorrrect number of input arguments!') end; % Get number of dimensions of variable eval (['ndim = ndims(data.',varname,');']); % Get data to plot if (ndim == 3) eval (['pltdata = squeeze(data.',varname,'(tslice,:,:));']); else error('plotELCOMcurtain only plots variables 3 dimensions (t,Z,S)') end % plot data [H] = pcolor_CD(data.S/1000,data.Z,pltdata); set(gca,'layer','top','ydir','normal') % plot freesurface xl = get(gca,'xlim'); yl = get(gca,'ylim'); S = data.S/1000; fill_x = [xl(1); xl(1); S; xl(2); xl(2); xl(1)]; fs = squeeze(data.FreeSurfHeights(tslice,:)); fill_z = [yl(2), fs(1), fs fs(length(fs)), yl(2), yl(2)]; hold on fill(fill_x,fill_z,[1 1 1]) % plot bathym fields = fieldnames(data) if (any(strcmp('Bathym',fields))) xl = get(gca,'xlim'); yl = get(gca,'ylim'); S = data.S/1000; fill_x = [xl(1); xl(1); S; xl(2); xl(2); xl(1)]; bt = squeeze(data.Bathym); fill_z = [yl(1); bt(1); bt; bt(length(bt)); yl(1); yl(1)]; hold on fill(fill_x,fill_z,[0.5 0.5 0.5]) end box on set(gca,'layer','top') xlabel('Distance (km)'); ylabel('Z (m)')