Appendix B. Using Campbell Ingest Separate from an ISS Installation

The ISS ingestor for the Campbell serial data stream can be used separately from the ISS directory tree. First check it out from CVS and build it, something like this:

    
cvs co -d cam_ingest iss/src/ingest/cam_ingest
cd cam_ingest
cvs co -d util iss/src/util
cd util
zmkmf
make
cd ..
zmkmf
make EXTRA_LOAD_FLAGS='util/libiss.a' install

Here's a typical invocation for the ISS, taken from the /iss/etc/init.d/surface script:

    datafile=cr10data.txt
    fields=skip:pres:tdry:rh:wspd:wdir:year:jd:hhmm:secs:skip:vwspd:skip:wdev:skip:skip:vis:netrad:ir:skip:rain:batt:tbox
    lat=40.0
    lon=-100
    alt=1500

    cam_ingest -l /dev/ttyS0 -b 9600 -z surface_met -f "$fields" -d "$download" -t $datafile -w "$lat:$lon:$alt" -p

Where surface_met is the name of the Zebra platform to which surface measurements will be stored. The -t option tells the ingestor to keep overwriting datafile with the latest values read from the Campbell; for example, for use by other software like the sounding system. The fields string contains the field names to assign to data values in the order read from the Campbell. The site location is passed in the lat, lon, and alt parameters, where the units of altitude are meters above mean sea level, latitude is in decimal degress north, and longitude is in decimal degrees east (west longitudes are negative). Finally, download is the filepath to the Campbell program which should be uploaded on startup. Run cam_ingest without any options to see usage info.

In the ISS example above, this is the field list passed to the ingestor:

skip:pres:tdry:rh:wspd:wdir:year:jd:hhmm:secs:skip:vwspd:skip:wdev:skip:skip:vis:netrad:ir:skip:rain:batt:tbox

This field list expects the campbell to send 23 fields in each sample. Several will be ignored (skipped), and the rest will be ingested with the given name. Some of the names are known by the ingestor and will be given full field descriptions including units, others are not and will only be stored by name. Edit this line to reflect exactly what the campbell is configured to send and to select which fields will actually be ingested. The list of known field names and their full specifications can be seen in the usage info by running cam_ingest with no options.

On startup the ingestor opens the given serial port, handshakes with the Campbell, uploads a program, if any, and then continuously waits for data. As data samples are received, they are written to the Zebra datastore as netcdf files, or to standard output, or both.

If serial communications are working, there will be a long series of lines output from the ingestor like this:

R:
S:
R:
S:

The S lines are data sent by the ingestor, and the R lines received from the Campbell. So if the R lines appear, then the campbell is talking back and being received over the serial line. If there are no data from the Campbell, then something is wrong. Check the power to the Campbell box, or check that the receive/transmit plugs on the fiberoptic cable are not swapped.

Sometimes, when the ingestor first starts up on the ISS, it prints an error message like 'only 1 of 23 fields found', but only for the first few campbell samples. After that the campbell seems to settle down and the ingestor starts happily parsing and spitting out data.

For the ISS, someone proficient with Campbells builds a 'download file' which contains calibration information and other stuff, and then cam_ingest uploads that file to the Campbell before ingesting begins. If the Campbell will be programmed through other means, then the download file and -d option are not needed.

When using cam_ingest to store to a zebra platform, there needs to be a suitable platform definition for the Zebra datastore config file, ds.config. Here's an example:

platform surface
	organization	scalar
	filetype	netcdf
	daysplit
endplatform

Ordinarily, to continuously ingest surface data, cam_ingest runs from another process which restarts it when it fails, since otherwise it just aborts on errors or timeouts. However, in general cam_ingest has been very reliable.