This is a server
routine for FITSIN/FITSDIN, hence the large argument list. It packages up the operations required to
create and name an NDF; copy the FITS data to the NDF’
s data array, performing a data conversion if
requested and flagging blank data with the standard bad-pixel values; generate the other components:
title, units, WCS, axis structure and the FITS extension. For group-format FITS data, a series of NDFs
are created, one per group, each with a generated filename. A null NDF may be given
and this routine will exit, but permit the calling routine to continue to the next FITS file.
CALL FTS1_NDF( HEADER, BFPNTR, RCPNTR, AUTO, PNNDF, MEDIUM, MD, VMS,
LENDIA, SIZE, NDIM, DIMS, BPV, FMTCNV, FMTIN, FMTOUT, IEEE, BADPIX, BLANK,
BSCALE, BZERO, DARRAY, NONSDA, GCOUNT, PCOUNT, MXPARM, PTYPE, PSCALE, PZERO,
FILROO, LOGHDR, FD, CFN, SUBFIL, GEXTND, NCARD, HEADER, SCARD, NENCOD, ENCODS,
BLKSIZ, ACTSIZ, OFFSET, CURREC, NEXT, PARAMS, STATUS )
HEADER(
) = CHARACTER
80 (Given)
The FITS headers in 80-character records.
BFPNTR = INTEGER (Given)
Pointer to BUFFER( BLKSIZ ) =
CHARACTER
( 1 ) (Given and Returned). The buffer containing the block of data. This is only
read when %OFFSET does not equal %ACTSIZ, i.e. there are some non-header data
within it.
RCPNTR = INTEGER (Given)
Pointer to RECORD( 36 ) = CHARACTER
( 80 ) (Given
and Returned). The buffer to hold the current FITS record.
AUTO = LOGICAL (Given)
If true the
processing should be done in automatic mode, where the user is not prompted for file names, since these
are generated from %FILROO with the sub-file or group numbers appended.
PNNDF = CHARACTER
(
) (Given)
The name of the parameter by which the filename of the output NDF will be obtained.
MEDIUM =
CHARACTER
( )
(Given)
The medium containing the FITS file. Currently supported are ’
DISK’
for a disk file, and ’
TAPE’
for standard magnetic tape.
MD = INTEGER (Given)
The tape or file descriptor depending
on the value of %MEDIUM.
VMS = LOGICAL (Given)
If true, the operating system is VMS or RSX.
If false, the operating system is assumed to be UNIX.
LENDIA = LOGICAL (Given)
If true, the
machine uses Little Endian byte order (bytes swapped compared to FITS). LENDIA is
ignored when VMS = .TRUE..
SIZE = INTEGER (Given)
The number of elements in the
data array.
NDIM = INTEGER (Given)
Dimensionality of the NDF.
DIMS( NDIM ) =
INTEGER (Given)
The dimensions of the NDF.
BPV = INTEGER (Given)
The number of
bytes per data value.
FMTCNV = LOGICAL (Given)
If true, format conversion from the
integer FITS data to the real output data array is required. This is ignored when BADPIX is
false (which should be the case for IEEE floating-point data).
FMTIN = CHARACTER
(
) (Given)
The HDS format of the data in the FITS file. It will be ignored if there is no format conversion.
FMTOUT =
CHARACTER
( )
(Given)
The destination HDS format of the data array in the output file.
IEEE = LOGICAL (Given)
If true the FITS data are in IEEE floating-point format.
BADPIX = LOGICAL (Given)
If true the
data-blank was defined in the FITS header. It will be ignored if the data are in IEEE format.
BLANK = INTEGER (Given)
The data-blank value equivalent to the bad-pixel flag. It
should be ignored if %BADPIX is false.
BSCALE = REAL (Given)
The scale factor of the
FITS integer data for their conversion to the true floating-point values.
BZERO = REAL
(Given)
The offset of the FITS integer data for their conversion to the true floating-point
values.
DARRAY = LOGICAL (Given)
If true there is a data array present if the FITS file.
NONSDA = LOGICAL (Given)
If true the data array is not standard, i.e. in group format. It is
ignored if %DARRAY is false.
GCOUNT = INTEGER (Given)
The number of groups in
the file.
PCOUNT = INTEGER (Given)
The number of parameters per group in the
file.
MXPARM = INTEGER (Given)
The maximum number of group parameters, and
the dimension size for the various group arrays.
PTYPE( MXPARM ) = CHARACTER
(
)
(Given)
The type (descriptive name) of each group parameter.
PSCALE( MXPARM )
= DOUBLE PRECISION (Given)
The scale factors of the group parameters so that the
parameters may be converted to the true floating-point values.
PZERO( MXPARM
) = DOUBLE PRECISION (Given)
The offsets of the group parameters so that the
parameters may be converted to the true floating-point values.
FILROO = CHARACTER
(
)
(Given)
The rootname of the output NDF. The suffix Gn, where n=%NG, is appended
in group-format mode to generate the filename. Otherwise in automatic mode the NDF
filename is the rootname.
LOGHDR = LOGICAL (Given)
If true there is a log file open
and records of the output file names will be written to it.
FD = INTEGER (Given)
The
file descriptor for the log file. It is ignored if %LOGHDR is false.
CFN = CHARACTER
(
)
(Given)
The number on the tape of the FITS file being processed if MEDIUM is ’
TAPE’
, or the
input disk-FITS filename if MEDIUM is ’
TAPE’
.
SUBFIL = INTEGER (Given)
The
number of the sub-file/extension within the current FITS file being processed.
GEXTND
= LOGICAL (Given)
If true there may be extensions in the FITS sub-file.
NCARD =
INTEGER (Given)
The number of header 80-character cards in the header. Note the size
of the structure will not do because it will normally have unfilled elements at the end,
because of the way the work space is obtained in quanta. It should be the sum of the headers
and the group parameters.
SCARD = INTEGER (Given)
The number of the card from
where the searches of the header will begin. This is needed because the headers make
contain a dummy header prior to an extension.
NENCOD = INTEGER (Given)
The
number of AST encodings supplied in ENCODS.
ENCODS( NENCOD ) = CHARACTER
(
)
(Given)
The user’
s preferred AST encodings. If NENCOD is zero, then this is ignored, and an
intelligent guess is made as to which encoding to use. The encoding determines which FITS headers
are used to create the NDF WCS component.
BLKSIZ = INTEGER (Given)
The maximum
blocksize and dimension of the tape/disk buffer.
ACTSIZ = INTEGER (Given and Returned)
The actual block size (a multiple of the FITS record length of 2880 bytes). It is only an
input argument for %MEDIUM = ’
DISK’
.
OFFSET = INTEGER (Given and Returned)
The number of bytes in the current block already interpreted.
CURREC = LOGICAL
(Given and Returned)
If true the current FITS record is to be used immediately, i.e. it has
alrady been read from tape or disk into %RECORD.
NEXT = LOGICAL (Returned)
This
qualifies the status. If true it instructs the calling routine to go to the next FITS sub-file, and if
status is bad the calling routine should flush the error messages.
PARAMS( MXPARM
BPV )
= BYTE (Returned)
Numerical values of parameters associated with a group-format array.
STATUS
= INTEGER (Given and Returned)
Global status value.