idlastro / Web Socket Procedures: WRITE_IPAC_TABLE

[Source code]

NAME
WRITE_IPAC_TABLE
PURPOSE
Write an IPAC table from IDL structures.
EXPLANATION
Writes an IPAC table to a file from IDL structures.  If
the table_col_info structure has certain pre-defined tag names 
(see below), those column headers will be written to the table.
Allows selection of columns.
CALLING SEQUENCE
write_ipac_table, in_struct, outfile, [table_col_info=table_col_info,
table_hdr=table_hdr, select_columns=select_columns, /short_format, 
/exact_format, format=format]
INPUTS
IN_STRUCT -- an IDL structure containing the data.  
OUTFILE -- string containing the name of the output file
OPTIONAL INPUT
TABLE_COL_INFO - A structure with table column headers
        in tags starting with "HEADER": HEADER_Col_Names, 
        HEADER_Col_Names_Orig, HEADER_Col_Types_Orig, and, 
        if present, HEADER_Data_Units and HEADER_Null_Values.
TABLE_HDR - A string array with whatever comment and keyword
        lines precede the column headers.
SELECT_COLUMNS - A string array with the data tags of select
        columns to output, from tag_names(in_struct).
        NOTE: user-selected FORMAT keys must match number selected.
/SHORT_FORMAT -- if set, uses IDL "print" formats.
/EXACT_FORMAT -- if set, floating point and double precision
                  data are written with formats of (e16.9) and
                  (e24.17), respectively.  This option takes
                  precedence over the /SHORT_FORMAT option.
FORMAT -- A user supplied format statement that will
                  override the other formating options.  This
                  is given in the usual IDL form, e.g. '(f13.6)'.
OUTPUTS
On completion, an ascii table will be written to the outfile.
PROCEDURES USED
GET_DATE
NOTES
The default format is IDL's '(f)', ('d'), etc.
The procedure will write out comment lines (starting with
"\") if TABLE_HDR is present. Will write out data unit and null
value lines if the TABLE_COL_INFO structure has tag names
"HEADER_DATA_UNITS" and "HEADER_NULL_VALUES" respectively.  If 
"HEADER_COL_NAMES_ORIG" and "HEADER_COL_TYPES_ORIG" are present, 
these will be the column names and types.  Currently forces 
"RA" and "DEC" to lower case.
EXAMPLE
Write a table with 2 real columns selected with a custom format:
  write_ipac_table,info,'out.txt',table_col_info=table_col_info,
    table_hdr=table_hdr,select_columns=['RA','DEC'],
    format='(f12.6,f12.6)'
MODIFICATION HISTORY
Initial version - H. Teplitz, IPAC September 2010 
Output original column names/types if present - T. Brooke, IPAC Jun 2013
Print out filename - TYB Jan 2016
Re-do structures to separate out data; allow selection of
columns - TYB Aug 2017