Notes on the 'argos' decode program for PMEL/MBARI EqPac Program: argos Purpose: Decode data received via System ARGOS into its constituent sensor values. This program can operate in one of several modes. Depending on the command-line switch, it can recognize data sent from Service Argos (default mode), or decode data gathered with a local ARGOS receiver (-d or -n switches) Usage: argos [-b] [-c cfg_file] [-d] [-n] outfile -b prints messages with checksum errors -c specifies an alternative configuration file -d is for a local ARGOS receiver in diagnostic mode -n is for a local ARGOS receiver in normal mode By default, the program assumes that the data came from Service Argos, does not print messages with checksum errors, and uses configuration file /oasis/cfg/argos.cfg (see below). All the above can, of course, be modified in source code. Also note that the program takes input from standard-in and writes to standard-out. It was done this way to facilitate using it as a filter to process incoming mail. To use it on files, redirect stdin and stdout. Background This software is a derivative of software that is used on the OASIS project at MBARI for decoding data from a rather extensive and varied set of sensors (28 different types at last count), gathered via local packet radio. As such, it contains some baggage that would seem unneccessary. In particular, the source code has some remnants of routines for creating separate files for the various sensors, and carries with it a configuration file structure that's more complex than necessary. In the OASIS model, the configuration file contains actual calibration information only for the internal analog ports, and has pointers to other files for calibrations for other individual sensors. In the 'argos' software, the only other sensor with calibration information is the PRR Spectroradiometer, but for compatibility with our other software, we've kept this in a separate file. Source Files Makefile - The make file for this software. Type 'make argos' to make the software. The Makefile has rules for making all our other OASIS sotware as well, but you can ignore this, since you don't have those sources. There are several things in here that are particular to our environment of HP-UX, which you'll undoubtedly need to change. These include: -Aa flag to the compiler - this tells HP's cc to use ANSI C mode. -D_HPUX_SOURCE - this seems to be required in HP-land to bring in the ANSI and POSIX flavors of include files (e.g., stdio.h, time.h, etc). Shouldn't be necessary for other environments. -lM flag to linker - this brings in the math library for things like exponentials. And of course you'll probably have the tools (cc etc) in different locations. decode.h - This contains various definitions about data structures in the OASIS data stream. Mostly irrelevant to the data structures used for ARGOS data, but contains a couple of relevant definitions. argos.h - Contains data structure definitions for ARGOS data. Also has some stuff that was more relevant for encoding the data in the first place, but nevertheless very relevant. argos.c - The main source file. file.c - This source file was lifted from our 'extract' program, which takes the OASIS data stream (in uuencoded format) and creates numerous output files. Most of the code here is irrelevant to the 'argos' program. The only code used here is to read the configuration files. ac9.c - Only the decode_ac9_temp() function is used, since OASIS calculates the ratios for the spectral data before sending on ARGOS. spec.c - Decodes the spectroradiometer data. This file actually contains decode routines for three different types of spectroradiometers, only one of which is used for 'argos' -- decode_prr(). mbari/types.h - Contains data type definitions for MBARI's standard style of C, which this was written in. You'll get used to it. mbari/const.h - Some standard constants. Configuration Files argos.cfg - The main configuration file for this program. It contains calibration information about the analog ports in the OASIS can, and also points to the calibration file for the spectroradiometer. Analog calibrations are of the form: analog a b c d units analog is one of several keywords understood a b c d are calibration constants for the equation output = ((a * counts) + b) * c + d Units is the output units, as an ASCII string. specprr.m2 - The calibration file for the PRR-600 spectroradiometer. Format is described in the header to this file. Directory Structure For maximum compatibility, you'll want to name your base directory /oasis and your configuration directory /oasis/cfg. I also normally have directories /oasis/src, /oasis/argos (for data), etc. The only directory that's hard coded is the default configuration directory, /oasis/cfg. All other directory names are arbitrary. To change the name of the config directory, edit the three "*_DIR" defines in file.c. If you change its location, also edit file argos.cfg so that it points to the correct location of the specprr.m2 calibration file.