Navigation

This Page

Using getmat to obtain all bins and all profiles

Loading files generated by getmat

  1. You will probably want the matlab program load_getmat.m

  2. Identify the location of the files generated by “getmat”. For example, a modern UHDAS installation writes files prefixed by “allbins_” in the “contour” subdirectory where the data are processed. You can see the live processing directory and access the “allbins_” files by looking at the shared “data” directory and following the example in the next step. (see this link for information about network shares)

  3. If the location of the getmat output is adcp_data/km0808/proc/os38nb/contour then load the files with matlab as follows:

    data = load_getmat(‘adcp_data/km0808/proc/os38nb/contour/allbins_’);

  4. Variable names are documented with “help load_getmat” or at the bottom of this page

Extracting files with getmat

Newer UHDAS installations do this automatically. The output files are in the contour subdirectory. Here are instructions to extract these files yourself if that is necessary.

  1. You need access to the executable program “getmat”. There are various versions of this program compiled for different operating systems. Make sure you get the right program. The executable “getmat” may also be accessed on a ship with a UHDAS installation through the programs directory shared by the UHDAS computer (instructions for using network shares are here.

    Another option is to download the appropriate file from this list (right-click and save: these are binary files): 32-bit linux, 64-bit linux, OSX intel, OSX powerpc, 32-bit windows.

  2. Choose a location to run the command where you have write permission. Files will be written to the working directory which can then be loaded into matlab (see top section)

  3. Identify processing directory path. You need to specify the path to the database name. The database name is the collection of charcters preceding “dir.blk” in the adcpdb subdirectory. (see matlab “help load_getmat” for more help). A UHDAS at-sea example for the Kilo Moana would be

getmat -rs -f allbins_ adcp_data/km0808/proc/os38nb/adcpdb/a_km

Fieldnames in “load_getmat” output:

  fieldnames   size         meaning:
   dday       1 x nprofs   zero-based decimal day (end of profile)
   time       6 x nprofs   year,month,day,hour,minute,second (end of profile)
iblkprf       2 x nprofs   database block and profile number
    lon       1 x nprofs   longitude (from smoothed navigation; end of profile)
    lat       1 x nprofs   latitude  (from smoothed navigation; end of profile)
heading       1 x nprofs   average primary heading (usually gyro)
tr_temp       1 x nprofs   average temperature
last_temp     1 x nprofs   last temperature
last_good_bin 1 x nprofs   last good bin (-1 is bad profile)
    amp   nbins x nprofs   signal return amplitude or rssi (averaged)
   amp1   nbins x nprofs   signal return amplitude or rssi (beam 1)
   amp2   nbins x nprofs   signal return amplitude or rssi (beam 2)
   amp3   nbins x nprofs   signal return amplitude or rssi (beam 3)
   amp4   nbins x nprofs   signal return amplitude or rssi (beam 4)
  swcor   nbins x nprofs   spectral width (nb150) or correlation (os or wh)
  umeas   nbins x nprofs   measured  velocity (positive north, m/s)
  uship       1 x nprofs   ship      velocity (positive north, m/s)
      u   nbins x nprofs   ocean     velocity (positive north, m/s)
  umean       1 x nprofs   ref layer velocity (positive north, m/s)
  vmeas   nbins x nprofs   measured  velocity (positive south, m/s)
  vship       1 x nprofs   ship      velocity (positive south, m/s)
      v   nbins x nprofs   ocean     velocity (positive south, m/s)
  vmean       1 x nprofs   ref layer velocity (positive south, m/s)
      w   nbins x nprofs   vertical  velocity (up   , m/s)
  wmean       1 x nprofs   mean vertical velocity for each profile
      e   nbins x nprofs   error velocity (m/s)
  depth   nbins x nprofs   center depth for each bin and profile, positive down
     pg   nbins x nprofs   percent good
  pflag   nbins x nprofs   0 is unflagged, otherwise there is a code.  see www docs
nanmask   nbins x nprofs   suitable for dot-multiply with velocity

---- all diagnostics: only if called with (......'all')
              (some might not be present in any case)

   mps        1 x nprofs   ship speed, m/s
  fmeas   nbins x nprofs   measured velocity (positive ship's fwd direction, m/s)
  pmeas   nbins x nprofs   measured velocity (positive ship's port direction, m/s)
   fvel   nbins x nprofs   ocean velocity (positive ship's fwd direction, m/s)
   pvel   nbins x nprofs   ocean velocity (positive ship's port direction, m/s)
head_misalign 1 x nprofs   heading correction (best_head = heading - head_misalign)
scale_factor  1 x nprofs   scale factor applied to watertrack data

-------------------------------------------------------------------
data =  load_getmat(prefix)
input:
        prefix is the whole path up to the common base of the files
               or, use path as well as prefix

eg
        cd cruisedir
        data = load_getmat('allbins_');
eg
        data = load_getmat(fullfile(cruisedir, 'allbins_'));

The field "nanmask" holds the editing flags and is designed to turn bad
velocity data into NaNs.    Use as follows

u = data.u .* data.nanmask;
v = data.v .* data.nanmask;

---------------

depending on the version of "getmat", some of these fields may not be available

NOTE: (1) decimal day starts with zero, i.e. Jan 1 noon is 0.5 (not 1.5)
      (2) The following values are from the END of the ensemble
               decimal day, time
               longitude
               latitude
      (3) To get additional diagnostic fields, call with
               load_getmat('allbins_', 'all');