; WRTDISK
;---------------------------------------------------------------
;! writes images / uv data w extensions to tape in FITS format
;# PROCEDURE FITS UV IMAGE-UTIL
;-----------------------------------------------------------------------
;;  Copyright (C) 2002, 2008, 2010
;;  Associated Universities, Inc. Washington DC, USA.
;;
;;  This program is free software; you can redistribute it and/or
;;  modify it under the terms of the GNU General Public License as
;;  published by the Free Software Foundation; either version 2 of
;;  the License, or (at your option) any later version.
;;
;;  This program is distributed in the hope that it will be useful,
;;  but WITHOUT ANY WARRANTY; without even the implied warranty of
;;  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;  GNU General Public License for more details.
;;
;;  You should have received a copy of the GNU General Public
;;  License along with this program; if not, write to the Free
;;  Software Foundation, Inc., 675 Massachusetts Ave, Cambridge,
;;  MA 02139, USA.
;;
;;  Correspondence concerning AIPS should be addressed as follows:
;;         Internet email: aipsmail@nrao.edu.
;;         Postal address: AIPS Project Office
;;                         National Radio Astronomy Observatory
;;                         520 Edgemont Road
;;                         Charlottesville, VA 22903-2475 USA
;-----------------------------------------------------------------------
WRTDISK   LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
WRTDISK: procedure to write maps or uv data to disk
                                   type RUN WRTPROCS first!
INDISK          0.0         9.0    UV file disk drive #
NFILES                             First catalog number
NCOUNT                             Last catalog number
DATAOUT
                                   Logical directory name
FORMAT          0.0         3.0    tape format:   0 => 3.
                                       1 for 16-bit integer
                                       2 for 32-bit integer
                                       3 for 32-bit IEEE
                                         floating point
BLOCKING        0.0        10.0    tape blocking factor (<= 10)
----------------------------------------------------------------
WRTDISK
Type: Procedure
Use:  WRTDISK writes a FITS file to disk, looping through many
      catalog numbers as specified.  The disk file will have a
      standard name (DISK##C####) which can be read back into
      AIPS using READISK.  WRTDISK uses FITLD (see HELP FITLD
      for details).  Remember to load this procedure typing RUN
      WRTPROCS before trying to run it (by typing WRTDISK).
Adverbs:
  INDISK.....The input disk unit #.
  NFILES.....The catalog number of the first file to be written
             out. 0 => 1
  NCOUNT.....The catalog number of the last file to be written
             out. 0 => number in NFILES
  DATAOUT....The name of a directory in which to put files.
             The name is limited to 48-characters and must be
             in the form
                  <logical>
              or
                  <node>::<logical>
              where <node> is the remote computer name,
              <logical> is the environment variable (logical
              name) for the disk area in which the file.
              <node> is usually omitted when the file is local
              to the current computer.
  FORMAT.....Code to tell what format to be used in writing the
             main uv or image data portion of the file as
                   1 for 16-bit integers - only images
                   2 for 32-bit integers - only images
                   3 for 32-bit IEEE floating point - images and
                     required for uv data
             Default: 0 => 3.
             If you want to import your FITS data into another
             system, make sure that it is able to read the
             format that  you have selected.
  BLOCKING...Code to tell what blocking factor to be used in
             writing the whole file
             Default: 0 => 10.
             Considerations: (a) blocking factor <= 10.
                (b) AIPS releases prior to 15APR87 can read
                    only FORMATs 1 and 2.  Do not use blocking
                    if you may go to an earlier release of AIPS.
                    This same consideration also applies to
                    most other FITS readers around the world.
                (c) Blocking is ignored when writing to disk
                    rather than tape.
                (d) Larger blocks use fewer I/O operations
                    making tape reads and writes more efficient.
----------------------------------------------------------------
WRTDISK:            Procedure to run FITTP to write files to disk
                    with a standard file name that can be read back
                    into AIPS using READISK.
Documenter:         Amy Mioduszewski
Related Programs:   FITTP, READISK, FITDISK, WRTPROCS

To load the procedure type RUN WRTPROCS.  This must be done before
running the procedure (by typing WRTDISK).

WRTDISK will write a file to the directory set in DATAOUT.
This must be a logical variable set before AIPS is started.
The file that is written will have an automatically generated
name which is a standard format which can be used to be read
back into AIPS with READISK.  This standard format is
DISKddCcccc, where the dd and the cccc are numbers.  The dd
is specified in the INDISK input and the cccc is the AIPS
catalog number of the file.  If NFILES and NCOUNT are different
then the catalog numbers NFILES through NCOUNT are looped
through.

Example:

If you set:
INDISK 1
NFILES 98
NCOUNT 101
DATAOUT 'FITS'

Then WRTDISK will write files in catalog numbers 98-101 on
disk 1 to directory $FITS with names:
DISK01C0098
DISK01C0099
DISK01C0100
DISK01C0101

You can then use READISK to read them back into AIPS.
