astropy/astropy — pull request #1117 by mdboom (2013-05-21 22:38:17+00:00)
Title: Table.read FITS file units related ValueError

The command below illustrated two issues with the current astropy master:
1. The FITS file seems to be downloaded twice!?
2. I can't read FITS tables (this is not the only one) because of units-related `ValueError`s.

Even if the unit strings have syntax errors (I didn't check this) there should be an option to ignore the units problem and just read the table values. I couldn't find such an option it in the docs: http://docs.astropy.org/en/latest/io/unified.html#fits

```
In [1]: from astropy.table import Table

In [2]: Table.read('http://fermi.gsfc.nasa.gov/ssc/data/access/lat/2yr_catalog/gll_psc_v08.fit')
Downloading http://fermi.gsfc.nasa.gov/ssc/data/access/lat/2yr_catalog/gll_psc_v08.fit
|============================================================================================================================| 1.4M/1.4M (100.00%) 04s
Downloading http://fermi.gsfc.nasa.gov/ssc/data/access/lat/2yr_catalog/gll_psc_v08.fit
|============================================================================================================================| 1.4M/1.4M (100.00%) 04s
WARNING: hdu= was not specified but multiple tables are present, reading in first available table (hdu=1) [astropy.io.fits.connect]
ERROR: ValueError: 'photon/cm**2/MeV/s' did not parse as unit format 'fits': Syntax error parsing unit 'photon/cm**2/MeV/s' [astropy.units.core]
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()
----> 1 Table.read('http://fermi.gsfc.nasa.gov/ssc/data/access/lat/2yr_catalog/gll_psc_v08.fit')

/Users/deil/Library/Python/2.7/lib/python/site-packages/astropy-0.3.dev4377-py2.7-macosx-10.8-x86_64.egg/astropy/io/registry.pyc in read(cls, *args, **kwargs)
170 if fileobj is not None:
171 fileobj.seek(0)
--> 172 table = reader(*args, **kwargs)
173
174 if not isinstance(table, cls):

/Users/deil/Library/Python/2.7/lib/python/site-packages/astropy-0.3.dev4377-py2.7-macosx-10.8-x86_64.egg/astropy/io/fits/connect.pyc in read_table_fits(input, hdu)
163 for col in table.columns:
164 if col.unit is not None:
--> 165 t[col.name].units = u.Unit(col.unit, format='fits')
166
167 # TODO: deal properly with unsigned integers

/Users/deil/Library/Python/2.7/lib/python/site-packages/astropy-0.3.dev4377-py2.7-macosx-10.8-x86_64.egg/astropy/units/core.pyc in __call__(self, s, represents, format, register, doc, parse_strict)
1201 s, format, str(e))
1202 if parse_strict == 'raise':
-> 1203 raise ValueError(msg)
1204 elif parse_strict == 'warn':
1205 warnings.warn(msg, UnitsWarning)

ValueError: 'photon/cm**2/MeV/s' did not parse as unit format 'fits': Syntax error parsing unit 'photon/cm**2/MeV/s'
```