Package nom.tam.fits
Class AsciiTableHDU
- java.lang.Object
-
- nom.tam.fits.BasicHDU<T>
-
- nom.tam.fits.TableHDU<AsciiTable>
-
- nom.tam.fits.AsciiTableHDU
-
- All Implemented Interfaces:
FitsElement
public class AsciiTableHDU extends TableHDU<AsciiTable>
FITS ASCII table header/data unit
-
-
Field Summary
Fields Modifier and Type Field Description private static IFitsHeader[]
KEY_STEMS
The standard column stems for an ASCII table.private static java.util.logging.Logger
LOG
-
Fields inherited from class nom.tam.fits.BasicHDU
BITPIX_BYTE, BITPIX_DOUBLE, BITPIX_FLOAT, BITPIX_INT, BITPIX_LONG, BITPIX_SHORT, isPrimary, myData, myHeader
-
-
Constructor Summary
Constructors Constructor Description AsciiTableHDU(Header h, AsciiTable d)
Create an ASCII table header/data unit.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
addColumn(java.lang.Object newCol)
Add a column to the table without any associated header information.protected IFitsHeader[]
columnKeyStems()
static AsciiTable
encapsulate(java.lang.Object o)
void
info(java.io.PrintStream stream)
Print out some information about this HDU.static boolean
isData(java.lang.Object o)
static boolean
isHeader(Header header)
Check that this is a valid ascii table header.boolean
isNull(int row, int col)
static Data
manufactureData(Header hdr)
Create a Data object to correspond to the header description.static Header
manufactureHeader(Data d)
void
setNull(int row, int col, boolean flag)
Mark an entry as null.void
setNullString(int col, java.lang.String newNull)
Set the null string for a column.-
Methods inherited from class nom.tam.fits.TableHDU
addRow, deleteColumnsIndexOne, deleteColumnsIndexOne, deleteColumnsIndexZero, deleteColumnsIndexZero, deleteRows, deleteRows, findColumn, getColumn, getColumn, getColumnFormat, getColumnMeta, getColumnName, getColumns, getElement, getNCols, getNRows, getRow, setColumn, setColumn, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnMeta, setColumnName, setCurrentColumn, setCurrentColumn, setElement, setRow
-
Methods inherited from class nom.tam.fits.BasicHDU
addValue, addValue, addValue, addValue, addValue, addValue, addValue, addValue, canBePrimary, card, getAuthor, getAxes, getBitPix, getBlankValue, getBScale, getBUnit, getBZero, getCreationDate, getData, getDummyHDU, getEpoch, getEquinox, getFileOffset, getGroupCount, getHeader, getInstrument, getKernel, getMaximumValue, getMinimumValue, getObject, getObservationDate, getObserver, getOrigin, getParameterCount, getReference, getSize, getTelescope, getTrimmedString, getTrimmedString, read, reset, rewrite, rewriteable, saveReplaceCard, setPrimaryHDU, write
-
-
-
-
Field Detail
-
LOG
private static final java.util.logging.Logger LOG
-
KEY_STEMS
private static final IFitsHeader[] KEY_STEMS
The standard column stems for an ASCII table. Note that TBCOL is not included here -- it needs to be handled specially since it does not simply shift.
-
-
Constructor Detail
-
AsciiTableHDU
public AsciiTableHDU(Header h, AsciiTable d)
Create an ASCII table header/data unit.- Parameters:
h
- the template specifying the ASCII table.d
- the FITS data structure containing the table data.
-
-
Method Detail
-
encapsulate
public static AsciiTable encapsulate(java.lang.Object o) throws FitsException
- Parameters:
o
- the array of object to create the ASCII table- Returns:
- a ASCII table data structure from an array of objects representing the columns.
- Throws:
FitsException
- if the table could not be created.
-
isData
public static boolean isData(java.lang.Object o)
- Parameters:
o
- object representing the data- Returns:
- true if this data is usable as an ASCII table.
-
isHeader
public static boolean isHeader(Header header)
Check that this is a valid ascii table header.- Parameters:
header
- to validate.- Returns:
true
if this is an ascii table header.
-
manufactureData
public static Data manufactureData(Header hdr) throws FitsException
Create a Data object to correspond to the header description.- Parameters:
hdr
- the header to create the data for- Returns:
- An unfilled Data object which can be used to read in the data for this HDU.
- Throws:
FitsException
- if the Data object could not be created from this HDU's Header
-
manufactureHeader
public static Header manufactureHeader(Data d) throws FitsException
- Parameters:
d
- data to create a header for- Returns:
- a created header to match the input data.
- Throws:
FitsException
- if the header could not b e created
-
addColumn
public int addColumn(java.lang.Object newCol) throws FitsException
Description copied from class:TableHDU
Add a column to the table without any associated header information.- Overrides:
addColumn
in classTableHDU<AsciiTable>
- Parameters:
newCol
- the new column information. the newCol should be an Object[] where type of all of the constituents is identical. The length of data should match the other columns. Note: It is valid for data to be a 2 or higher dimensionality primitive array. In this case the column index is the first (in Java speak) index of the array. E.g., if called with int[30][20][10], the number of rows in the table should be 30 and this column will have elements which are 2-d integer arrays with TDIM = (10,20).- Returns:
- the number of columns in the adapted table
- Throws:
FitsException
- if the operation failed
-
columnKeyStems
protected IFitsHeader[] columnKeyStems()
- Specified by:
columnKeyStems
in classTableHDU<AsciiTable>
- Returns:
- the stems of the keywords that are associated with table columns. Users can supplement this with their own and call the appropriate deleteColumns fields.
-
info
public void info(java.io.PrintStream stream)
Description copied from class:BasicHDU
Print out some information about this HDU.- Specified by:
info
in classBasicHDU<AsciiTable>
- Parameters:
stream
- the printstream to write the info on
-
isNull
public boolean isNull(int row, int col)
- Parameters:
row
- row index of the elementcol
- column index of the element- Returns:
true
if an element is null
-
setNull
public void setNull(int row, int col, boolean flag)
Mark an entry as null.- Parameters:
row
- row index of the elementcol
- column index of the elementflag
- set to null or not
-
setNullString
public void setNullString(int col, java.lang.String newNull)
Set the null string for a column.- Parameters:
col
- the column indexnewNull
- the String representing null
-
-