### WCSEDIT

Modifies or examines image coordinate system information

#### Description:

This task performs one of a set of modifications to the WCS (World Coordinate System) components of a list of images. According to the value of the MODE parameter it will:
• Set the Current coordinate system
• Add a new coordinate system
• Remove a coordinate system
• Set an attribute for a coordinate system
• Show the coordinate systems which currently exist
The routine does not fail if some of the requested edits cannot be performed, but a file whose name is given by the NAMELIST parameter records which images were successfully accessed.

#### Usage:

WCSEDIT in mode frame

#### Parameters:

##### COEFFS( $\ast$ ) = _DOUBLE
If MODE is ADD, this parameter is a list of the coefficients used for the mapping from the target frame to the new frame. Its meaning and the number of values required depend on the value of MAPTYPE:
• UNIT – No values are required $\begin{array}{rcll}{x}^{\prime }& =& x& \text{}\\ {y}^{\prime }& =& y& \text{}\end{array}$

• LINEAR – Six values ${C}_{1}\dots {C}_{6}$ are required: $\begin{array}{rcll}{x}^{\prime }& =& {C}_{1}+{C}_{2}x+{C}_{3}y& \text{}\\ {y}^{\prime }& =& {C}_{4}+{C}_{5}x+{C}_{6}y& \text{}\end{array}$

• PINCUSHION – Three values ${C}_{1}\dots {C}_{3}$ are required: $\begin{array}{rcll}{x}^{\prime }=x\left(1+{C}_{1}\left[{\left(x-{C}_{2}\right)}^{2}+{\left(y-{C}_{3}\right)}^{2}\right]\right)& & & \text{}\\ {y}^{\prime }=y\left(1+{C}_{1}\left[{\left(x-{C}_{2}\right)}^{2}+{\left(y-{C}_{3}\right)}^{2}\right]\right)& & & \text{}\end{array}$

If MODE is ADD this gives the Domain (name) to be used for the new frame. Spaces in the name are ignored and letters are folded to upper case. If the new frame is successfully added and any frame with the same domain name already exists, the old one will be removed, and a message will be printed to that effect. [CCD_WCSEDIT]
If a "Sky Co-ordinate System" specification is supplied (using parameter FRAME) for a celestial co-ordinate system, then an epoch value is needed to qualify it. This is the epoch at which the supplied sky positions were determined. It should be given as a decimal years value, with or without decimal places ("1996.8" for example). Such values are interpreted as a Besselian epoch if less than 1984.0 and as a Julian epoch otherwise.
##### FOREXP $\ast$ ( $\ast$ ) = LITERAL (Read)
If MODE=ADD and MAPTYPE=MATH, this gives the expressions to be used for the forward transformation to be added. There must be at least two expressions (for the two coordinates) but there may be more if intermediate expressions are to be used. Expression syntax is fortran-like; see the AST_MATHMAP documentation in SUN/210 for details.
This parameter specifies the "target frame", which has the following meaning according to the value of the MODE parameter:
• MODE = CURRENT – The frame to be made Current
• MODE = REMOVE – The frame to remove; if it is a domain name (see below) then all frames with that domain will be removed.
• MODE = ADD – The new frame will be a copy of the target frame (though Domain and Title will be changed), and will be mapped from it using the mapping given.
• MODE = SET – The frame whose attributes are to be set
• MODE = SHOW – This parameter is ignored

The value of the parameter can be one of the following:

• A domain name such as SKY, AXIS, PIXEL, etc.
• An integer value giving the index of the required Frame within the WCS component.
• A "Sky Co-ordinate System" (SCS) value such as EQUAT(J2000) (see section "Sky Co-ordinate Systems" in SUN/95).
• The Null (!) value; in this case the Current frame is used.
A domain name, or !, is usually the most suitable choice.
A list specifying the names of the images whose WCS components are to be modified or examined. The image names should be separated by commas and may include wildcards.
If set TRUE the mapping defined by COEFFS will be applied in the reverse direction. [FALSE]
##### INVEXP $\ast$ ( $\ast$ ) = LITERAL (Read)
If MODE=ADD and MAPTYPE=MATH, this gives the expressions to be used for the inverse transformation to be added. There must be at least two expressions (for the two coordinates) but there may be more if intermediate expressions are to be used. Expression syntax is fortran-like; see the AST_MATHMAP documentation in SUN/210 for details.
Name of the CCDPACK logfile. If a null (!) value is given for this parameter, then no logfile will be written, regardless of the value of the LOGTO parameter.

If the logging system has been initialised using CCDSETUP, then the value specified there will be used. Otherwise, the default is "CCDPACK.LOG". [CCDPACK.LOG]

Every CCDPACK application has the ability to log its output for future reference as well as for display on the terminal. This parameter controls this process, and may be set to any unique abbreviation of the following:
• TERMINAL – Send output to the terminal only

• LOGFILE – Send output to the logfile only (see the LOGFILE parameter)

• BOTH – Send output to both the terminal and the logfile

• NEITHER – Produce no output at all

If the logging system has been initialised using CCDSETUP then the value specified there will be used. Otherwise, the default is "BOTH". [BOTH]

This parameter is required when MODE is ADD, and specifies the type of transformation which maps from the target frame to the new frame. It may take one of the following values:
• UNIT – A Unit mapping
• LINEAR – A linear mapping

• PINCUSHION – A pincushion distortion

• MATH – A general algebraic mapping

[UNIT]
The action to be performed. It may take one of the following values:
• CURRENT – Set the Current frame
• REMOVE – Remove a frame (Current frame is not changed unless the Current one is removed)
• SET – Set frame attributes (Current frame is not changed)
• SHOW – Display a list of the frames which exist
[CURRENT]
The name of an output file in which to write the names of all the NDFs which were successfully accessed. In particular, if MODE is CURRENT, this list will include all the NDFs which contained the specified frame, but exclude any which did not. [WCSEDIT.LIS]
If MODE is SET, then this gives a string of the form "attribute=value" which is to be applied to the frame. The string is passed straight to the AST_SET routine (see SUN/210).
If MODE=SET and MAPTYPE=MATH, this gives the value of the mapping’s SimpFI attribute (whether it is legitimate to simplify the forward followed by the inverse transformation to a unit transformation). [TRUE]
If MODE=SET and MAPTYPE=MATH, this gives the value of the mapping’s SimpIF attribute (whether it is legitimate to simplivy the inverse followed by the forward transformation to a unit transformation). [TRUE]

#### Examples:

wcsedit $\ast$ current ccd_reg
This sets the Current coordinate system of all the images in the current directory to ’CCD_REG’. The names of all the images which had this coordinate system are written to the file WCSEDIT.LIS. Any which do not appear in this file were not modified by the program.
wcsedit data$\ast$ remove frame=4
The fourth coordinate frame in the WCS component of each image ’data$\ast$.sdf’ is removed.
wcsedit "first,second" mode=add frame=GRID maptype=pincushion coeffs=[-6.8e-8,0,0] domain=NEW
A new coordinate system, called ’NEW’, is added to the images first and second. It is connected to the previously existing GRID domain by a pincushion distortion mapping centred at the origin with a distortion coefficient of
• 6.8e-8. If any frames with domain NEW already exist in those images they are removed.

wcsedit image1 set ! set="domain=NEW,title=New frame"
This changes the value of the Domain attribute of the Current coordinate frame in the WCS component of image1 to the name "NEW" and sets the Title attribute of the frame to "New frame".
wcsedit image1 show
This displays all the coordinate frames in image1 with their Domains and titles, and indicates which one is Current.
wcsedit frm mode=add frame=pixel maptype=math simpif simpfi forexp=["r=sqrt(x$\ast$x$+$y$\ast$y)","theta=atan2(y,x)"] invexp=[x=r$\ast$cos(theta),y=r$\ast$sin(theta)]
Adds a frame giving a polar coordinate view of the PIXEL frame.