ncfile = read_cats(fname,depid) % Matlab & Octave

Read data files from a CATS data Logger. This function generates a netCDF file in the current working directory containing the variables in the data file including:

  • A Accelerometer data structure
  • M Magnetometer data structure
  • G Gyroscope data structure
  • T Temperature sensor data structure
  • P Pressure sensor data structure
  • LL Light Level (lux)
  • info Information structure for the deployment
Input var Description Default value
fname fname is the file name of the CATS csv file including the complete path name if the file is not in the current working directory or in a directory on the path. The .csv suffix is not needed. N/A
depid depid is a string containing the deployment identification code assigned to this deployment, for example, m16_209a. N/A
Output var Description Units
ncfile This functions generates a netCDF file called 'depid' containing the following variables: A Accelerometer data structure, M Magnetometer data structure, G Gyroscope data structure, T Temperature data structure, P Pressure sensor data structure, LL Light Level sensor data structure, info Information structure for the deployment N/A

% % Example:

% fn = read_cats('cats_test_sample','mn16_209a') % loadnc(fn) % % The workspace should now contain variables A, M, G, T, P, L and info % % each of which is a structure. %

Warning: CATS loggers can produce very large csv files which are slow to prrocess. This function is optimised for speed and memory use so will tolerate large files. But processing could be slow.

Matlab & Octave

fn = read_cats(fn,depid)
loadnc([depid '_raw'])

The workspace should now contain variables A, M, G, T, P, L and info each of which is a structure. e.g.

Matlab output

A = 

  struct with fields:

                  data: [1172115Ă—3 double]
              sampling: 'regular'
         sampling_rate: 32
    sampling_rate_unit: 'Hz'
                 depid: 'mn12_186a'
         creation_date: '24-Jul-2017 12:40:14'
               history: 'read_ll3m'
                  name: 'A'
             full_name: 'Acceleration'
           description: 'triaxial acceleration'
                  unit: '1'
             unit_name: 'counts'
            unit_label: 'counts'
           column_name: 'x,y,z'
                 frame: 'tag'
                  axes: 'FRU'
                 files: '20120704-57537-Mn-XXXX-U-NoName-Acceleration…'

Octave output

If your output looks like this in Octave:

A =

  scalar structure containing the fields:
    data =
       2355   2071   1923
       2340   2052   1940
       2324   2058   1961
 -- less -- (f)orward, (b)ack, (q)uit

You need to set struct_levels_to_print(0), and it should now list all the first level structure names, see below. For details and information about the Sensor Data structure.

A =

  scalar structure containing the fields:
    data: 1172115x3 matrix
    sampling: 1x7 sq_string
    sampling_rate: 1x1 scalar
    sampling_rate_unit: 1x2 sq_string
    depid: 1x9 sq_string
    creation_date: 1x20 sq_string
    history: 1x9 sq_string
    name: 1x1 sq_string
    full_name: 1x12 sq_string
    description: 1x21 sq_string
    unit: 1x1 sq_string
    unit_name: 1x6 sq_string
    unit_label: 1x6 sq_string
    column_name: 1x5 sq_string
    frame: 1x3 sq_string
    axes: 1x3 sq_string
    files: 1x150 sq_string 

R Last modified: 22 July 2017

  • tagwiki/tools/io/read_cats.txt
  • Last modified: 2017/07/29 14:56
  • by funkyfinwhale