[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fitstab2pg



 

I wrote this a couple years ago and nearly forgot about it.

This little program will covert any FITS format table file
into a Postgres DBMS table.  It will look at the FITS header
to figure out what kind and format data is in the file and
build an analogous Postgres table, then do the data import.
It can process an entire directory of files at once.  I used it
to import the entire set of ADC CDROMS plus the Tycho and 
Hipparcos data sets which are available in FITS format.
Once you've done this matching TASS data to ADC data can be
automated with a few SQL commands.  I wrote this using Linux
but just re-built it under Solaris 8.

I had to go get it off the tass-surveyorg web site.  If I forgot
about this I figured some of you may have too.

The program prints out the following text if you give it the
--help option or if you give it an invalid option.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

# ./fitstab2pg --help
usage: fitstab2pg [option ...] [FitsFileName ...]

  -H, --help             Will print this message
  -V, --version          Will print the version ID
  -d, --dbname=NAME      Name of the database to be used
  -h, --host=HOSTNAME    Name of machine running Postgres server
  -p, --port=PORT        Port to use to connection to Postgres server
  -N, --nocreate         Disable SQL CREATE of table
  -m, --msglevel=NUMBER  0=quiet, 1=verbose, 2=debug
  -P, --prepend=P_STRING table = P_STRING+basename(fitsfilename)+
  -A, --append=A_STRING          A_STRING

Following the options may be any number of filenames.  These must
contain valid FITS format ASCII or binary format tables.
A URL may be specified in place of a filename.  The data will be
brought in over the network using the specified protocol
Column and row filtering may be applied as the FITS table is processed.
The filter criteria allows quite a bit of processing to be peformed as 
data are read.  The result SQL table can be almost any reasonable 
function of the input FITS table. 
See the CFITSIO User's Guide, Version 2, section 4.2 for details.

fitstab2pg will create a Postgresql table for each FITS table.  One
table per FITS file.  Column names and data types are presevered