; MOD3D
;---------------------------------------------------------------
;! Computes a 3D CC model from a set of facets
;# TASK UV IMAGING MODELING CALIBRATION
;-----------------------------------------------------------------------
;;  Copyright (C) 2020
;;  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
;-----------------------------------------------------------------------
MOD3D     LLLLLLLLLLLLUUUUUUUUUUUU CCCCCCCCCCCCCCCCCCCCCCCCCCCCC
MOD3D     Task to make a 3D CC file from a set of facets
INNAME                             Input UV file name (name)
INCLASS                            Input UV file name (class)
INSEQ             0.0     9999.0   Input UV file name (seq. #)
INDISK                             Input UV file disk unit #
IN2NAME                            Cleaned map name (name)
IN2CLASS                           Cleaned map name (class)
IN2SEQ            0.0     9999.0   Cleaned map name (seq. #)
IN2DISK                            Cleaned map disk unit #
INVERS           -1.0    46655.0   CC file version #.
NMAPS             0.0     4096.0   No. maps to use for model.
OUTNAME                            Output model file name
OUTCLASS                           Output model file name
OUTSEQ           -1.0     9999.0   Output model file name
OUTDISK                            Output model file disk
BCOMP                              First CLEAN comp to sub.
                                   1 per field.
NCOMP                              Last CLEAN comp to sub.
                                   to use (0 => all)
FLUX                               Lowest CC component used.
BLC                                Bottom left corner of 1st
                                   Clean image -> model image
TRC                                Top right corner -> model
----------------------------------------------------------------
MOD3D
Task:  Computes the 3D position of all the Clean components in a set
       of Clean image facets wrt the coordinate in the UV file.
       It writes out a sub-image of the 1st Clean image and a 3D
       CC file with all selected Clean components ready for DFT
       subtraction.
            Model images made with both values of IMAGR's DO3DIMAG
       option are handled correctly, as are multi-scale images.  Set
       NMAPS = NFIELD * NGAUSS.
            MOD3D works only on single-source files.
Adverbs:
  INNAME.....Input UV file name (name).    Standard defaults.
  INCLASS....Input UV file name (class).   Standard defaults.
  INSEQ......Input UV file name (seq. #).  0 => highest.
  INDISK.....Disk drive # of input UV file.0 => any.
  IN2NAME....Model map name (name).      Standard defaults.
  IN2CLASS...Model map name (class).     Standard defaults.
  IN2SEQ.....Model map name (seq. #).    0 => highest.
  IN2DISK....Disk drive # of model map.  0 => any.
  INVER......CC file ver. number.          0 => highest.
  NMAPS......Number of image files to use for model.  For multi-scale
             models, set NMAPS = NFIELD * NGAUSS to include the Clean
             components of the extended resolutions.  If more than one
             file is to be used, the NAME, CLASS, DISK and SEQ of the
             subsequent image files will be the same as the first file
             except that the LAST 3 or 4 characters of the CLASS will
             be an increasing sequence above that in IN2CLASS.  Thus,
             if INCLASS='ICL005', classes 'ICL005' through 'ICLnnn'
             or 'ICnnnn', where nnn = 5 + NMAPS - 1 will be used.  Old
             names (in which the 4'th character is not a number) are
             also supported: the last two characters are '01' through
             'E7' for fields 2 through 512.  In old names, the highest
             field number allowed is 512; in new names it is 4096.
  OUTNAME....Output model image file name (name).   Standard defaults.
  OUTCLASS...Output model image file name (class).  Standard defaults.
  OUTSEQ.....Output model image file name (seq. #). 0 => highest unique.
  OUTDISK....Disk drive # of output model image file.  0 => highest
             with space
  BCOMP......The first clean component to process. One value is
             specified for each field used.
  NCOMP......Number of Clean components to use for the model, one
             value per field.  If all values are zero, then all
             components in all fields are used.  If any value is not
             zero, then abs(NCOMP(i)) (or fewer depending on FLUX and
             negativity) components are used for field i, even if
             NCOMP(i) is zero.  If any of the NCOMP is less than 0,
             then components are only used in each field i up to
             abs(NCOMP(i)), FLUX, or the first negative whichever
             comes first.  If abs(NCOMP(i)) is greater than the number
             of components in field i, the actual number is used.  For
             example
                   NCOMP = -1,0
             says to use one component from field one unless it is
             negative or < FLUX and no components from any other
             field.  This would usually not be desirable.
                   NCOMP = -1000000
             says to use all components from each field up to the
             first negative in that field.
                   NCOMP = -200 100 23 0 300 5
             says to use no more than 200 components from field 1, 100
             from field 2, 23 from field 3, 300 from field 5, 5 from
             field 6 and none from any other field.  Fewer are used if
             a negative is encountered or the components go below
             FLUX.
  FLUX.......Only components > FLUX in absolute value are used in the
             model.
  BLC........Bottom left corner of first Clean image to be written
             to the output image.
  TRC........Top right corner of first Clean image to be written
             to the output image
----------------------------------------------------------------
