%% get_spatial : to fetch spatial data for mission for combination 
%% with ctd data
%%  depth is used to compute pressure for salinity and oxygen computations
%%  lat and lon are pre-mission GPS fixes, constant after mission start
%%  roll, pitch and yaw are extracted for 3-D mission visualization
function [lat,lon,gpstime,depth,roll,pitch,yaw,navtime] = get_spatial

%% -------- Latitude, longitude and time -------------
% eval(['load ' mission '/dataGPS']);
load dataGPS 

old=0;   %% Old (early 2000) storage format for lat/lon required cleanup
if old
 rawlat = gps(:,latitude); rawlon = gps(:,longitude);
 lat = floor(rawlat/100) + (rawlat-floor(rawlat/100)*100)/60;
 lon = -1*[floor(rawlon/100) + (rawlon-floor(rawlon/100)*100)/60];
else
 lat=gps(:,latitude); lon=-1*gps(:,longitude);
end

gpstime = gps(:,time); 

%% -------- Depth -------------
load dataN
 roll = [dataNav(:,mPhi)*180/pi];
 pitch = [dataNav(:,mTheta)*180/pi];
 yaw = [dataNav(:,mPsi)*180/pi];
 depth = dataNav(:,mDepth);
 navtime = dataNav(:,time);

return
