%---------------------------------------------------------------------
% Purpose: To demonstrate how to retrieve metadata using various functions
%          More details: http://wiki.neptunecanada.ca/display/help/CodeRunner+Help 
% Modify Date/Author:  20101201, R.Jenkyns
%---------------------------------------------------------------------
 
% First, you  need to know the deviceid for the instrument of interest
 
% If you do not know your deviceid, refer to the Device Listing at 
% http://dmas.uvic.ca/DeviceListing, and select the device to get a 
% list of sensors and their ids.
% For example, for the Aanderaa Optode at Folger Deep:
deviceid=23215;
 
% Let's assume you wanted to get metadata for the current time
% By default, these functions return details for the current time. 
% An alternative time is an optional function argument.

% Retrieve sensors (includes measured and derived variables) associated with this instrument
sensors=getDeviceSensorIDs(deviceid)

% Once you have the sensorid, you can then get more information about that sensor. 
% For example, for one of the sensorids identified above:
sname=getSensorName(sensors(2))
sunits=getSensorUnitAndType(sensors(2))
 
% Retrieve sampling period of device for a given time
sp=getSamplePeriod(deviceid)

% Retrieve coordinates and associated site information
[lat,lon,depth,deviceHeading,sitename,locationname,siteid,locationid]=getSite(deviceid)