DTAG 4 – Preparing Metadata

The data format adopted by the biologging tools project has two components [Note]There are some immediate advantages to using this format:
– The Matlab/Octave/R animaltags tools and the DTAG tools directly support this format and make it easy to collect metadata as you perform calibration and processing steps on the data.
– NetCDF files can be exchanged without problems between Matlab, Octave, and R on Windows and Mac.
:

  1. The NetCDF file format for data. This is an international standard file format for scientific data which makes it easy to add general metadata and session-specific information.
  2. The definition of standard metadata structures for general and data-specific information. These structures are extensible – you can add whatever additional information you want to them – but the basic structures provide a guide as to what should be the minimum content.

Start by defining the researchers in your group and the species that your group works with, found in researchers.csv and species.csv. There are templates for these in the user directory in the animaltags tools [Note]Make sure to move researchers.csv and species.csv to another directory on your Matlab/Octave path so that they don’t get overwritten if you download a new copy of the animaltags tools. These files are used as a quick way for the Matlab/Octave tools to preset some of the fields in the metadata structure that will be made for each deployment.. The first column of each file contains the shortcuts that the tools will use to access specific lines from the files. For example: your initials in the first column of researchers.csv will be used to find your affiliation, contact information and data use preferences.

General Metadata

The general metadata for a deployment is called the info structure:

MATLAB
info = make_info(depid,'D4',depid(1:2),'xx')
R
ADD CODE HERE

This makes an info structure for a deployment of a D4 tag by a person with initials 'xx': either your initials or the initials of the data owner, who must be listed in researchers.csv. The first two letters of depid are used to lookup the species in species.csv [Note]If more than one species matches these two letters, you will be asked to choose which one you mean..

The fields in info will be preset to some relevant metadata. You can edit these fields to give extra information, e.g.:

MATLAB
info.dephist_deploy_method = 'glue' ; % or 'suction cups' if on a whale
info.dephist_deploy_locality = 'Husum, Germany' ;
info.project_name = 'UWE' ;
R
ADD CODE HERE

It may be easiest to make a script for each field trip and include all the fields that will remain the same throughout the trip, e.g.:

MATLAB
info = make_info(depid,'D4',depid(1:2),'sp');
info.project_name = 'ONR Tag Design';
info.project_datetime_start = '2018/06/04';
info.project_datetime_end = '2018/06/10';
info.dephist_deploy_locality = 'Cape Cod, Massachusetts';
info.dephist_deploy_method = 'suction cup';
info.dephist_deploy_location_lat = 41.7; % approx latitude of the tag deployment
info.dephist_deploy_location_lon = -69.9; % approx longitude of the tag deployment
R
ADD CODE HERE

Now you can generate a personalized info structure for a particular field trip by running your script in the Matlab/Octave command line.

Data-Specific Metadata

As well as the general metadata for a deployment, some sensor-specific metadata is needed with each type of sensor data as well, for defining its units, axes and sampling rate. The sens_struct function is a tool for making a sensor structure that is appropriate for each data type. The following instructions provide examples of how to produce data structures for sensors common to DTAG 4 devices, using the sensor cell array returned by d3readswv or d3readswv_commonfs [Note]Note that the order of the sensor channels may change if your tag was recording a different set of sensors (e.g., ECG, light). Use d3channames as described here to check. To find out what sensor types are supported by sens_struct, type sens_struct and hit the return key in the command window.:

For acceleration data and magnetometer data, which are usually in Channels 1-3 and 4-6:

MATLAB
A = sens_struct([X.x{1:3}],X.fs(1),depid,'acc');
M = sens_struct([X.x{4:6}],X.fs(4),depid,'mag');
R
ADD CODE HERE

For temperature data, usually found in Channel 7:

MATLAB
T = sens_struct(X.x{7},X.fs(7),depid,'temp');
R
ADD CODE HERE

Similarly, for depth data, assuming that the pressure sensor is in Channel 8:

MATLAB
P = sens_struct(X.x{8},X.fs(8),depid,'press');
R
ADD CODE HERE

To tell sens_struct that your data corresponds to a particular sensor type, give the first few letters of that sensor type in the last argument to sens_struct, e.g., 'acc' for acceleration.

You can find out what is in any of these structures by typing its name and the return key in the command window. For example, do this for P and you will see that it claims that the units are in mH2O (i.e., meters of depth), which is not true! The sensor structure fields are expecting that you will now calibrate the data, i.e., convert it from the raw tag units to the units that are listed in the structures [Note]The sensor structures are generated before applying the calibrations so that the calibration constants will get added to the sensor structures first, so that all the subsequent processing steps you apply to each sensor will be recorded..

Previous: Data Structure

Next: Calibration (Coming soon …)