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

public class AllWiseTableBuilder extends Object implements uk.ac.starlink.table.TableBuilder
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
  • Constructor Details

    • AllWiseTableBuilder

      public AllWiseTableBuilder()
      Default mode constructor.
    • AllWiseTableBuilder

      public AllWiseTableBuilder(String name, boolean preCount)
      Configurable constructor.
      Parameters:
      name - handler name
      preCount - true to return a table that knows its row count
  • Method Details

    • canImport

      public boolean canImport(DataFlavor flavor)
      Specified by:
      canImport in interface uk.ac.starlink.table.TableBuilder
    • getFormatName

      public String getFormatName()
      Specified by:
      getFormatName in interface uk.ac.starlink.table.TableBuilder
    • looksLikeFile

      public boolean looksLikeFile(String location)
      Specified by:
      looksLikeFile in interface uk.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:
      makeStarTable in interface uk.ac.starlink.table.TableBuilder
      Throws:
      IOException
    • streamStarTable

      public void streamStarTable(InputStream in, uk.ac.starlink.table.TableSink sink, String pos)
      Specified by:
      streamStarTable in interface uk.ac.starlink.table.TableBuilder
    • countLines

      public static long countLines(uk.ac.starlink.util.DataSource datsrc) throws IOException
      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