As an example of using AST_REMAPFRAME, consider a case where the
pixels of a 2-dimensional image have been binned 22, so as to
reduce the image size by a factor of two in each dimension. We must
now modify the associated FrameSet to reflect this change to the
image. Much the same process would be needed for any other geometrical
change the image might undergo.
We first set up a Mapping (a WinMap in this case) which relates the data grid coordinates in the original image to those in the new one:
INTEGER WINMAP DOUBLE PRECISION INA( 2 ), INB( 2 ), OUTA( 2 ), OUTB( 2 ) DATA INA / 0.5D0, 0.5D0 / DATA INB / 2.5D0, 2.5D0 / DATA OUTA / 0.5D0, 0.5D0 / DATA OUTB / 1.5DO, 1.5DO / ... WINMAP = AST_WINMAP( 2, INA, INB, OUTA, OUTB, ' ', STATUS )
Here, we have simply set up arrays containing the data grid coordinates of the bottom left and top right corners of the first element in the output image (OUTA and OUTB) and the corresponding coordinates in the input image (INA and INB). AST_WINMAP then creates a WinMap which performs the required transformation. We do not need to know the size of the image.
We can then pass this WinMap to AST_REMAPFRAME. This modifies the relationship between our FrameSet's base Frame and the other Frames in the FrameSet, so that the base Frame represents the data grid coordinate system of the new image rather than the old one:
INTEGER FRAMESET ... CALL AST_REMAPFRAME( FRAMESET, AST__BASE, WINMAP, STATUS )
Any other coordinate systems described by the FrameSet, no matter how
many of these there might be, are now correctly associated with the
new image.
AST A Library for Handling World Coordinate Systems in Astronomy