sfregosi/agate

Add example workflow of extracting positional data for NCEI (see `workflow_processPositions_allUxSMHI.m` in `glider-MHI` repo

Closed this issue · 1 comments

%% save positional data for packaging for NCEI

% gps surface table
if ~exist('gpsSurfT', 'var')
	load(fullfile(CONFIG.path.mission, 'profiles', ...
		[CONFIG.glider, '_', CONFIG.mission, '_gpsSurfaceTable.mat']));
end
keepCols = {'dive', 'startDateTime', 'startLatitude', 'startLongitude', ...
	'endDateTime', 'endLatitude', 'endLongitude'};
gpsSurfSimp = gpsSurfT(:,keepCols);
newNames = {'DiveNumber', 'StartDateTime_UTC', 'StartLatitude', 'StartLongitude', ...
	'EndDateTime_UTC', 'EndLatitude', 'EndLongitude'};
gpsSurfSimp.Properties.VariableNames = newNames;
writetable(gpsSurfSimp, fullfile(CONFIG.path.mission, 'profiles', ...
	[CONFIG.glider, '_', CONFIG.mission, '_GPSSurfaceTableSimple.csv']))

% location table
if ~exist('locCalcT', 'var')
	load(fullfile(CONFIG.path.mission, 'profiles', ...
		[CONFIG.glider, '_', CONFIG.mission, '_locCalcT.mat']))
end
keepCols = {'dateTime', 'latitude', 'longitude', 'depth', 'dive'};
locCalcSimp = locCalcT(:,keepCols);
newNames = {'DateTime_UTC', 'Latitude', 'Longitude', 'Depth_m', 'DiveNumber'};
locCalcSimp.Properties.VariableNames = newNames;
writetable(locCalcSimp, fullfile(CONFIG.path.mission, 'profiles', ...
	[CONFIG.glider, '_', CONFIG.mission, '_CalculatedLocationTableSimple.csv']))

% environmental data
if ~exist('locCalcT', 'var')
	load(fullfile(CONFIG.path.mission, 'profiles', ...
		[CONFIG.glider, '_', CONFIG.mission, '_locCalcT.mat']))
end
keepCols = {'dive', 'dateTime', 'latitude', 'longitude', 'depth', ...
	'temperature', 'salinity', 'soundVelocity', 'density'};
locCalcEnv = locCalcT(:,keepCols);
newNames = {'DiveNumber', 'DateTime_UTC', 'Latitude', 'Longitude', 'Depth_m', ...
	'Temperature_C', 'Salinity_PSU', 'SoundSpeed_m_s', 'Density_kg_m3', };
locCalcEnv.Properties.VariableNames = newNames;
writetable(locCalcEnv, fullfile(CONFIG.path.mission, 'profiles', ...
	[CONFIG.glider, '_', CONFIG.mission, '_CTD.csv']))

included this in workflow_processPositionalData