Removing a Frame from a FrameSet is straightforward and is performed using the astRemoveFrame function. You identify the Frame you wish to remove in the usual way, by giving its index within the FrameSet. For example, the following would remove the Frame with index 1:
astRemoveFrame( frameset, 1 );
The only restriction is that you cannot remove the last remaining Frame because a FrameSet must always contain at least one Frame. When a Frame is removed, the Frames which follow it are re-numbered (i.e. their indices are reduced by one) so as to preserve the sequence of consecutive Frame indices. The FrameSet's Nframe attribute is also decremented.
If appropriate, astRemoveFrame will modify the FrameSet's Base and/or Current attributes so that they continue to identify the same Frames as previously. If either the base or current Frame is removed, however, the corresponding attribute will become un-set, so that it reverts to its default value () and therefore identifies an alternative Frame.
Note that it is quite permissible to remove any Frame from a FrameSet, even although other Frames may appear to depend on it. For example, in Figure , if Frame 1 were removed, the correct relationship between Frames 2 and 3 would still be preserved, although they would be re-numbered as Frames 1 and 2.
AST A Library for Handling World Coordinate Systems in Astronomy