% routine to extract T/S profiles from OPeNDAP server % X days prior to today where X is hardcoded as: X=150; % assumes you have "loaddap" loaded somewhere on your machine & path added %addpath /usr/local/bin % get information on casts available url=['http://gisweb.wh.whoi.edu:8080/dods/whoi/hydro_event?hydro_event.CRUISE_ID,hydro_event.CAST,hydro_event.LAT_DD,hydro_event.LON_DD,hydro_event.GMT_DATE,hydro_event.GMT_TIME&hydro_event.GMT_DATE>',datestr(datenum(date)-X)]; loaddap(url); if exist('hydro_event')==0; disp(['No profiles found in the last ',num2str(X),' days.']);return;end; d=NaN*ones(1,7); % row of data to append to for each cast % now get actual profile data for these casts for k=1:length(hydro_event.CAST); url=['http://gisweb.wh.whoi.edu:8080/dods/whoi/hydro_data?hydro_data.CAST,hydro_data.PRES,hydro_data.TEMP,hydro_data.SALT&hydro_data.CRUISE_ID="',hydro_event.CRUISE_ID(k,:),'"&hydro_data.CAST="',hydro_event.CAST(k,:),'"']; loaddap(url); mn=floor(rem(hydro_event.GMT_TIME(k,:),1)*60);sc=round((rem(hydro_event.GMT_TIME(k,:),1)*60-mn)*60);% decimal hour changed to minutes and seconds matlabtime=datenum(str2num(hydro_event.GMT_DATE(k,1:4)),str2num(hydro_event.GMT_DATE(k,6:7)),str2num(hydro_event.GMT_DATE(k,9:10)),floor(hydro_event.GMT_TIME(k,:)),mn,sc)*ones(length(hydro_data.PRES),1); d=[d; matlabtime str2num(hydro_data.CAST) hydro_event.LAT_DD(k)*ones(length(hydro_data.PRES),1) hydro_event.LON_DD(k)*ones(length(hydro_data.PRES),1)*-1 hydro_data.PRES hydro_data.TEMP hydro_data.SALT]; end; disp('Your matrix "d" should have the following columns: matlabtime(gmt) cast lat lon depth(m) temp salt');