[bath_section,lon_section,lat_section,time_section] = bathymetry_section(bathy,xcoords,ycoords,xref)
[bath_section,lon_section,lat_section,time_section] = bathymetry_section(bathy,xcoords,ycoords,xref,filled)[bath_section,lon_section,lat_section] = bathymetry_section(bathy,xcoords,ycoords,xref) makes a section plot from bathy, where bathy is a struct of Smith & Sandwell Global Topography created using bathymetry_extract. xcoords (longitude) and ycoords (latitude) are densified to a 1/60-deg grid before bathymetry is interpolated. The bathymetry section is plotted against xref; where xref = 'lon', 'lat','km', or a time vector of length(xcoords). The extracted data is output bath_section, lon_section, lat_section, and time_section; output vectors are sorted by the selected reference axis (longitude, latitude, or time).
[bath_section,lon_section,lat_section,time_section] = bathymetry_section(bathy,xcoords,ycoords,xref,filled) allows the bathymetry to be filled in black down to the x-axis (instead of a simple line). Set filled=1 to turn on, filled=0 to turn off.
xcoords and ycoords are vectors of coordinates. Rows or columns are fine, and both -180/180 or 0/360 notation are fine.
When xref is a time vector, it must be of length(xcoords) and elements of the vector must be datenums. Otherwise set xref = 'lon' or xref = 'lat'. Alteratively pass xref = 'km' to plot in along-track distance, assuming spherical earth.
% Add bathymetry to a temperature section plot from the list of coordinates stored in struct cruise:
xref = 'lon';
general_section(cruise,'temperature',xref,'pressure') % plot temperature section
xcoords = cruise.lon;
ycoords = cruise.lat;
filled = 1;
[bathy] = bathymetry_extract(bathymetry_dir,bounding_region(cruise));
bathymetry_section(bathy,xcoords,ycoords,xref,filled)% Plot bathymetry nearest to a list of coordinates. Use latitude as the x-axis:
xref = 'lat';
xcoords = [60 60.1 60.4 60.2 59.9];
ycoords = [10 20.1 15.0 16.1 13.7];
[bathy] = bathymetry_extract(bathymetry_dir,bounding_region([],xcoords,ycoords));
figure
bathymetry_section(bathy,xcoords,ycoords,xref)% Plot bathymetry nearest to a list of coordinates. Use a time as the x-axis:
xref = [737009 737010 737011 737012 737013];
xcoords = [60 60.1 60.4 60.2 59.9];
ycoords = [10 20.1 15.0 16.1 13.7];
[bathy] = bathymetry_extract(bathymetry_dir,bounding_region([],xcoords,ycoords));
figure
bathymetry_section(bathy,xcoords,ycoords,xref)