Package uk.ac.starlink.ttools.example
Class AllWiseTableBuilder
java.lang.Object
uk.ac.starlink.ttools.example.AllWiseTableBuilder
- All Implemented Interfaces:
uk.ac.starlink.table.TableBuilder
- Direct Known Subclasses:
AllWiseTableBuilder.Count,AllWiseTableBuilder.NoCount
TableBuilder implementation for the ASCII files comprising the AllWise
data release.
At time of writing these files are available from
http://irsadist.ipac.caltech.edu/wise-allwise/.
The files are formatted as pipe-separated ASCII, and optionally compressed.
Note that reading seems to be considerably faster for the gzip than
for the bzip2 form of the input files (though the gzip ones are a bit
bigger).
For FITS output (though not colfits) two passes through the input ASCII file are required, the first one (much faster) just to count the rows. There are therefore two variants of this input handler, one which does a row count and one which does not. If the row count is known, it would be possible to adapt this handler so you tell it the row count up front and only one pass is required.
- Since:
- 6 Feb 2014
- Author:
- Mark Taylor
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInput handler which reads AllWise ASCII files and does count the rows first.static classInput handler which reads AllWise ASCII files and does not count the rows first. -
Constructor Summary
ConstructorsConstructorDescriptionDefault mode constructor.AllWiseTableBuilder(String name, boolean preCount) Configurable constructor. -
Method Summary
Modifier and TypeMethodDescriptionbooleancanImport(DataFlavor flavor) static longcountLines(uk.ac.starlink.util.DataSource datsrc) Counts the lines in the ASCII file at the given location.booleanlooksLikeFile(String location) uk.ac.starlink.table.StarTablemakeStarTable(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storagePolicy) voidstreamStarTable(InputStream in, uk.ac.starlink.table.TableSink sink, String pos)
-
Constructor Details
-
AllWiseTableBuilder
public AllWiseTableBuilder()Default mode constructor. -
AllWiseTableBuilder
Configurable constructor.- Parameters:
name- handler namepreCount- true to return a table that knows its row count
-
-
Method Details
-
canImport
- Specified by:
canImportin interfaceuk.ac.starlink.table.TableBuilder
-
getFormatName
- Specified by:
getFormatNamein interfaceuk.ac.starlink.table.TableBuilder
-
looksLikeFile
- Specified by:
looksLikeFilein interfaceuk.ac.starlink.table.TableBuilder
-
makeStarTable
public uk.ac.starlink.table.StarTable makeStarTable(uk.ac.starlink.util.DataSource datsrc, boolean wantRandom, uk.ac.starlink.table.StoragePolicy storagePolicy) throws IOException - Specified by:
makeStarTablein interfaceuk.ac.starlink.table.TableBuilder- Throws:
IOException
-
streamStarTable
- Specified by:
streamStarTablein interfaceuk.ac.starlink.table.TableBuilder
-
countLines
Counts the lines in the ASCII file at the given location.- Parameters:
datsrc- data source- Returns:
- number of '\n'-terminated lines in the file
- Throws:
IOException
-