hmi_import_egse_lev0
[Stanford Application Programs]


Detailed Description

Import ground test level0 FITS files into DRMS.

This program is used only for processing of pre-launch data.

The program copies a lev0 FITS file into a matching DRMS record, setting the DRMS keywords from the FITS file. Additional keywords are written into both the DRMS and FITS headers so the lev0 data can be accessed as a stand-along FITS file or via DRMS segment read calls.

The program can accept either RAL EGSE generated lev0 FITS files or CIF/DCHRI HS-bus lev0 files produced from the telemetry via the SSIM. The CIF or RAL mode is set in the CONFIG command line arg and saved in the keyword CONFIG.

 Outline of this program 
  Init: 
  Get command line flags and args
  Create a new output record into DRMS struct
  Read input lev0 FITS file into DR struct.
    Set some keywords from command line info
  Loop through output keywords
    begin
    Get DRMS name and FITS shortname from rec
    if shortname in input file, use it
       else if shortname in alias list
        if one of aliases in input file, use it
        else set default value in FITS file
    if keyword is prime key T_OBS
    if RAL mode
        Use filename for T_OBS
    else
        look in keyword named in timekey command line arg
        but if not found default to SHS keyword.
    if keyword is prime key FSN
    get FSN from possibly aliased keyword
    if keyword is TELEM_T set telem time value from SHS
    else
    for all other keywords copy value from
    FITS to DRMS if present, if not present
    set FITS value from DRMS default values from JSD.
    if RAL mode then fix the PCU position values.
    End of loop 
  if CIF mode then
    begin
    get test config info from auxillary file
    call external program (set_config_by_time.csh) to update config info in
       an ancillary dataseries.  Pass the FSN and T_OBS to this program.
    Then open the newly made record in the ancillar series and copy
    the configuration keywords into both DRMS and FITS headers.
    set mechanism values via index keywords using tables.
    end of CIF special code
  Save new FITS file with all keywords in segment with original filename
  Close DRMS record 
  Done

Synopsis:
      import_egse_lev0 [-RhrvDRIVER_FLAGS] in=<lev0_FITS_file>] [out=<lev0_DRMS_series>] 
                       [fsn_key=<fsn_keyword>] [time_key=<obs_time_keyword>] 
                       [keymap=<alias_table>] [dsds=<egse_lev0_DSDS_name>]
Flags:
-R: Add 2 to HCAMID if exposure > 0.
-h: Print usage message and quit.
-r: RAL EGSE data expected.
-v: Verbose - noisy.
Driver flags:
module
Parameters:
in Specifies the EGSE produced level0 FITS file. If it was produced by the RAL Camera EGSE the -r flag should also be specified.
out This is the destination dataseries for the level 0 data. For HMI is will be hmi_ground.lev0. It must have both FSN and T_OBS as prime keys and of type DRMS_TYPE_INT and DRMS_TYPE_TIME respectively. No record filter should be specified. The keywords description is used for the shortname that will be used for the FITS keyword name. Thus each keyword must have at least the shortname as the first word in the description in the JSD file. For convenience the keymap entries are also present as comments.
fsn_key The name of the keyword in the input FITS file that should be used for the Filtergram Sequence Number, FSN. The default is FSN for CIF mode and HSQFGSN for RAL mode.
time_key The name of the keyword to be used for the observation time T_OBS target keyword. The default is HOBITSEC. If the time_key defined keyword is not present, then SHS will be used. At least one must be present.
keymap The optional name of an alias file. The alias file should contain one line for each target shortname that may have an alternate in the input lev0 file. Up to 9 aliases may be provided. The first word (white space delimited) on the line is the target. Subsequent words are possible aliases. A maximum of 256 alias lines are allowed.
dsds If present the value of this keyword is stored in the DSDS_SRC keyword to record the source of the input data. It can be a "prog:level:series" name or simply the filename of the input data.


Defines

#define MAX_KEYMAPS   10
#define MAX_KEYS   256
#define FSN_CAM_ID_FIXED   50630
#define FSN_HSHIEXP_FIXED   163852
#define FSN_TAI_FIXED   1000000
#define TABLE_PATH   "proj/lev0/apps/data/"
#define UPDATE_CONFIG_PROG   "proj/lev0/scripts/hmi_ground/set_config_by_time.csh"
#define CONFIG_SERIES   "hmi_ground.lev0_config"
#define NOT_SPECIFIED   "***Not Specified***"
#define DIE(msg)   {fprintf(stderr,"$$$$ %s: %s\n",module_name,msg); return 1;}

Variables

ModuleArgs_t module_args []
 Global DRMS-module structure representing the default command-line arguments for a DRMS module.
char * module_name = "import_egse_lev0"
 Global DRMS-module string providing the name of the module.


Variable Documentation

ModuleArgs_t module_args[]

Initial value:

{ 
  {ARG_STRING, "in", NOT_SPECIFIED, "Path to DSDS hmi_ground lev0 file"},
  {ARG_STRING, "out", NOT_SPECIFIED, "drms series for lev0 data"},
  {ARG_STRING, "fsn_key", "HSQFGSN", "Filtergram number keyword name"},
  {ARG_STRING, "time_key", "HOBITSEC", "Filtergram time keyword name"},
  {ARG_STRING, "t_obs", NOT_SPECIFIED, "Filtergram time override"},
  {ARG_STRING, "keymap", NOT_SPECIFIED, "Keyword mapping table"},
  {ARG_STRING, "dsds", NOT_SPECIFIED, "DSDS source dataset name"},
  {ARG_FLAG, "r", "0", "RAL EGSE data expected"},
  {ARG_FLAG, "R", "0", "Re-ingest from DRMS lev0 file"},
  {ARG_FLAG, "h", "0", "Print usage message and quit"},
  {ARG_FLAG, "v", "0", "verbose flag"},
  {ARG_END}
}
Global DRMS-module structure representing the default command-line arguments for a DRMS module.

module_args, a global array of ModuleArgs_t structures, provides a standard mechanism for declaring the parameters expected to be used by a module along with their types and default values, if any. module_args must be declared in every module. The elements of the module_args array are parsed and compared with arguments supplied to the module from the command line or other invocation to produce a CmdParams_t structure (cmdparams) through which their values are available through the params_get suite of functions.

The module_args declarator requires at least one element, which must be of type ARG_END (which is 0, so an empty initializer as shown in the synopsis is acceptable). Any array elements following the ARG_END element are ignored.

Although the default value (and range, if applicable) is supplied as a character string, it will be interpreted according to the declared type of the argument. Each element of cmdparams, except those of type ARG_VOID, must have a name field. Arguments of type ARG_INT, ARG_FLOAT, ARG_DOUBLE, and ARG_STRING should be self-explanatory. Arguemts of type ARG_FLAG are expected to have single-character names and to be associated with logical binaries, with a default value of FALSE (0); they can be set on the command line via the -X construct (where X is the name of the element to be set to TRUE). ARG_TIME is a special case of ARG_DOUBLE, whose default or assigned values are interpreted by sscan_time (q.v.). ARG_VOID is reserved for use with undeclared arguments supplied on the command line; it should not be used for declared arguments in the module_args list.

The types ARG_INTS, ARG_FLOATS, and ARG_DOUBLES are used for parameters that can be arrays of arbitrary length. The values must be supplied as comma separated sets enclosed within matched delimiting pairs of either brackets [], braces {} or parentheses () (unless there is only one value in the array, in which case the delimiters are optional). The total number of elements in the array is returned as the added parameter name_nvals, and the value for the nth element (counting from 0) as name_n_value. For example, a @ module_args element declared as:

{ARG_FLOATS, "lat", "[0.0, 5.0, 10.0]", "", ""},

would return 3 for params_get_int (params, "lat_nvals") and the value 5.0 for params_get_float (params, "lat_1_value"). The number of array values supplied at run time need not match the number in the default; indeed there is no necessity of setting any default value at all, just as with other types of arguments.

ARG_NUME is a special type of argument representing an enumeration class. It makes use of the module_args->range field, which must be a comma-separated list of strings. The value returned is an integer coresponding to the order number of the range element matching the supplied value. For example, a module_args element declared as:

{ARG_NUME, "color", "green", "", "red, yellow, green, blue"},

would return 2 for params_get_int (params, "color"). A failure occurs if the value supplied does not match anything in the range; the type is designed especially for use with driver programs that can provide menus of options, such as CGI forms.

ARG_DATASET and ARG_DATASERIES are special cases of ARG_STRING reserved for names of DRMS dataset specifications or series names in an environment where the database can be queried for possible values; they are not currently treated differently from any other type of string argument.

ARG_NEWDATA does not appear to be implemented; ARG_NUMARGS is reserved for internal use by the Fortran interface and should not be used.

To summarize, ModuleArgs_t->type must have one of the following values:

ARG_INT parameter is to be interpreted as type int
ARG_FLOAT parameter is to be interpreted as type double
ARG_DOUBLE parameter is to be interpreted as type double
ARG_TIME parameter is to be interpreted as type double, with a conversion from standard date-time string formats to a standard reference epoch
ARG_STRING parameter is to be interpreted as type char*
ARG_FLAG the parameter is (ordinarily) a single-character named one which can take the value of 0 or 1. The default value, if present, should be 0; as the command-line flag specifier can only set its parameter values to 1; however, it is better to leave the default value empty, so that the cmdparams_exists function can be used in the code.
ARG_NUME the parameter value is string-compared with the members of the module_args->range list, and replaced with the string representation of the number corresponding to the order number of the (first) matching token in the list; its value is subsequently to be interpreted as type int. Basically equivalent to type enum
ARG_INTS (not yet implemented)
ARG_FLOATS (not yet implemented)
ARG_DOUBLE synonymous with ARG_FLOATS
ARG_VOID (not yet implemented)
ARG_END signals the end of the parsed argument list. Elements may follow in the declaration, but will be ignored. Since ARG_END is defined as 0, an empty (null) member serves the same purpose.

The module_args->description is intended to be used only by the front-end handler for documentation, such as when the command is invoked with a -H help flag, or in CGI web forms.

Bug:
Range inspection is limited to arguments of type ARG_NUME and ARG_FLOAT.
See also:
module cmdparams.h sscan_time

Definition at line 175 of file hmi_import_egse_lev0.c.


Generated on Tue Jul 15 19:31:54 2008 for JSOC by  doxygen 1.5.4