Using FITS table data in GMT

Hello all,

I have been trying to get table data out of a FITS format binary file but only seem to be able to retrieve the variables and no positional data (coordinates). The following works to get the variables based on the header info:

gmtconvert file.fits -bi3fw > file-out.dat
This generates a 3 column file of the variables (I Stokes, Q Stokes and U Stokes) in this case.

The header looks like this:

XTENSION= ‘BINTABLE’ / binary table extension
BITPIX = 8 / 8-bit bytes
NAXIS = 2 / 2-dimensional binary table
NAXIS1 = 12 / width of table in bytes
NAXIS2 = 50331648 / number of rows in table
PCOUNT = 0 / size of special data area
GCOUNT = 1 / one data group (required keyword)
TFIELDS = 3 / number of fields in each row
COMMENT -------------------------------------------------------------
COMMENT Products from SMICA component separation method
COMMENT -------------------------------------------------------------
COMMENT Further details in the Planck Legacy Archive and Explanatory Supplement
COMMENT -------------------------------------------------------------
COMMENT *** Planck params ***
EXT-NAME= ‘COMP-MAP’ / Extension name
AST-COMP= 'CMB ’ / Component
COORDSYS= ‘GALACTIC’ / Coordinate system
POLCCONV= 'COSMO ’ / Polarization convention
ORDERING= 'NESTED ’ / Healpix ordering
NSIDE = 2048 / Healpix Nside
METHOD = 'SMICA ’ / Cleaning method (Commander/NILC/SEVEM/SMICA)
BAD_DATA= -1.63750000E+30 / Bad pixel value
DATE = ‘2018-04-10’ / Creation date
TTYPE1 = ‘I_STOKES’ / I intensity map
TFORM1 = '1E ’ / data format of field: 4-byte REAL
TUNIT1 = 'K_CMB ’ / map unit
TTYPE2 = ‘Q_STOKES’ / Q polarisation map
TFORM2 = '1E ’ / data format of field: 4-byte REAL
TUNIT2 = 'K_CMB ’ / map unit
TTYPE3 = ‘U_STOKES’ / U polarisation map
TFORM3 = '1E ’ / data format of field: 4-byte REAL
TUNIT3 = 'K_CMB ’ / map unit

Does anyone have experience of extracting coordinate data from FITS table files? I know the data plots out in the range (0-360, -90 - +90) as defined in a FITS viewer (e.g. Aladin -

Have tried xyz2grd with the -Z option but the data seem to be randomly positioned rather than a regular grid, and as such surface is the best option, assuming the coordinates can be extracted!

Any pointers would be great.


You can only use this if the input file is a raw binary file. If it has a format plus header etc… this cannot work. Your chance is if ogr2ogr is capable of converting the FITS file into a ASCII format.