Home > omviz > ecomdemo.m

ecomdemo

PURPOSE ^

m-file to show a few examples of extracting data

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 m-file to show a few examples of extracting data
 from Blumberg-Mellor netCDF model output.

 Rich Signell (rsignell@usgs.gov)  3-22-95

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % m-file to show a few examples of extracting data
0002 % from Blumberg-Mellor netCDF model output.
0003 %
0004 % Rich Signell (rsignell@usgs.gov)  3-22-95
0005 
0006 % Specify full path to the Blumberg/Mellor model netCDF file
0007 %
0008 cdf='ecom.cdf';
0009 
0010 % check version
0011 v=version;if(str2int(v(1))<5),disp('You need at least Matlab 5!'),return,end
0012 
0013 % Extract Temperature and Velocity Data at 2 m depth from the 1st
0014 % time step using ZSLICE
0015 %
0016 tind=1;
0017 var='temp';
0018 depth=-2;
0019 %
0020 [t,x,y,jd1]=zslice(cdf,var,tind,depth);
0021 [w,x,y]=zsliceuv(cdf,tind,depth);
0022 %
0023 % plot the temperature slice using PSLICE
0024 %  (and use a range from 10-25 degrees C
0025 %  and title it with date) and overlay the velocity vectors.
0026 
0027 %
0028 pslice(x/1000,y/1000,t,[10 25],'Degrees C');...    % convert x,y to km
0029 psliceuv(x/1000,y/1000,w,3,20,'black');...
0030 date_str=greg2str(gregorian(jd1));...
0031 title(['Slice of ' var ' at z = ' int2str(depth) ' : ' date_str]);...
0032 xlabel('km');ylabel('km');
0033 
0034 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0035 figure;
0036 % extract a vertical section j slice of salinity from the 2nd time step
0037 
0038 tind=2
0039 jindex=30
0040 var='salt';
0041 [s,x,z]=jslice(cdf,var,tind,jindex);
0042 
0043 % contour the vertical section using contourf
0044 contourf(x,z,s);
0045 colormap(jet);...
0046 title(['Slice of ' var ' at j = ' int2str(jindex) ', tstep = ' int2str(tind)]);
0047 ylabel('Depth (m)');xlabel('Distance Offshore (km)')
0048

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