1 Language
                            GREG2\ Language Summary

    CONVERT     : Converts data in the X,Y buffer in the current projection.
    ELLIPSE     : Draws an ellipse in User coordinate.
    EXTREMA     : Shows minimum and maximum of the Regular Grid array.
    GRID        : Plots a Grid in (A,D) with steps As and Ds (in degrees).
    LEVELS      : Sets the contour levels.
    MASK        : Masks part of a regular grid map.
    MEAN        : Computes statistics on map values.
    PERSPECTIVE : Makes a 3-D perspective of the Regular Grid array.
    PLOT        : Plots a SIC image variable to the window.
    POLYGON     : Defines a polygon for use by MASK and MEAN.
    PROJECTION  : Defines a spherical projection.
    RANDOM_MAP  : Creates a Regular Grid array from randomly sampled data.
    RESAMPLE    : Resamples the Regular Grid array on a different Grid.
    RGDATA      : Reads/creates a 2-D map and put it in the Regular Grid array.
    RGMAP       : Draws contour lines for the Regular Grid array.
    STRIP       : Extracts a strip from the Regular Grid array.
    WEDGE       : Draws wedges.
    WRITE       : Saves an internal buffer on a file.
2 NEWS

    See HELP GREG1\ News for information
1 CONVERT
        [GREG2\]CONVERT  A0  D0  [Angle] [/TYPE Ptype] [/UNIT Unit] [/SYSTEM
    EQU|GAL [Epoch]] [/VAR Var_X Var_Y]

    This command assumes that the X,Y buffers (or the  1-D  variables  Var_X
    and  Var_Y if option /VAR is used) contain data in the specified projec-
    tion (or in absolute spherical coordinates if Ptype is NONE) in the giv-
    en  angular  unit  (Degree Minute Seconds or the default Radian), in the
    specified System (GALACTIC or EQUATORIAL with default epoch 2000.0,  de-
    fault is current system) and converts them to the current system, as de-
    fined by SET SYSTEM, and projection, as defined by  command  PROJECTION.
    Note  that  the projected coordinates are always natural units (i.e. the
    equivalent of Radians after projection). There is no provision for "hid-
    den" parts which are treated exactly as visible ones.

    A0  D0  are Hours and Degrees if the input system is EQUATORIAL, Degrees
    otherwise.

    CAUTION: when using variables, the Var_X and Var_Y arrays  MUST  BE  RE-
    AL*8, and WRITEABLE (see HELP DEFINE).
1 ELLIPSE
        [GREG2\]ELLIPSE Major [Minor [Position_Angle]] [/BOX X Y] [/USER X Y
    [code]] [/ARC Theta_min Theta_max] [/FILL [Colour]] [/HATCH [Ipen]  [An-
    gle] [Separ] [Phase]]

    This  command draws at current pen position (or at position (X,Y) if op-
    tion /BOX or /USER is present) an ellipse of given semi-major axis,  se-
    mi-minor axis, (default Minor = Major) and Position_Angle (default 0 de-
    grees).

    Major, Minor are in User Coordinates, but Position_Angle  is  ALWAYS  in
    DEGREES, TRIGONOMETRIC ORIENTATION. X and Y are in User Coordinates (op-
    tion /USER) or in Physical Units (centimeters from the bottom  left  box
    corner,  option  /BOX).  Major, Minor, X and Y, can be 1-D arrays of any
    size, provided the sizes are the same. Position_Angle can  be  indiffer-
    ently an array, a number, or omitted.

    The  code suboption in the /USER option, if present, can be any of `SEC-
    ONDS', `MINUTES', `DEGREES', `RADIANS' (in which case the X and Y  coor-
    dinates  are  taken  to  be in the corresponding unit) or `ABSOLUTE' (in
    which case X and Y are taken as absolute coordinates,  usually  exprimed
    in sexagesimal format). The presence of the code suboption is valid only
    if a PROJECTION and a SYSTEM (EQUATORIAL or GALACTIC) are both  defined.

    A  portion of the ellipse can be drawn by specifying the boundary angles
    in option /ARC (in degrees, trigonometric sense from  the  position  an-
    gle). Not compatible with the array mode.

    Option  /FILL  [Colour]  will  fill  the ellipse(s), with the current or
    specified colour. Option /HATCH will fill them with parallel lines (pen,
    angle,  separation and phase can be customized, defaults are current, 45
    degrees, 0.25 cm and 0 respectively); in this case  the  contour(s)  are
    not  drawn.  If  the /ARC option is also present, the filled area is the
    corresponding pie part, not the subtended arc.

    This command is useful for plotting beam  sizes,  uncertainty  ellipses,
    pie charts, etc.
1 EXTREMA
        [GREG2\]EXTREMA  [/BLANKING  Bval  Eval]  [/PLOT] [/COMPUTE] [/LOCAL
    PLOT|TERMINAL|FileName]

    Computes and shows the minimum and maximum values of  the  Regular  Grid
    array:  shows XMIN,XMAX,YMIN,YMAX,ZMIN,ZMAX. A useful command for decid-
    ing where to set contour levels, or what size to give to the BOX if  you
    want an exact aspect ratio between two coordinates. The current blanking
    value is used, but can be overridden using option /BLANKING.

    Option /LOCAL specifies that instead of computing global  extrema  LOCAL
    extrema values should be computed and:
      - PLOT: written at appropriate places on the plot. This is a very good
        way to avoid ambiguities in contour map. A shortest format  is  used
        for  writing  the  values, and the character size controls the label
        size. /PLOT is an alias for /LOCAL PLOT.
      - TERMINAL: written to the terminal,
      - FileName: written to the given file name.
    These arguments can be combined. If output is TERMINAL  and/or  file,  X
    and Y values are offsets in radians.

    If  option /COMPUTE is not present, the global extrema are only computed
    if not already known (from a previous call to EXTREMA, or from an  image
    header).  /COMPUTE  forces computation from the data array. It should be
    used if for any reason the known extrema are  incorrect  (invalid  image
    header, killed bad pixel, change of blanking value...).
1 GRID
        [GREG2\]GRID [Astep [Dstep]] [/ALTERNATE]

    Plots  a grid of meridian and parallels according to the current projec-
    tion and system. Astep is the grid step for meridian in degrees (Default
    15), Dstep for Parallels (Default Astep). If one step is 0, this part of
    the grid is not plotted. If the /ALTERNATE option is present,  the  grid
    will  be a grid in the alternate coordinate system (Equatorial or Galac-
    tic). This does not currently work for projection type AITOFF and RADIO.
1 LEVELS
        [GREG2\]LEVELS C1 C2 TO C3 BY C4 ...

    sets  the  contour levels to be C1, C2, C2+C4, C2+2*C4, ..C3, and so on,
    using the same list format as SIC\ command FOR. The contour  levels  are
    used  to  make  contour  plots  of  the Regular Grid array using command
    RGMAP. Up to 30 contours can be given at a time. Note that  it  is  more
    efficient to use a single RGMAP command with many levels than many RGMAP
    commands with a single level each.

    LEVELS without arguments will  display  the  contour  levels,  and  LEV-
    ELS NONE reset the level list.
1 MASK
        [GREG2\]MASK [IN|OUT] [/BLANKING Bval]

    masks  all pixels of the Regular Grid array lying inside (if argument is
    IN) or outside (if argument is OUT or by DEFAULT)  the  current  polygon
    (see  command  POLYGON) by attributing them a blanking value. This value
    is defined by  command  SET BLANKING,  or  specified  using  the  option
    /BLANKING Bval.
1 MEAN
        [GREG2\]MEAN [/CLIP Nsigma]

    computes  crude  statistics  on the part of the Regular Grid array lying
    inside the current polygon. Blanking values as defined  in  SET BLANKING
    are  ignored.  The  results are displayed (some of them according to the
    current ANGLE_UNIT), and stored in the variables POLY%SUM and POLY%AREA.

    If  option  /CLIP is present, iterative kappa sigma rejection is used to
    reject outlier pixels.
1 PERSPECTIVE
        [GREG2\]PERSPECTIVE [Altitude  Azimuth]  [/FACTOR  Fv  Ov]  [/LOWER]
    [/LINES]  [/STEP Nsx Nsy] [/AXES Xmin Xmax Ymin Ymax] [/CENTER] [/VERTI-
    CAL Vmin Vmax]

    Makes a parallel projective view of the Regular Grid array, with  hidden
    lines  removed.  If  /LINES option is present, lines along a single axis
    are plotted. Altitude and Azimuth are the values  of  the  corresponding
    viewing  angles  in  Degrees. Default values are 30 and 45 at the begin-
    ning, and then the last values given. The upper part  is  drawn,  unless
    the /LOWER option is present.

    Automatic scaling to match approximately the current box is used, but it
    is only a rough guess and may fail if extrema of the Regular Grid occurs
    near  the edges. Fine tuning of the plot scale can be obtained using the
    /FACTOR option. It controls scaling of the Regular Grid  values  by  the
    factor  Fv (default 1) and an offset Ov which is in physical units along
    the Y direction of the plot.

    The Regular Grid array is plotted according to the  orientation  implied
    by  command LIMITS, but the whole array is plotted. The /STEP option may
    be used to indicate to take only 1 pixel over Nsx ones for  the  X  axis
    (resp.  Nsy and Y). The /AXES option plots (X,Y) axes. The /VERTICAL op-
    tion controls the max, min of plotted perspective and plots  a  Z  axis.
    The /CENTER option centers the perspective. BLANKED PIXELS are forced to
    the minimum value of the map, or the Vmin value when the  /VERTICAL  op-
    tion is in use.
1 PLOT
        [GREG2\]PLOT  [Varname]  [/SCALING Type Low_cut High_cut] [/BLANKING
    Bval Eval] [/POSITION  Posx1  Posx2  Posy1  Posy2]  [/BOUNDARIES  Userx1
    Userx2 Usery1 Usery2] [/VISIBLE]

    PLOT  will  put a pixel image (pixels contained in the variable Varname)
    inside the current BOX. Varname is a 2-D SIC variable name that defaults
    to  the  RG  variable if omitted. Subsets like A[4] where A is a 3-D sic
    variable are not yet allowed. How to create and handle  images  in  pro-
    grams  calling  the GREG2\ language (including GREG) is described in the
    subtopic IMAGE_HOWTO.

    This command is normally used in the following sequence:

    Greg> SET BOX LOCATION Gx1 Gx2 Gy1 Gy2  ! Define box position
    Greg> RGDATA Varname /VARIABLE          ! Put image in the RG variable,
                                            ! read associated header variables
    Greg> LIMITS /RGDATA                    ! Computes associated limits
    Greg> PLOT                              ! Plot the array in the box
    Greg> BOX                               ! Draws the box
2 IMAGE_HOWTO
        There exist a number of ways to get pixels into GREG2\.
  - Read the X, Y, Z values of a Z=f(X,Y) "image", use RGDATA (if  X  and  Y
    define  a  regularly  sampled  grid)  or  RANDOM (if X and Y are "random
    points") to make a Regular Grid Map (see HELP GREG1\COLUMN, GREG2\RGDATA
    and GREG2\RANDOM)
  - Read a RGDATA-format file with the RGDATA command (see topic RGDATA)
  - Define  a  2-D  SIC  variable  and fill it with values, or connect a SIC
    variable  with  an  existing  GILDAS  DATA  FORMAT  (GDF)   image   (see
    HELP SIC\DEFINE), or use the SIC\ACCEPT command to read formatted/unfor-
    matted streams of values and  put  them  in  a  SIC  2-D  variable  (see
    HELP SIC\ACCEPT).  Then  give  this  2-D  variable to the internal image
    buffer by the RGDATA Varname /VARIABLE command.
  - The command GREG3\IMAGE connects directly an existing 2, 3 or 4-D GILDAS
    DATA FORMAT image in the GREG image buffer. See HELP GREG3\IMAGE for de-
    tails.
  - Use the VECTOR\RUN FITS_GILDAS command to convert a FITS image to a  GDF
    (Gildas Data Format) image that will be directly readable afterwards.
  - "on-the-fly"  automatic  conversion  from FITS to GDF format for SIC\DE-
    FINE IMAGE and GREG3\IMAGE commands.
2 /BLANKING
        [GREG2\]PLOT /BLANKING Bval Eval

    Blanking value (Bval) and tolerance (Eval). Default values are those de-
    fined by SET BLANKING command.
2 /BOUNDARIES
        [GREG2\]PLOT /BOUNDARIES Userx1 Userx2 Usery1 Usery2

    User  coordinates  corresponding  to  the image boundary. The default is
    those of the plotted image (when the image has any), or the current user
    limits if not.
2 /POSITION
        [GREG2\]PLOT /POSITION Posx1 Posx2 Posy1 Posy2

    Box  location  in  physical units (default is the current GreG box loca-
    tion).
2 /SCALING
        [GREG2\]PLOT /SCALING Type [Low_cut High_cut]

    Defines the type of transfer function to be used. Type can be  LIN(EAR),
    LOG(ARITHMIC)  of  EQU(ALIZATION),  and the Low_cut and High_cut are the
    lowest and highest represented values respectively. The  default  "cuts"
    are the image extrema. The current cuts are stored in the variable array
    CURIMA%SCALE. The current scaling (as an integer code) is stored in  the
    variable  CURIMA%SCALING.  The  LOG transfer function computes the loga-
    rithm of the pixels values, so does not like negative or null pixels.

     The EQUalization scaling tries its best to put the same number of  pix-
    els in each slot of the color table, thus increasing immensely the visi-
    bility of low-contrast images. This scaling mode has problem (and  warns
    user)  when  a large number of pixels have exactly the same value (i.e.,
    no contrast at all). Beware that most "real" images  are  obtained  with
    receivers working with a small number (11 to 16) of bits, thus restrict-
    ing the range of available Real numbers in the data.

    The  SIC  variables  CURIMA%EQUAL%NLEV,   CURIMA%EQUAL%LEV   and   CURI-
    MA%EQUAL%HIST  contain the number of different levels computed in EQUAL-
    IZATION mode, the values of these levels, and the number  of  pixels  in
    each  level,  respectively. Useful to know which contour levels to draw,
    and necessary for the WEDGE command.
2 /VISIBLE
        [GREG2\]PLOT /VISIBLE

    Specify that the image is to be always drawn, even when  totally  masked
    by  an  overlapping image. This allows special features like movies when
    the plot content is drawn or redrawn, although the "movie" speed depends
    on the computer power.
2 RGB
        PLOT  [3D_Var]  [/SCALING LIN|LOG|EQU [Rlcut Rhcut Glcut Ghcut Blcut
    Bhcut]]
        PLOT [3D_Var] [/SCALING LUPTON [Beta]]

    THIS FEATURE IS CURRENTLY EXPERIMENTAL. Calling sequence, option  names,
    and behavior are subject to changes in the future.

    If  the  RG  buffer  (or the named variable, if any) is a 3D cube with 3
    planes, the command will plot it as a RGB image (R for 1st plane, G  for
    2nd plane, B for 3rd plane).

    The  extrema  are always (re)evaluated for each plane individually. That
    is, global cube extrema and RG%MIN and RG%MAX  (if  available)  are  ig-
    nored.

    The  default is to display the whole extrema ranges with linear scaling.
    This can be overridden with the option /SCALING, giving a custom scaling
    and cuts for each plane. Lupton scaling (combining each planes in a non-
    independent way) is available; Beta factor defaults to 3 but can be cus-
    tomized.
1 POLYGON
        [GREG2\]POLYGON  [(File)Name]  [/PLOT]  [/VARIABLE] [/FILL [Colour]]
    [/HATCH [Ipen] [Angle] [Separ] [Phase]]

    If no argument and no option, it calls the interactive cursor to  define
    the polygon summits. Type any key to go to next summit, C to correct the
    last one, D to delete it, and type E to end the polygon definition.  The
    last polygon side will then appear. The polygon definition may be abort-
    ed by typing Q. For X11 displays, you may use the mouse buttons for  the
    commands.  The left mouse button draws a vertex, the middle mouse button
    deletes the last vertex, and the right mouse  button  ends  the  polygon
    definition.  After  the use of the cursor, the polygon plot is stored in
    the GTV metacode in a segment named POLYGON. You can delete it with  the
    command CLEAR SEGMENT.

    If  a Name is given as argument, the cursor is not called but the summit
    coordinates are read from the corresponding file (X is in column 1, Y in
    column 2), or corresponding SIC Variable if the option /VARIABLE is also
    present.

    Whereever they come from (cursor, file, or variable), the polygon values
    are   stored   internally;   they   can  be  printed  with  the  command
    GREG2\WRITE POLYGON, and they correspond to the variables POLY%NXY (num-
    ber of vertexes), POLY%X and POLY%Y (the corresponding coordinates). The
    currently defined POLYGON is used by the commands MEAN and MASK.

    The polygon loaded by the command can directly be plotted with the  fol-
    lowing options:
      /FILL  [Icol]:  the  polygon  is color-filled with the specified color
          (default current),
      /HATCH [Ipen] [Angle] [Separ] [Phase]: the polygon is filled with par-
          allel  hatch  lines with the specified pen (default current), with
          the given angle in degrees (default 45),  separation  in  physical
          units  (default  0.25  cm),  and phase from 0 to 1 to displace the
          lines by this fraction of the separation from  a  fixed  reference
          (default 0).
      /PLOT: the polygon contours are drawn with the current pen,
    For  a color-filled and/or hatched and/or contoured polygon, these three
    options can be combined; they will be executed in the above order.
1 PROJECTION
        [GREG2\]PROJECTION [A0 D0 [Angle]] [/TYPE Ptype]

    Define a projection of the (celestial) sphere  from  point  of  (A0,D0),
    (which  are  Longitude and Latitude respectively) of the specified type.
    Angle is the angle between the Y axis and the North pole.  The  previous
    values  are kept if no argument is specified. All angles are in degrees,
    except if the SYSTEM is EQUATORIAL in which case A0 is the right  ascen-
    sion  and  must  be  specified  in  hours.  Formats  like -dd:mm:ss.s or
    hh:mm.mmm in sexagesimal notation up to the point field are allowed. Af-
    ter the point, decimal values are assumed.

    When a projection is active, the User coordinates are assumed to be pro-
    jected coordinates of the sphere, and hence in the case of  small  field
    of  view  where distortion are negligible, correspond to angular offsets
    MEASURED IN RADIANS. The field of view of the projection is  defined  by
    command LIMITS.

    The TYPE can be
      - NONE           Disables the projection system. User coordinates then
        loose their interpretation in terms of  projected  coordinates.  The
        ANGLE_UNIT is then totally ignored.
      - GNOMONIC       Radial projection on the tangent plane. Being R and P
        the (angular) polar coordinates from the projection  point  (tangent
        point), the projected coordinates are given by X = Tan(R).Sin(P) and
        Y = Tan(R).Cos(P) .
      - ORTHOGRAPHIC   View  from  infinity.  X  =  Sin(R).Sin(P)  and  Y  =
        Sin(R).Cos(P)
      - AZIMUTHAL      Spherical  offsets  from  the projection center.  X =
        R.Sin(P) and Y = R.Cos(P).
      - STEREOGRAPHIC  Uses Tan(R/2) instead of Tan(R),  and  is  thus  less
        distorted  than  the  Gnomonic projection. This is an inversion from
        the opposite pole.
      - LAMBERT        Equal  area   projection.   Projected   distance   is
        2*Sin(R)/Sqrt(2*(1+Cos(R)).
      - AITOFF         Equal area projection. Angle and D0 are ignored.
      - RADIO          The  standard  radio  astronomy  single  dish mapping
        "projection", in which X = (A-A0).COS(D) and Y = D-D0. The Angle  is
        obviously ignored.
1 RANDOM_MAP
        [GREG2\]RANDOM_MAP [Arg1 [Arg2]] [/NEIGHBOURS Nb] [/TRIANGLES] [/EX-
    TRAPOLATE] [/BLANKING Bval] [VARIABLES Vx Vy Vz]

    This command is a general purpose interpolation  task  which  uses  data
    from  the X, Y and Z arrays (or those specified in option /VARIABLEs) to
    fill in a Regular Grid array representing the same surface  Z=f(X,Y)  by
    an  interpolation  process.  X, Y and Z are arrays defined by the COLUMN
    command (see HELP COLUMN). It triangulates the data  for  interpolation.
    If  a  triangulation  already  exists,  and  only  the  Z array has been
    changed, RANDOM_MAP does not make a new triangulation.

    Often, the user-provided Z=f(X,Y) surface is REGULARLY SAMPLED, even  if
    NOT  COMPLETELY SAMPLED. In this case, it is recommended to use directly
    the RGDATA command to create a Regular-grid map, since RANDOM  is  known
    to perform awkwardly with regularly sampled data.

    The  interpolated  grid  can  be  defined  by  the arguments. If Arg1 is
    "RGMAP", the interpolated grid will be exactly coincident with the  cur-
    rent  Regular  Grid  array,  else Arg1 and Arg2 are used to indicate the
    number of pixels in X and Y directions and Arg2 = Arg1 if not specified.

    Note that several hypothesis are made about the geometry of triangles in
    the plot page space (hence the geometry may be changed by  changing  the
    LIMIT  or  the  BOX_LOCATION).  You should thus use limits which gives a
    reasonable representation of what are the neighbours  of  a  given  data
    point.  Moreover,  this  is an interpolation process. Hence if the basic
    sampling theory is not respected by your choice of input data points and
    output grid, spurious oscillations may occur in the resulting grid.

2 /BLANKING
        [GREG2\]RANDOM_MAP /BLANKING Bval

    Specify  the  value  Bval  to be attributed for pixels lying outside the
    convex hull of triangles. The default value is that defined in  the  SET
    BLANKING  command. This switch is mandatory if no default blanking value
    is preset and no extrapolation required.
2 /EXTRAPOLATE
        [GREG2\]RANDOM_MAP /EXTRAPOLATE

    Control whether extrapolation outside the convex hull of  the  triangles
    is  to  be  done or not. The default is not, i.e. the command fills with
    the blanking value the exterior of the convex hull. Beware that extrapo-
    lation is always hazardous.
2 /NEIGHBOURS
        [GREG2\]RANDOM_MAP /NEIGHBOURS Nb

    The argument Nb changes the number of points influencing the interpolat-
    ed values. Default is 4 and values up to 8 may be used  in  some  cases.
    Caution, it slows down the program, and may enhance oscillations in some
    cases.
2 /TRIANGLES
        [GREG2\]RANDOM_MAP /TRIANGLES

    Plot the triangles selected by the program for interpolation.  A  single
    graphic segment will contain all triangles.

2 /VARIABLES
        [GREG2\]RANDOM_MAP /VARIABLES Vx Vy Vz

    Use  variables  Vx  Vy Vz instead of the default X,Y,Z buffer to compute
    the map.

1 RESAMPLE
        [GREG2\]RESAMPLE Nx Ny [/X Xref  Xval  Xinc]  [/Y  Yref  Yval  Yinc]
    [/BLANKING Bval]

    This  command  resamples (by bilinear interpolation) the current regular
    grid array on a different grid. The number of pixels  of  the  new  grid
    must be specified. Unless the user specifies an explicit conversion for-
    mula in the /X and /Y options, the program adjusts it to match the  cur-
    rent  Regular  Grid array. A blanking value MUST BE specified (either by
    default in SET BLANKING or using the option /BLANKING)  because  no  ex-
    trapolation  is performed. For the same reason, any output pixel's value
    that would be interpolated from at least one input blanked pixel, is it-
    self blanked.
1 RGDATA
        [GREG2\]RGDATA  [Name|Array_X Array_Y Array_Z]  [/SUBSET NXmin NYmin
    NXmax NYmax] [/VARIABLE] [/FORMAT Fmt  [code]]  [/INCREMENT  IncX  IncY]
    [/BLANKING Bval]

    This  command  optionally creates, then loads a two-dimensional map into
    the Regular Grid array (to be contoured by RGMAP, plotted  by  PLOT...).
    This is THE basic command needed for subsequent 2-dimensional treatment.
    "Regular Grid" means that data is internally stored as a two-dimensional
    array,  thus  lies on a Regularly sampled Grid. The user-provided "pixel
    values" may come from various "descriptions" of such  regularly  sampled
    (but possibly uncompletely sampled) data:
       1) Three  1-dimensional arrays, say, X Y and Z, that contain Z=f(X,Y)
        at regular intervals in X and Y.
       2) A preexisting internal 2-D array (possibly a section of a 3D or 4D
        array).
       3) An external, specially formatted, file.

    For  data  NOT  REGULARLY ("randomly") sampled, use the GREG2\RANDOM_MAP
    command instead. The Regular Grid is itself a 2D SIC variable under  the
    name  "RG".  Once loaded, the RG can be saved on a file with the command
    GREG2\WRITE.

    The following command syntax is used to deduce  which  "description"  is
    provided:
      - Without arguments following the command, or with 3 arguments, RGDATA
        will try to assemble Z=f(X,Y) either form the X,Y and Z  arrays  (as
        defined  by  command COLUMN) or from "Array_X Array_Y Array_Z", that
        should be 1D SIC variables previously created by command SIC\DEFINE.
        The option /INCREMENT is used to force the X and Y sampling interval
        to (IncX,IncY) in case of roundoff errors. If a  blanking  value  is
        currently defined, non-sampled pixels will be attributed this value,
        which is overriden by the Bval value of the /BLANKING  option.  Note
        that,  if  a blanking value is currently defined, pixels for which X
        or Y are in the blanking range are themselves blanked.
      - With ONE argument (Name) following the command, Name is taken as the
        name  of an existing SIC 2D variable if option /VARIABLE is present.
        Otherwise, Name  is  a  specially  formatted  file  (see  HELP RGDA-
        TA FILE_FORMAT) from which the Regular Grid array must be read in.
    A  rectangular  SUBSET of the array, defined by the pixel coordinates of
    the Bottom Left Corner and Top Right Corner can be selected.  RGDATA al-
    locates  virtual  memory  according to the map size, so that there is no
    limit on the array dimensions.
2 FILE_FORMAT

        The format for the input file consits of a four line header as such:
    1st line : NX XREF XVAL XINC
    2nd line : (any comment for first axis, could be blank)
    3rd line : NY YREF YVAL YINC
    4th line : (any comment for 2nd axis, could be blank)
    followed by the data (NX times NY pixel values) in a format which can be
    specified with the /FORMAT option when the default 10z8 is not used.
    NX is the number of pixels in the 1st dimension of the map  (on  the  "X
    axis"), XREF the index of the pixel for which the actual X abscissa val-
    ue is XVAL, the increment between two pixels being XINC,  and  the  same
    for  the  y  axis.  Thus,  the  abcissa X of the pixel 'I' is just X=(I-
    XREF)*XINC+XVAL
    This format is very simple-minded (so that any inexperienced  programmer
    can use it in less than 5 minutes), but highly non efficient in I/O pro-
    cessing. A more elaborate data format ("IMAGES"), specially  suited  for
    astronomical  applications  and  large  maps is available through GREG3\
    language (command GREG3\IMAGE), or directly using SIC variables (command
    SIC\DEFINE)  and  the  /VARIABLE option of this command. One should read
    once its data in RGDATA format in GreG, then convert it for  future  use
    in IMAGE format with the command GREG2\WRITE IMAGE filename.

    See also the IMAGE_HOWTO subtopic of the GREG2\PLOT command.
2 /FORMAT

        The  /FORMAT  option governs how the data part (pixel values) of the
    RGDATA file must be read by GreG. Fmt is a valid fortran format (default
    is 10z8, the minimal way to encode real*4 data). code may be BY, R4, R8,
    I4 or I2, depending if the data written in the file  are  BYtes,  Real4,
    Real8,  Integer4 or Integer2. (The values in the GreG map will always be
    Reals*4 after the read is done).
1 RGMAP
        [GREG2\]RGMAP [Quiet|Fast|chunksize] [/PERCENT  P1]  [/ABSOLUTE  A1]
    [/BLANKING  Bval Eval] [/GREY COLOUR N] [/KEEP File_Name [Blank]] [/PENS
    [Pos Neg]] [/ONLY POSITIVE|NEGATIVE]

    Draws (or fills) isocontours of the Regular Grid array. The RG is an in-
    ternal  2D "map" created/loaded by various commands (RGDATA, RANDOM_MAP,
    RESAMPLE, IMAGE), or loaded by a calling program. The levels  are  those
    specified  by command LEVELS, but may be affected by a scaling factor by
    option /PERCENT or /ABSOLUTE.

    This command is normally used in the following sequence:
    Greg> SET BOX LOCATION Gx1 Gx2 Gy1 Gy2  ! Define box position
    Greg> RGDATA (options...)               ! Put image in the RG variable,
                                            ! read associated header variables
    Greg> LIMITS /RGDATA                    ! Computes associated limits
    Greg> PLOT                              ! Plot the array in the box
    Greg> BOX                               ! Draws the box
    Greg> LEVELS 0.1 to 0.9 by 0.1          ! define contour levels
    Greg> RGMAP /PERCENT 1                  ! Draw contour levels  (in this
                                            ! case, as percentage of peak)

    The "Quiet" mode does contouring silently. For  "Fast"  and  "chunksize"
    modifiers, see subtopic MEMORY_OPTIONS.
2 MEMORY_OPTIONS

        The  program normally allocates less that 1/5 of the total number of
    pixels in the map to store the contour segments, and warns the user when
    that  limit  is  reached. Besides, contouring may be slow on large maps.
    The modifier "Fast" cuts the map in smaller "chunks" and  performs  con-
    touring on those submaps, without the 1/5 above limitation.

    The  Contour-filling mode (/GREY) can consume (temporary) a large amount
    of memory, so is always performed on subsets  of  the  image  ("chunks")
    when the image size is greater than a system-dependent limit (256*256 on
    UNIX systems). When the contours are too involved, an internal limit can
    nevertheless be reached. One can then retry the contour-filling by spec-
    ifying a smaller "Chunksize" (in pixels). For example, to force contour-
    filling  on  subsets  of  64  "lines"  of  a  512x512  pixel image, type
    RGMAP 64*512 /GREY
2 /ABSOLUTE
        [GREG2\]RGMAP /ABSOLUTE A1

    Contour levels are multiples of A1, e.g. for LEVELS 1 2 3,  the  contour
    used will be A1 2*A1 3*A1.
2 /BLANKING
        [GREG2\]RGMAP /BLANKING Bval Eval

    Override  the current blanking value as defined by command SET BLANKING.
    Contours are not drawn in pixels touching pixels with value  V  so  that
    ABS(V-Bval) <= Eval.  This  is  extremely  useful for regular grids only
    partially filled as often occur in astronomy.
2 /GREY
        [GREG2\]RGMAP /GREY [start [step] [background]]

    On graphic displays with area filling capabilities, fills contours  with
    up to 16 different color pens (but the number of contours is not limited
    to 16). These pen colors may be changed in the same manner  as  for  the
    pixels  colors  (see HELP LUT /PEN). "start" (default 0) and "step" (de-
    fault 1) may be used to change the exploration of  the  16-pen  palette.
    "background"  is  the number of a color used to fill the map before con-
    tour-filling, thus providing a user-defined background for the  contour-
    filled map.

    In  case  of  Filling  problems, see the subtopic MEMORY_OPTIONS of this
    HELP.
2 /KEEP
        [GREG2\]RGMAP /KEEP File_Name [Blank]

    Will keep a formatted copy of the coordinates of the contour  points  in
    the  specified  file.  This  file can later be used as an input file for
    COLUMN. X coordinates are in column 1 and Y coordinates in column 2. The
    Blank  value is written as a separator value for later CONNECT /BLANKING
    Blank. Blank defaults to the SET BLANKING value if it exists, else Blank
    is mandatory.
2 /ONLY
        [GREG2\]RGMAP /GREY /ONLY POSITIVE|NEGATIVE

    Apply the filling capabilities provided by the /GREY option only to pos-
    itive or negative contours for better clarity.

2 /PENS
        [GREG2\]RGMAP /PENS [Pos Neg]

    Selects the pens for positive and negative contours. Three modes of  op-
    eration are possible :
      - Without option /PENS, positive contour levels use pen 0 and negative
        contour levels use pen 15. Positive means that the  value  given  in
        command  LEVELS is positive, not the final contour level value which
        is affected by a possibly negative factor.
      - With option /PENS, all contours use the current pen.
      - With /PENS Pos Neg, positive contours use pen number Pos  and  nega-
        tive contours use pen number Neg.
2 /PERCENT
        [GREG2\]RGMAP /PERCENT P1

    Computes  M=MAX(ABS(min),ABS(max))  of the data to be contoured. Contour
    levels selected with LEVELS are multiples of P1 percent of M. E.g. if P1
    =  10  and  LEVELS 1 2 5 9, the contour levels are 10, 20, 50 and 90% of
    the peak value.
1 STRIP
        [GREG2\]STRIP [X1 Y1 X2 Y2]

    Will extract from the current Regular Grid array a strip  going  through
    points  (X1,Y1)  and  (X2,Y2)  in  User coordinates. If no arguments are
    present, it will call the cursor to set the two  points.   Although  the
    end  points need not be on the map boundaries, STRIP will always produce
    a full strip across the map.

    For strip parallel to the X or Y map axis, the nearest pixel is used  to
    fill  the values. For any other strip orientation, if the tangent of the
    angle is less than (NY-1)/(NX-1) (i.e. if you scan the X map axis faster
    than  the  Y map axis), the number of resulting points on the strip pro-
    file will be NX and the user coordinates along the strip will be the map
    X coordinate. For each pixel, interpolation along the Y axis is done us-
    ing the three nearby Y pixels. A similar situation with  X  replacing  Y
    occurs if the angle is larger.

    The  map user coordinates are put into the X buffer, and map values into
    the Y buffer. The strip can then be plotted using CONNECT, but  remember
    to set decent limits before.
1 WEDGE
        [GREG2\]WEDGE  [Top|Bottom|Left|Right  [Size]] [/SCALING Lin|Log|Equ
    Min Max] [/LEVEL [Label] ]

    Will plot a WEDGE along the current BOX. WEDGES are used  after  a  PLOT
    command to show the relationship between pixel hues and image values.

    The  default  position is Right, i.e., on the right side of the box, but
    the other location and size modifiers are self-explanatory. The  SCALING
    defaults  to  the  current scaling of the last image PLOTted, but can be
    changed (as in command PLOT) with the /SCALING option.

    The /LEVEL option will draw levels (as defined by the LEVEL command)  at
    their  appropriate  location on the wedge. The modifier Label will label
    the wedge axis with the level values. This is the  default  (i.e.,  some
    levels should be defined) for the EQUALIZATION Mode, for which the rela-
    tionship between pixel hues and image values is strongly non-linear.
1 WRITE
        [GREG2\]WRITE Item File_Name [/TABLE [X Nx] [Y Ny] [Z Nz]]

    This command is used to saves some GreG internal buffers  on  an  output
    file  for  later processing. The item specifies what is to be saved, and
    the format of saving, and can be :
      - POLYGON  Saves the current polygon in formatted way on  two  columns
        easily  readable by command COLUMN or POLYGON later. The default ex-
        tension is .POL.
      - RGDATA   Saves the current Regular Grid array on a RGDATA-like  out-
        put  file  (to preserve the result of a masking, or of a random map-
        ping interpolation). The default extension is .DAT.
      - IMAGE    Same as above but uses the more efficient and complete  IM-
        AGE data format of GILDAS. The default extension is .GDF.
      - COLUMN   Saves  the current X Y Z buffers on a formatted output file
        (after a SORT or a STRIP for  example).  The  default  extension  is
        .DAT.

        [GREG2\]WRITE COLUMN File_Name [NEW]/TABLE [X Nx] [Y Ny] [Z Nz]

    also  saves  the X Y Z buffers but on column Nx, Ny, Nz of the specified
    output table (GILDAS format). A new table is created if argument NEW  is
    specified, otherwise the table must already exists. The table may be ex-
    panded if any of Nx, Ny or Nz exceed the table  column  number  ;  exact
    match on the number of lines is required. The tables can be read by com-
    mand COLUMN /TABLE.
1 ENDOFHELP



















































