Next Previous Up Contents
Next: TOPCAT
Up: Table Tools
Previous: Table Tools
Note:
An alternative to tablecopy
is the experimental
tool tpipe
.
This is not yet fully stable or documented, but offers much more
powerful processing features than tablecopy
.
Tablecopy copies a table from any of the (input-) supported formats
into any of the (output-) supported ones.
This is pretty trivial, since all the hard work is done using the
generic I/O facilities described in Section 3.
The application is the main
method of
TableCopy
, though it might get
moved in future releases.
Invoking it with the "-help
" flag will print a usage message.
Assuming STIL is on your classpath:
% java uk.ac.starlink.table.TableCopy -help
Usage: TableCopy [-disk] [-debug] [-h[elp]] [-v[erbose]]
[-ifmt <in-format>] [-ofmt <out-format>]
<in-table> <out-table>
Auto-detected in-formats:
fits-plus
fits
votable
Known in-formats:
fits-plus
fits
votable
ascii
csv
wdc
Known out-formats:
jdbc
fits
fits-plus
fits-basic
votable-tabledata
votable-binary-inline
votable-fits-href
votable-binary-href
votable-fits-inline
text
ascii
csv
html
html-element
latex
latex-document
mirage
The flags and arguments have the following meaning:
-
-disk
- Causes temporary files to be used for backing store when table data
must be stored. Use this flag if you're getting an OutOfMemoryError
otherwise.
-
-debug
- Causes some logging and error reporting to be more verbose than
usual.
-
-verbose
- Causes progress to be reported on standard error during table reading,
and possibly some additional logging messages.
-
-help
- Prints a usage message (as above) to standard output.
-
-ifmt in-format
- Specifies the input format to be used
(one of the known in-formats listed above - matching is case-insensitive).
This flag can be used if you know what format your input table is in.
If it's omitted, then
an attempt will be made to detect the format of in-table
automatically, but this can only be done if it is in one of the
auto-detected formats (see Section 3.2. If it is not,
the program will exit with an error explaining which formats
were attempted.
-
-ofmt out-format
- Specifies the output format to be used
(one of the known out-formats listed above - matching is case-insensitive).
This flag can be used to determine what format to write to.
If it's omitted, then the output filename will be examined to try
to guess what sort of file is required (e.g. by looking at the extension).
If it doesn't look like any particular known type, the program will
exit with an error.
-
in-table
- Location of the input table. This is typically a filename or URL.
-
out-table
- Location of the output table. This is typically a filename to
write to. In some cases it can be the special string "-" to indicate
output to the standard output stream.
According to how you have downloaded STIL you may alternatively
be able to invoke it using the "tablecopy
" script.
Here are some examples of use:
- Copy a FITS table to a VOTable:
tablecopy stars.fits stars.xml
- Print the contents of the fifth <TABLE> element in a
compressed VOTable document at the end of a URL
to standard output in human-readable format:
tablecopy -ofmt text http://remote.host/data/vizier.xml.gz#4 -
- Convert a table from a gzipped comma-separated-value file
to plain ASCII format, using disk backing store if required,
writing the result to standard output.
tablecopy -disk -ifmt csv -ofmt ascii spec.csv.gz -
- Write the results of an SQL query on a MySQL database
to a FITS binary table:
java -Djdbc.drivers=com.mysql.jdbc.Driver
-classpath stil.jar:mysql-connector-java-3.0.6-stable-bin.jar
uk.ac.starlink.table.TableCopy
-ofmt fits
"jdbc:mysql://localhost/astro1#SELECT ra, dec, Imag, Kmag FROM dqc"
wfslist.fit
Next Previous Up Contents
Next: TOPCAT
Up: Table Tools
Previous: Table Tools
STIL - Starlink Tables Infrastructure Library
Starlink User Note
252
STIL web page:
http://www.starlink.ac.uk/stil/
Author email:
m.b.taylor@bristol.ac.uk
Starlink: http://www.starlink.ac.uk/