[AstroPy] Strange problem with astropy.coordinates.EarthLocation (OSX)

Frederic V. Hessman hessman at astro.physik.uni-goettingen.de
Wed Oct 30 11:44:33 EDT 2019


An astropy script I had previously used suddently bombed for no obvious reason.  The core problem was

>> from astropy import units as u
>> from astropy.coordinates import EarthLocation
>> earth = EarthLocation.from_geocentric (0.,0.,0.,u.m)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/coordinates/earth.py", line 253, in from_geocentric
    return super().__new__(cls, struc, unit, copy=False)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/astropy/units/quantity.py", line 379, in __new__
    value = value.astype(float)
TypeError: Cannot cast array from dtype([('x', '<f8'), ('y', '<f8'), ('z', '<f8')]) to dtype('float64') according to the rule 'unsafe'

Tried to find the problem - nothing obvious.  In desperation, I eventually uninstalled and re-installed MacPorts entirely (according to their recipe at https://guide.macports.org/chunked/installing.macports.uninstalling.html), which totally zaps /opt/local, and then _only_ re-installed python3.5 and py35-astropy (and the corresponding other packages needed automatically).  Didn't do any good....

I bet it's a python problem rather than an astropy problem, but I wouldn't know where to begin since everything else appears to work.  Anybody else encounter such problems?  I'm using Sierra 10.12.6 on a MacBook Pro.

Rick



More information about the AstroPy mailing list