; FITDISK
;---------------------------------------------------------------
;! writes images / uv data w extensions to tape in FITS format
;# PROCEDURE FITS UV IMAGE-UTIL
;-----------------------------------------------------------------------
;;  Copyright (C) 2001-2003
;;  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
;-----------------------------------------------------------------------
FITDISK   LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
FITDISK: procedure to write maps or uv data to disk.
                                   type RUN WRTPROCS first!
INNAME                             UV file name (name)
INCLASS                            UV file name (class)
INSEQ              0.0      9999.0 UV file name (seq. #)
INDISK          0.0         9.0    UV file disk drive #
OUTFILE
                                   Logical directory name
DOSTOKES       -1.0         1.0    > 0 => Convert to true
                                      Stokes (Formal I)
               ******** Changed 12/2/93 ***********************
DONEWTAB       -1.0         1.0    >0 standard FITS binary
                                      tables (15JAN94 or later)
                                   <= 0 AIPS FITS binary tables
               ************************************************
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)
----------------------------------------------------------------
FITDISK
Type: Procedure
Use:  FITDISK write a FITS file to disk with the same name as the
      of the file in AIPS.  FITDISK uses FITTP (see HELP
      FITTP for details).  The AIPS name is used with internal
      blanks changed to '_' and trailing blanks removed.
      Remember to load this procedure by typing RUN WRTPROCS
      before trying to run it (by typing FITDISK).
Adverbs:
  INNAME.....The input image name (name).  Standard defaults.
  INCLASS....The input image name (class). Standard defaults.
  INSEQ......The input image name (seq. #). 0 => any if DOALL
             is true, 0 => highest if DOALL is false.
  INDISK.....The input disk unit #. 0=> search all disks in
             order for file meeting the other criteria.
  OUTFILE....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.
              The file name will be the AIPS file name with
              the internal ' ' changed to '_' and trailing
              blanks omitted.
  DOSTOKES...True (> 0) means to convert to true Stokes from
             the normal VLA polarizations.  Not recommended for
             now, since it currently uses "formal I".
  DONEWTAB...> 0 => use new FITS binary extension file
             standard for writing all tables.  These tables are
             agreed FITS standards in an informal sense only and
             can only be read by 15JAN94 or later AIPS.
             <= 0 => use FITS binary tables format probably only
             known to AIPS from 1987 or so on.
             ************* NOTE that this is a new use of this
             adverb as of December 2, 1993. ********************
  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.
----------------------------------------------------------------
FITDISK:            Procedure to run FITTP to write files to disk
                    with automatically produced file names based
                    on there AIPS names.
Documenter:         Amy Mioduszewski
Related Programs:   FITTP, WRTDISK, WRTPROCS

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

FITDISK will write a file to the directory set in OUTFILE.
This must be a logical variable set before AIPS is started.
The file that is written will have an automatically generated
name which is the AIPS name with internal blanks converted to
'_' and trailing blanks omitted.

Example:

> OUTFI 'FITS'
> INNAME 'BM103 H'
> INCLASS 'UVDATA'
> INSEQ 2

will write a file named BM103_H.UVDATA.2 to the $FITS directory.

WARNING:  There is a CLRTEMP at the end of the procedure to clear
the array holding the variables.  This will NOT effect most people
who use FITDISK on its own or in one line "FOR" loops.  However,
this may prevent FITDISK being used in more complicated constructs.
