question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IERS error when converting to altaz

See original GitHub issue

When writing this code with Python 3.6 and Astropy v2.0.2:

from astropy import coordinates as coord
import astropy.units as u
from astropy import time

vega = coord.SkyCoord.from_name('Vega')

loc = coord.EarthLocation(lon=0.1 * u.deg,
                          lat=51.5 * u.deg)

obstime = time.Time(57734.1231, format='mjd')

altaz = coord.AltAz(location=loc, obstime=obstime)

vega_altaz = vega.transform_to(altaz)

I get this error:

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call last)
/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/io/ascii/core.py in _convert_vals(self, cols)
    956                 try:
--> 957                     converter_func, converter_type = col.converters[0]
    958                     if not issubclass(converter_type, col.type):

IndexError: list index out of range

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
<ipython-input-23-5540b2e880c6> in <module>()
     10 altaz = coord.AltAz(location=loc, obstime=time)
     11 
---> 12 vega_altaz = vega.transform_to(altaz)
     13 vega_altaz.alt

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/coordinates/sky_coordinate.py in transform_to(self, frame, merge_attributes)
    479         # Do the transformation, returning a coordinate frame of the desired
    480         # final type (not generic).
--> 481         new_coord = trans(self.frame, generic_frame)
    482 
    483         # Finally make the new SkyCoord object from the `new_coord` and

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/coordinates/transformations.py in __call__(self, fromcoord, toframe)
   1312 
   1313             curr_toframe = t.tosys(**frattrs)
-> 1314             curr_coord = t(curr_coord, curr_toframe)
   1315 
   1316         # this is safe even in the case where self.transforms is empty, because

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/coordinates/transformations.py in __call__(self, fromcoord, toframe)
    912             return reprwithoutdiff.realize_frame(reprwithdiff)
    913         else:
--> 914             return supcall(fromcoord, toframe)
    915 
    916 

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/coordinates/builtin_frames/cirs_observed_transforms.py in cirs_to_altaz(cirs_coo, altaz_frame)
     51 
     52     lon, lat, height = altaz_frame.location.to_geodetic('WGS84')
---> 53     xp, yp = get_polar_motion(obstime)
     54 
     55     # first set up the astrometry context for CIRS<->AltAz

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/coordinates/builtin_frames/utils.py in get_polar_motion(time)
     41     """
     42     # Get the polar motion from the IERS table
---> 43     xp, yp, status = iers.IERS_Auto.open().pm_xy(time, return_status=True)
     44 
     45     wmsg = None

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/utils/iers/iers.py in open(cls)
    586             return cls.iers_table
    587 
--> 588         cls.iers_table = cls.read(file=filename)
    589         cls.iers_table.meta['data_url'] = str(conf.iers_auto_url)
    590 

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/utils/iers/iers.py in read(cls, file, readme)
    455         # Read in as a regular Table, including possible masked columns.
    456         # Columns will be filled and converted to Quantity in cls.__init__.
--> 457         iers_a = Table.read(file, format='cds', readme=readme)
    458 
    459         # Combine the A and B data for UT1-UTC and PM columns

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/table/table.py in read(cls, *args, **kwargs)
   2519         passed through to the underlying data reader (e.g. `~astropy.io.ascii.read`).
   2520         """
-> 2521         out = io_registry.read(cls, *args, **kwargs)
   2522         # For some readers (e.g., ascii.ecsv), the returned `out` class is not
   2523         # guaranteed to be the same as the desired output `cls`.  If so,

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/io/registry.py in read(cls, *args, **kwargs)
    529 
    530         reader = get_reader(format, cls)
--> 531         data = reader(*args, **kwargs)
    532 
    533         if not isinstance(data, cls):

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/io/ascii/connect.py in io_read(format, filename, **kwargs)
     37     from .ui import read
     38     format = re.sub(r'^ascii\.', '', format)
---> 39     return read(filename, format=format, **kwargs)
     40 
     41 

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/io/ascii/ui.py in read(table, guess, **kwargs)
    351                                              ' with fast (no guessing)'})
    352         else:
--> 353             dat = reader.read(table)
    354             _read_trace.append({'kwargs': new_kwargs,
    355                                 'status': 'Success with specified Reader class '

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/io/ascii/cds.py in read(self, table)
    320                     return table
    321         else:
--> 322             return super(Cds, self).read(table)

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/io/ascii/core.py in read(self, table)
   1200         if hasattr(self.header, 'table_meta'):
   1201             self.meta['table'].update(self.header.table_meta)
-> 1202         table = self.outputter(cols, self.meta)
   1203         self.cols = self.header.cols
   1204 

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/io/ascii/core.py in __call__(self, cols, meta)
    986         # Sets col.data to numpy array and col.type to io.ascii Type class (e.g.
    987         # FloatType) for each col.
--> 988         self._convert_vals(cols)
    989 
    990         # If there are any values that were filled and tagged with a mask bit then this

/Users/elliannaschwab/anaconda/lib/python3.6/site-packages/astropy/io/ascii/core.py in _convert_vals(self, cols)
    971                     last_err = err
    972                 except IndexError:
--> 973                     raise ValueError('Column {} failed to convert: {}'.format(col.name, last_err))
    974 
    975 

ValueError: Column year failed to convert: invalid literal for int() with base 10: '<h'


Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:20 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
mshemunicommented, Jan 5, 2019

@pllim I installed Anaconda3 and basically started python3 from Anaconda bin directory and was able to execute the code.

Apparently you were right.Something in my system is not right. Thank you for your help.

2reactions
pllimcommented, Jan 4, 2019

@mshemuni , any chance you can use conda to create a fresh environment and see if the problem goes away? This might be also something incompatible hiding in your installation library…

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Converting equatorial to alt-az coordinates is very slow
After some debugging, it seems that it happens because astropy.utils.iers.iers 's conf.iers_auto_url is a bad url.
Read more >
[AstroPy] Convert from AltAz to ICRS - Python mailing list
[AstroPy] Convert from AltAz to ICRS. Eric Jensen ejensen1 at swarthmore.edu. Sat Nov 23 15:20:59 EST 2019. Previous message (by thread): [AstroPy] Convert...
Read more >
Source code for specsim.transform
AltAz `, based on that implemented in `ERFA ... gives the round-trip altitude errors for converting from (alt,az) to (ra,dec) and back to...
Read more >
Astronomical Coordinate Systems (astropy.coordinates)
Coordinates can be converted to strings using the to_string() method: > ... ICRS/IERS/CIRS and related problems in precision coordinate system work.
Read more >
How to get the RA and DEC coordinates of an instant orbit
Regarding Alt,Az to RA,DEC conversion, it should be a similar process ... reset by peer;<urlopen error timed out> [astropy.utils.iers.iers]
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found