% data selection (N. Atl. sections)
clear all
loadjg('//puddle.mit.edu/s24_36n(station,lat,lon)');

% select a station
figure(1);clg
plot(lon,lat,'x',lon,lat);
xlabel('Longitude');ylabel('Latitude');
lonsave=lon;latsave=lat;eventsave=station;
hold

while(1)
figure(1);
fprintf(1,'Click on station; hit return with cursor in figure to end\n');
[x,y,b]=ginput(1);
if b>3
  return
end
% find point closest to cursor
distsq=(lonsave-x).^2+(latsave-y).^2;
[md,is]=min(distsq);
plot(lonsave(is),latsave(is),'o');
drawnow

% get data for station
ev=int2str(eventsave(is));
fprintf(1,'You selected station %s\n',ev);

str=['//puddle.mit.edu/s24_36n(station=',ev,')'];
loadjg(str);

% display
figure(2)
plot(o2,-press,sigth,-press);
xlabel('O2 (yellow) Sigth (purple)');ylabel('depth');
title(['Station = ',ev]);
end
