Second Example#

Another way of creating a WCS object is via the use of a Python dictionary. This affords us more control over the NAXISn FITS header keyword which is otherwise automatically default to zero as in the case of the First Example shown above.

# Define the astropy.wcs.WCS object using a Python dictionary as input

import astropy.wcs

wcs_dict = {
    "CTYPE1": "WAVE    ",
    "CUNIT1": "Angstrom",
    "CDELT1": 0.2,
    "CRPIX1": 0,
    "CRVAL1": 10,
    "NAXIS1": 5,
    "CTYPE2": "HPLT-TAN",
    "CUNIT2": "deg",
    "CDELT2": 0.5,
    "CRPIX2": 2,
    "CRVAL2": 0.5,
    "NAXIS2": 4,
    "CTYPE3": "HPLN-TAN",
    "CUNIT3": "deg",
    "CDELT3": 0.4,
    "CRPIX3": 2,
    "CRVAL3": 1,
    "NAXIS3": 3,
}
input_wcs = astropy.wcs.WCS(wcs_dict)