CRaTER -- SData


SData -- Retrieves archived data from the CRaTER SOC L2 data base


    SData P|S|H [-c] [-h] [-H] [-o filename] [-r] \
             [-s start_time] [-S stop_time] [-v] \
             [-m name1 name2 ... namej]


     P    primary science
     S    secondary science
     H    analog housekeeping
     -c   generates output in Comma-Separated-Value format
     -h   prints this help message
     -H   prints available database field names
     -i   interval over which data is to be extracted (in decimal hours)
     -I   interval over which data is to be extracted (in decimal orbits) [1]
     -m   extract only following mnemonics/field names
          NB this must be the last argument provided 
     -o   write data to the specified filename [STDOUT]
     -r   dumps data in "rtlm -a | calcurve" format (LRO seconds)
     -R   dumps data in "rtlm -a -t | calcurve" format (local)
     -Ru  dumps data in "rtlm -a -t -u | calcurve" format (UTC)
     -s   start_time in form "YYYY-MM-DD HH:MM" UTC [now-interval]
     -S   stop_time  in form "YYYY-MM-DD HH:MM" UTC [now]
     -v   verbose display


The program connects to the SOC science MySQL Level 2 data base and extracts data over the time period requested. The data table -- primary science, secondary science, or analog housekeeping -- must be specified, but all other flags are optional. By default all information contained in the selected table is output in Tab-Separated-Value format. Note that in "data base" format -- as opposed to the optional "rtlm" formats -- the first line output contains the field names for the selected data; the values follow on successive lines.

Absolute start and stop times may be specified. One may also specify only one of these, together with a data interval given in units of either decimal hours or decimal lunar orbits (nominally 113 minutes). The default data interval is a single orbit. If neither start nor stop time is given, the default stop time is NOW with the start time calculated from the data interval, either commanded or itself the default value.

The HH:MM information in start/stop times optional, 00:00 is the default.


The following command fragments are provided for those needing manual interaction with the SQL data base. Note that case is note significant in SQL and that all SQL commands must end with a semicolon.

     %unix  mysql -h -u crater -pcrater
     mysql> use crater;
     mysql> show tables;             # we have L2_hk, L2_sec, L2_pri
     muysql> describe L2_pri
     #     Seconds, Fract, Time, Index, Ampl1, Ampl2, Ampl3, Ampl4, Ampl5, Ampl6
     mysql> describe L2_sec          # etc
     mysql> describe L2_hk           # etc
     mysql> select time, ttelescope from L2_hk where month(time) = 21;
     mysql> select * from L2_hk where time > "2009-12-16 21:47" - interval 1 hour
     mysql> select * from L2_hk where time > "2008-0-0" and time < now


This program requires Perl version 5.8.0 or above with the and modules available to enable communication with the SOC MySQL.

Not all fields in the SOC tables are retrieved by this program; those which the author deemed either obsolete or of limited utility have been omitted.

Formatting with the various -r flags is a close, but not exact, analog to an rtlm output. In particular, additional information fields defined in the SOC level 2 products are added to the output.


High Level programs


Low Level programs

rtlm, calcurve


Bob Goeke

RCS Information

$Id: SData,v 2.6 2009/06/16 18:42:57 goeke Exp goeke $

Copyright: Massachusetts Institute of Technology 2009