astropy/astropy — pull request #1918 by mdboom (2013-12-30 17:05:33+00:00)
Title: WCS changes velocity units from km/s to m/s

`astropy.wcs` converts `km/s` to `m/s`. This is somewhat new behavior and highly unexpected. For all I know, it may be part of a FITS convention, but such a convention was certainly ignored by many packages and is highly inconvenient.

```
In [19]: h = fits.Header().fromtextfile('w51_co_h2co_cube_grid.hdr')

In [20]: h
Out[20]:
SIMPLE = T / conforms to FITS standard
BITPIX = -64 / array data type
NAXIS = 3 / number of array dimensions
NAXIS1 = 400
NAXIS2 = 300
NAXIS3 = 251
EQUINOX = 2000.0
CTYPE1 = 'GLON-CAR'
CTYPE2 = 'GLAT-CAR'
CTYPE3 = 'VRAD'
SPECSYS = 'LSRK'
CUNIT3 = 'km/s '
BUNIT = 'K '
CRVAL1 = 49.209553
CRVAL2 = 0.0
CRVAL3 = 50.0
CRPIX1 = 200.0
CRPIX2 = 288.0
CRPIX3 = 125.0
CDELT1 = -0.00333333333333333
CDELT2 = 0.003333333333333333
CDELT3 = 0.5
RESTFREQ= 1000.
TELESCOP= 'Arecibo'

In [21]: w = wcs.WCS(h)

In [22]: w.wcs.cunit
Out[22]: ['deg', 'deg', 'm/s']

In [25]: astropy.__version__
Out[25]: '0.4.dev6828'
```

`w.wcs.cunit` should be `km/s`, since `CUNIT3` was `'km/s'`. Note that it actually does the conversion of other header units, so the header isn't *wrong*, it's just not what I want.