UH LADCP Documentation

Navigation

This Page

set_cast_params.mΒΆ

The following is the MATLAB script set_cast_params.m used to process the data with the LDEO sofware during I5S 2009:

% cruise ID and name of person who processes the data %%%%%%%%%%%

p.cruise_id = 'I5S_2009';
p.whoami = 'F. Ascani';

% station number %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
p.ladcp_station = stn;

% filename of the raw LADCP data %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ladcp_datapath = ['/home/science/' p.cruise_id '/data/ladcp/']
ladcp_filename_start = 'bb';
ladcp_filename_end = '.dat';
cast_loc_index = [7 8];
stn_str = sprintf('%03d',stn);

[w,ladcp_list]=unix(['ls ' ladcp_datapath ladcp_filename_start stn_str '*' ladcp_filename_end]);

if w ~= 0
   error('error while reading the LADCP data...')
end

if size(ladcp_list,1) > 1
   error(['multiple files for station: ' stn_str '...'])
   end

   ladcp_filename = ladcp_list(1:end-1);

   cast_str = ladcp_filename(length(ladcp_datapath)+cast_loc_index);

   f.ladcpdo = sprintf(ladcp_filename);

   %f.ladcpup = ('raw/LADCP/%03d',stn); % there is an upward-looking instrument as well

   % CTD time series %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   if stn ~= 102 % problem with ctd data for station 102

   ctd_data='y' % 'y'=yes, 'n'=no

   else

   ctd_data='n';

   end

   if ctd_data == 'y'

   ctd_datapath = ['/home/science/' p.cruise_id '/data/ctd_timeseries/'];
   ctd_filename_start = '';
   ctd_filename_end = '.ctd';

   ctd_filename=[ctd_datapath stn_str cast_str ctd_filename_end];

   f.ctd = sprintf(ctd_filename);

   % number of header lines (before the CTD data start) %%%%%%%%%%%%
   f.ctd_header_lines = 0; % file layout

   % number of data fields per CTD scan %%%%%%%%%%%%%%%%%%%%%%%%%%%%
   f.ctd_fields_per_line = 11;

   % field number for pressure, temperature, salinity and time %%%%%
   f.ctd_pressure_field = 2;
   f.ctd_temperature_field = 3;
   f.ctd_salinity_field = 4;
   f.ctd_time_field = 1;

   % time base to use %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   f.ctd_time_base = 0; % 0=elapsed, 1=year-day, 2=gregorian

   end

   % GPS data? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

   if stn ~=102 % problem with ctd data for station 102

      gps_data='y' % 'y'=yes, 'n'=no

   else

      gps_data='n';

   end



   if gps_data == 'y'

      % GPS filename %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      f.nav = f.ctd; % if GPS and CTD data are in the same file
      %f.nav = sprintf('/GPS/%03d',stn); % otherwise

      % number of header lines (before the GPS data start) %%%%%%%%%%%%
      f.nav_header_lines = 0;

      % number of fields per scan %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      f.nav_fields_per_line = 11;

      % field number for time, latitude and longitude %%%%%%%%%%%%%%%%%
      f.nav_time_field = 1;
      f.nav_lat_field = 10;
      f.nav_lon_field = 11;

      % time base to use %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      f.nav_time_base = 0; % 0=elapsed (default), 1=year-day, 2=gregorian
                           % 0 only if GPS and CTD data are co-recorded

end

% SADCP data? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

sadcp_data_from_UH='n' % 'y'=yes, 'n'=no

if sadcp_data_from_UH == 'y'

   % SADCP MATLAB file %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   f.sadcp = 'SADCP/SADCP.mat';

   p.sadcp_dtok = 0

   mkSADCP('/Data/ADCP/LADDER-1','../data/SADCP/SADCP.mat');

end


% CTD profile? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if stn ~= 102 % problem with ctd data for station 102

   ctdprof = 'y';

else

   ctdprof = 'n';

end


if ctdprof == 'y'

   ctdprof_datapath = ['/home/science/' p.cruise_id '/data/ctd_2db/'];
   ctdprof_filename_start = '';
   ctdprof_filename_end = '.ctd';

   ctdprof_filename=[ctdprof_datapath stn_str cast_str ctdprof_filename_end];

   f.ctdprof = sprintf(ctdprof_filename);

end


% magnetic deviation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if gps_data == 'n' % only if there is no GPS data; if there is,
                   % the magnetic devation will be set using geomag60

   p.drot = magdev(-34,73.5) % magnetic deviation at 34S and 73.5E

   %or

   %  p.poss =  0; % start position
   %  p.pose =  0; %   end position

end


% save matlab files? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

p.savemat = 1; % yes=1, no=0 (default)

% save figures? %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% p.saveplot_png = []; % yes=nothing, no=1 (default)

more off
clear pk

% basename of the checkpoint files %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f.checkpoints = sprintf('checkpoints/%03d',stn);

% basename of the output files %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
f.res = sprintf('processed/%03d',stn);

% plot title

p.name = sprintf('%s cast #%d',p.cruise_id,p.ladcp_station);

% which plot(s) to save (see Appendix F in 'howto.pdf' for the list of plots)
% note: ProcFig. 4 will be generated only if CTD data are provided
% ProcFig. 12 triggers a mistake when used with auxiliary data
% Add ProcFig. 5, 6 and 10 if an uplooker instrument is used
% Add ProcFig. 9 for SADCP

p.saveplot = [1:4 7:8 11 13:14];

%p.saveplot = [];

% The following disables a constraint. Do it in most circumstances

ps.smallfac = [1 0];

% Specific to stations

if stn==2

   % try w/o bottom-tracking
   p.btrk_mode=0;

end