%mfile to plot bathymetry data
%NOTE: user needs to have bathymetry data file loaded and have the
    %top/bottom lats and left/right longs limits available in decimal
    %degrees (e.g., 32.45612 instead of 32 27' 22'').  
    %Use negative for our local longitudes.


%load sd150msf_v2

%predefined Scripps Canyon lat and long

y1=32.866;
y2=32.880;
x1=-117.266;
x2=-117.252;

%query for lat and long
     %change to query by removing percent sign in front of next four lines, and adding it to four lines of predefined lat/long above
     
%y1=input('input bottom lat: ');
%y2=input('input top lat: ');
%x1=input('input left long: ');
%x2=input('input right long: ');

x=find(lon>x1 & lon<x2);
y=find(lat>y1 & lat<y2);

[X,Y]=meshgrid(lon(x(1):x(end)),lat(y(1):y(end)));
Z=bathy(y(1):y(end),x(1):x(end)).*(-1);
%[i,j]=find(bathy>0);
%bathy(i,j)=NaN;

%Removes land values, leaving ocean depths only
ZZ=find(Z>0);
Z(ZZ)=NaN;

%present graphical output is set to 3D color contour map with SURF command
%change to 2D surface map by putting '%' in front of 'surf' and removing '%' in front of 'pcolor'

surf(X,Y,Z)
%pcolor(X,Y,Z)

shading interp
%axis equal
colorbar