fedithead
Richard J. Mathar
Fitsheaderkeywordbatcheditor
|
Scan an ASCII file (CSV format) and convert this into a binary FITS table. Given a readable CSV file in the file system, the program generates a FITS file which contains a single extension in the binary FITS table format.
The name of the FITS file is chosen by replacing the .csv extension of the CSV source file by the extension .fits.
Each line (but the first) of the CSV file becomes a row in the FITS table. The comma-separated first line in the CSV file contains the names of the columns to be used in the FITS columns.
The syntax in overview:
csv2Fits [-h] [-F fieldsep] typstr infile.csv
The option -h just emits a reminder for the syntax of the call. The same reminder is given if the two mandatory command line arguments are missing.
The option -F followed by a single character changes the field separator definition in infile.csv. The default is the comma.
The first command line argument is a concatenation of one or more letters of the set {a, d, f, b, i, k, j}. There are exactly as many letters as columns in the CSV file, and from left to right, each letter denotes the FITS type of the associated column of the CSV file. The Makefile shows the example
csv2Fits aaaaadafafbbaa csv2FitsXmpl.csv
with 5 ASCII strings in the first 5 columns, one double value in the 6th column etc.
To convert the SAO star catalogue of http://heasarc.gsfc.nasa.gov/FTP/heasarc/dbase/dump/heasarc_sao.tdat.gz into FITS file, (i) create an ASCII heasarc_sao.csv file by deleting the lines up to and including the <DATA> line, deleting the last <END> line, (ii) insert a first line
NAME|RA|PM_RA|PM_RA_ERR|RA_EPOCH|DEC|PM_DEC|PM_DEC_ERR|DEC_EPOCH|POS_ERR|LII|BII|PG_MAG|V_MAG|SPECTYP|REF_VMAG|REF_STARNUM|REF_PG_MAG|REF_PM|REF_SPECTYP|REMARKS|REF_SRC_CAT|NUM_SRC_CAT|DM|HD|HD_COMPO|GC|PM_RA_FK5|PM_DEC_FK5|CLASS at the place of the former <DATA> line, and (iii) call csv2Fits -F '|' addbdddbddddddabbbbbbbjaaaaddi heasarc_sao.csv
[in] | argc | The number of command line arguments. |
[in] | argv | The vector of options, arguments of the options and free-standing arguments |