Table of Contents


fitsccd - read a (fits) image file from disk


fitsccd in=image out=fits [parameter=value]


fitsccd reads a (fits) image file from disk. The input is normally in fits(5NEMO) format, although certain foreign data formats can also be read in a limited form of raw mode (see FOREIGN FORMATS below). This effectively allows you to read formats such as MIRIAD, GIPSY, IRAF, ZODIAC and AIPS data, given the right parameters... The output will always be in standard image(5NEMO) format. Typicall you will need the keywords bitpix=,offset= and naxis=.

See old notes in ccdfits(1NEMO) how to process fits files from tape instead disk.


The following parameters are recognized in any order if the keyword is also given:
input file, must be fits(5) format unless mode=raw (see below) [no default].
output file, will be in image(5) format. If no output file give, some output about the WCS in fits is given, which can be used by other programs. Default: blank.
List of planes to be read from the fits file in case a cube was processed. If no list supplied, all are used. Planes count from 0 upwards. [Default: all].
If used, 4 integers in the range 1..NAXIS1 (for x) and 1..NAXIS2 (for y) are needed in the order xmin,ymin,xmax,ymax. It selects a box that needs to be fully contained in the fits XY plane. Default: none.
Integer that denotes the blocking factor with which file was written. It is the multiple of blocks of 2880 bytes. [default: 1].
Format mode of input file. Choises are fits and raw. In raw mode various relevant header parameters must be given using remaining keywords listed below. All keyword following this one are only effective in raw mode. [Default: fits].
Basic blocksize of a raw input file. The actual blocksize applied includes padding, and is hence blocksize*blocking. It is only used in raw mode. [default: 1].
Byte offset where the data starts in the file. It is only used in raw mode. [Default: 0]
FITS Bitpix used in conversion. Allowed are 16, 32 and -32, denoting 16 and 32 bit integers, and 32 bit IEEE floating point resp. It is only used in raw mode. [Default -32].
Size of all relevant axes in the data-"cube". It is only used in raw mode. No default!
Pixel separation. It is only used in raw mode. [Default: 2/nx,2/ny,2/nz]
Reference pixel. It is only used in raw mode. [Default: 0,0,0].
Value at reference pixel. It is only used in raw mode. [Default: 0,0,0].
Scaling constant from raw data to internal data. It is only used in raw mode. [Default: 1].
Offset constant from raw data to internal data. It is only used in raw mode. [Default: 0].
If a magic value from the input dataset needs to be replaced in the output image, give that value here. It is not yet possible to use the FITS BLANK keyword for this. [Default: not used].
Use relative coordinates instead of absolute coordinates? [false]
Old style (0) or new style with crpix-type header information (1) passed through. Default: 0

Foreign Formats

An AIPS dataset...

An IRAF dataset...

A GIPSY dataset uses offset=0 and bitpix=-32. Dataset name normally has extension ".IMAGE". Use the GIPSY program gds or header to find out relevant header parameters.

    % fitsccd in=10.IMAGE out=10.ccd mode=raw offset=0 bitpix=-32 ...

A MIRIAD dataset is converted using an offset of 4 bytes and bitpix of -32 into the dataset/image file. Various header parameters must be retrieved from the header using the Miriad program itemize:

    % fitsccd in=dat.mir/image out=dat.ccd mode=raw offset=4 bitpix=-32 ...

A ZODIAC dataset uses offset=0 and bitpix=-32. Dataset names are preceded with an underscore. For a zodiac image with

    % fitsccd in=_zim out=zim.ccd mode=raw offset=0 bitpix=-32 ...


The following example presents some parameters of each axis in the cube: (listed are naxis, crpix, crval, cdelt, xmin, xmax)
% fitsccd L1451.mom0.fits 
### nemo Debug Info: FITS file: Image size 1324 832
AXIS1: 1324 607 51.2543 -0.000277778    0.168194 -0.199306
AXIS2:  832 444 30.364   0.000277778   -0.122917  0.107917
AXIS3:    1   0 4079.75 -23565         -35347.5  -35347.5
notice the third axis is bogus in this example. The last two columns (xmin,xmax) include half the pixel, so mean to signify the edges of this cells, in units relative to the reference pixel (crpix), not in units of


Most packages in astronomy can write a fits file from their native format, here are some examples:
MIRIAD      fits in=cube.mir out=cube.fits op=xyout
CLASS/GILDAS    vectorts cube.fits from cube.lmv
CASA        exportfits("","cube.fits")
GIPSY        wfits


There are FITS image files stored as extensions to a dummy HDU. In those cases scanfits(1NEMO) must be used to extract the correct HDU and continue the data analysis, e.g.
    % scanfits abc.fits abc1.fits hdu=2
    % ccdfits abc1.fits abc1.ccd
Note that FITS files in NEMO do now allow the use of pipes.

See Also

ccdfits(1NEMO) , snapccd(1NEMO) , iofits(1NEMO) , scanfits(1NEMO) , image(5NEMO) , fits(5NEMO) , dd(1)


Peter Teuben


~/src/image/fits      fitsccd.c fitsccd.1

Update History

7-mar-90    V1.0 Written    PJT
1-oct-90    V3.0 New fitsio routines from Sault    PJT
11-oct-90    V3.1 Added ’raw’ mode      PJT
10-sep-91    V3.3 Added blank= keyword, more doc      PJT
18-may-99    V3.6 added support to read CD_i_j based files    PJT
21-mar-00    V3.6a fixed offset bug for raw cubes    PJT
7-nov-00    V3.7 added relcoords=    PJT
23-nov-04    V4.9 added axistype=  for new image format PJT
19-feb-2015    V5.1 added box= to select a subregion in XY    PJT

Table of Contents