4.3.3.1.2. Using get_xfraw to get single-ping data¶
You’ll need to know the cruise name being used by UHDAS for logging this cruise (it’s on the top left of the green panels on the console). For example, suppose the cruise is ‘vg0601’.
4.3.3.1.2.1. An example for Ocean Surveyor data¶
Identify processing directory path for the instrument of choice. Data acquisition takes place in adcp_data under the cruise name. Processing always takes place in the ‘proc’ subdirectory, in a sundirectory named for the instrument, eg. ‘os75nb’. Data acquisition takes place in the ‘raw’ subdirectory.
Decide which processing directory you want, eg ‘os75nb’.
adcp_data/vg0601/proc/os75nb
The corresponding raw data directory is
adcp_data/vg0601/raw/os75
Determine the transducer offset. This is a variable in the file below, The variable will be written as os75.h_align in the file:
adcp_data/vg0601/proc/os75nb/config/vg0601_proc.m
get a file list from the raw data directory:
rawdir = ‘adcp_home/cruise/raw/os75’;
filelist = dirs(fullfile(rawdir, ‘*.raw’), ‘fullfile’,1);
eg. read the 12th file: % it may take a while
os_halign = 42.3; %set this to what you found in #2 data=get_xfraw(os, filelist(12).name,’h_align’, os_halign); [osdd, cfg] = restruct(os, data);
- The program
get_xfraw.m
is doing 2 things: reading the singleping data using
read.m
, documented hereattaching the matching
gbin
data to provide necesary time, position, and heading.
- The program
Variations on a theme:
for WH300 data, the code would look like this:
rawdir = 'adcp_home/cruise/raw/wh300';
filelist = dirs(fullfile(rawdir, '*.raw'), 'fullfile',1);
wh_halign = -45.2; %set this to what you found in #2 for wh300
data=get_xfraw(bb, filelist(12).name,'h_align', wh_halign);
[bbdd,cfg] = restruct(bb, data);
for NB150, the code would look like this:
rawdir = 'adcp_home/cruise/raw/nb150;
filelist = dirs(fullfile(rawdir, '*.raw'), 'fullfile',1);
nb_halign = 55; %set this to what you found in #2 for nb150
data=get_xfraw(bb, filelist(12).name,'h_align', nb_halign,...
'yearbase', 2006,'beamangle',30); %need these for nb150
[nbdd, cfg] = restruct(nb, data);
4.3.3.1.2.2. More details about get_xfraw¶
The ‘raw’ data are ‘as is’, coming from a given instrument. This is an NMEA message logged for position; the format is standard. Other instruments output other equally cryptic lines
$GPGGA,035959.955,6530.6843,S,00020.4139,E,1,06,1.1,029.2,M,-016.0,M,,*5A
Matlab can’t read it though, so we create matlab-readable files to match those data in raw that came from ascii inputs (i.e. everything except the instrument). Those files are stored in the “rbin” directory. The match the “raw” ascii serial inputs file for file, and line for line (for the message type chosen). These files are created (appended to) during data acquisition.
The “rbin” files can be read by matlab but only match the instrument’s raw data by filename, not by timestamp. In addition, the only timestamp in the instrument raw files (eg from “raw/os75/*.raw”) is the instrument timestamp, stored in “dday”. A third type of file is created/updated/generated every time the 5-minute ensembles are updated. These are in the “gbin” directory, contain the same filename base as the corresponding “raw” instrument file, and contain one line per instrument ping. They have been generated so the fields can be glued to the raw data to provide a corrected timestamp and navigation.
4.3.3.1.2.2.1. More details¶
The rbin files are
intermediate files only, generated on the fly by UHDAS
- mached by name and directory, but located under “rbin” (rather
than “raw”, and with an additional suffix “.rbin”
readable with matlab by using the function “read_bin”. This function returns the data and a structure describing the data, noteably with a field “rows” that contains the names of each row. So for a gps file, the raw would look like you see and the “rbin” would look like this
[navdata, navstruct] = ...
read_bin('rbin/gpsnav/np2005_192_36000.gps.rbin');
The first output (navdata) is an array:
navdata 6x7200 345600 double array
The second output is a structure, with navstruct.rows as:
ans =
'u_dday'
'dday'
'lon'
'lat'
'quality'
'hdop'
The gbin files are written so they can be read the same way (readable by read_bin). The “g” in “gbin” is “gridded” (i.e. gridded onto the ping times). There is one subdirectory per ascii serial input, and one more (“time” that contains the look-up table for instrument time to UTC and the best estimate of navigation and heading).