STScI Logo

fgwrite fitsutil



fgwrite -- File archiver in FITS file


fgwrite input output


input [string]
List of filenames to be archive in the output FITS file.
output [string]
Output Multiextension FITS file.
verbose = yes
Print information about each input file processed.
group = ""
The value of the FITS keyword FG_GROUP. It applies to all the FITS extensions in the MEF file. Its default value is the name of the current working directory.
types = ""
Select input filenames by file type. The possible types are:
	t: text
	b: binary
	d: directory
	s: symbolic link
	f: single FITS file
	m: Multiple Extension FITS file (MEF)

The default value is to select all types.
exclude = ""
Exclude input filenames by file type. The file type are the same as above. Default action is to not exclude any type.
phu = yes
Creates a Primary header unit (PHU). This is just a dummy header unit with no data to comply with a regular MEF structure file. A value of no will create a MEF file without a PHU.
checksum = no
Computes CHECKSUM and DATASUM. The default value is no. If the value is yes the task creates the keyword CHECKSUM with the checksum for the entire FITS unit as value and DATASUM keyword with the checksum of the data portion of the unit as value. For a description and algorithm that calculates these values please look in: ""
toc = no
Creates a table of content in the PHU. There is one line descriptor per input file. Here is a simple example:

Counter  offset size type level filename
  1       1      1   ft   1     m.c
  2       3      1   fb   1     t.o

- 'offset' is the beginning of the extension header in units
   of 2880 bytes.
- 'size' is the size of the input file in units of 2880 bytes.
- 'type' is the input filename type. The 2 character pnemonic
   describes the kind of input file; 'f' is for FOREIGN FITS 
   Xtension type and the second character is the type define 
   above in 'types' parameters description. If the input file
   is a MEF file the 'type' is one character: 'i' IMAGE, 't'
   TABLE, 'b' BINTABLE, 'f' FOREIGN and 'o' for OTHER FITS 
   XTENSION types.
- 'level' is the directory depth in which the input file is located.
- 'filename' is the input filename.


Fgwrite is a program to encapsulate one file into a wrapper FITS Xtension called FOREIGN. If the input list has more than one input file, a MEF (Mutiple Extension FITS) file is created with one FOREIGN extension per input file.

To accurately describe the input file within the FOREIGN extension, a set of FG keywords is created in the extension header in such a way that an extraction of the file is possible with all its properties restore.

The FG keyword present in the FOREIGN extension header are:

The group name that associates all of the elements of the MEF file. The group name is arbitrary and is assigned by the user when the file group is written.
The filename of the file associated with the current extension. The maximun filename lenght is 67 characters. For an extension of type foreign where the file type is a directory, FNAME is the name of the directory.
The physical file type (text, binary, directory, or symlink), or for native FITS extension, the FITS type (FITS or FITS-MEF). In the case of FITS-MEF, the EHU is the first element of a MEF group. No count of the number of extensions is given, rather, the MEF group consist of all subsequent extensions until an EHU is encountered which starts a new file.
The directory nesting level. All of the files in a directory are at the same level. Level 1 is the root directory level.
The size in bytes of the input disk file.
The file mode as a string (rwx-rwx-rwx).
The file UID (user ID) as the file owner name string
The file GID (group ID).
The file creation GMT time.
The file modification GMT time.


1) Creates a MEF file mef.fits with the default setup.

cl> fgwrite file1.for,test.c,obs.log mef.fits

2) Create an archive of the current directory and its subdirectories excluding any symbolic links.

cl> fgwrite . ../zzd_arc.fits exclude=s checksum=yes

The ckecksum option is set, so the keyword CHECKSUM, DATASUM and CHECKVER will be present in all unit headers.




Source Code · Search Form · STSDAS