KPG1_OPGRD

Gets the parameters of an optimal projection for a given set of sky positions

Description:

This routine calculates the parameters of a tangent-plane projection that gives an optimal representation of a set of supplied sky positions. The projection parameters are the normal FITS CRPIX1/2, CRVAL1/2, CDELT1/2 and CROTA2 keywords. They are chosen in order to maximise the number of sky positions that fall close to the centre of a pixel.

Invocation

CALL KPG1_OPGRD( NPOS, POS, WEST, PAR, RDIAM, STATUS )

Arguments

NPOS = INTEGER (Given)
The number of sky positions.
POS( 2, NPOS ) = DOUBLE PRECISION (Given)
The sky positions. These should be (longitude,latitude) values, in radians, in any celestial co-ordinate system.
WEST = LOGICAL (Given)
If .TRUE., then it is assumed that the X grid axis increases westwards (assuming north is parallel to +ve Y). This is the case for most celestial co-ordinate systems such as (RA,Dec) etc. If .FALSE., then it is assumed that the X grid axis increases eastwards (assuming north is parallel to +ve Y). This is the case for a few systems such as (az,el) and geographic (longitude,latitude).
PAR( 7 ) = DOUBLE PRECISION (Given and Returned)
The projection parameters. Each parameter that is supplied with a value of AST__BAD on entry will be replaced on exit with the optimal value. Non-bad supplied values will be left unchanged on exit. The supplied values will also be left unchanged if optimal values cannot be determined. They are stored in the order CRPIX1, CRPIX2, CRVAL1, CRVAL2, CDELT1, CDELT2, CROTA2. CRPIX1 and CRPIX2 are in units of pixels. All the other projection parameters will be in units of radians, and refer to the celestial co-ordinate system in which the POS values are supplied. CROTA2 is the angle from the Y axis to celestial north, measured north through east (no matter the value of WEST). Returned pixel sizes are rounded to the nearest tenth of an arcsecond.
RDIAM = DOUBLE PRECISION (Returned)
The diameter of the circle that just encloses all the supplied sky positions, in radians.
STATUS = INTEGER (Given and Returned)
The global status.