Some attribute values are read-only and cannot be altered after an Object has been created. The Nin attribute of a ZoomMap (describing the number of coordinates) is like this. It is defined when the ZoomMap is created, but cannot then be altered.
Other attributes, however, can be modified whenever you want. A ZoomMap's Zoom attribute is like this. If we wanted to change it, this could be done simply as follows:
CALL AST_SETD( ZOOMMAP, 'Zoom', 99.6D0, STATUS )
which sets the value to 99.6 (double precision). As when getting an
attribute value (), you have a choice of
which data type you will use to supply the new value. For instance,
you could use an integer value, as in:
CALL AST_SETI( ZOOMMAP, 'Zoom', 99, STATUS )
and the necessary data conversion would occur. You specify the data type you want to supply simply by replacing the final character of the AST_SETx routine name with C (character), D (double precision), I (integer), L (logical) or R (real). Setting a boolean attribute to any non-zero integer causes it to take the value 1.
An alternative way of setting attribute values for Objects is to use the AST_SET routine (i.e. with no final character specifying a data type). In this case, you supply the attribute values in a character string. The big advantage of this method is that you can assign values to several attributes at once, separating them with commas. This also reads more naturally in programs. For example:
CALL AST_SET( ZOOMMAP, 'Zoom=99.6, Report=1', STATUS )
would set values for both the Zoom attribute and the Report attribute
(about which more shortly--). You don't really
have to worry about data types with this method, as any character
representation will do (although you must use 0/1 instead of
.TRUE./.FALSE., which are not supported).
Finally, a very convenient way of setting attribute values is to do so at the same time as you create an Object. Every Object constructor function has a penultimate character argument which allows you to do this. Although you can simply leave this blank, it is an ideal opportunity to initialise the Object to have just the attributes you want. For example, we might have created our original ZoomMap with:
ZOOMMAP = AST_ZOOMMAP( 2, 5.0D0, 'Report=1', STATUS )
and it would then start life with its Report attribute set to 1.
AST A Library for Handling World Coordinate Systems in Astronomy