astropy / astroplan

Observation planning package for astronomers – maintainer @bmorris3
https://astroplan.readthedocs.io/en/latest/
BSD 3-Clause "New" or "Revised" License
196 stars 108 forks source link

'Column' object has no attribute 'mask' #160

Closed zemogle closed 8 years ago

zemogle commented 8 years ago

I'm getting this weird problem. I've uninstalled and re-pip installed. I've also got the latest development version.

I'm running python==2.7, astropy==1.1.2 and numpy==1.11.0 on a Raspberry Pi (Raspbian).

----> 1 from astroplan import download_IERS_A

/home/pi/astroplan/astroplan/__init__.py in <module>()
     29     from .constraints import *
     30 
---> 31     get_IERS_A_or_workaround()

/home/pi/astroplan/astroplan/utils.py in get_IERS_A_or_workaround()
     51     """
     52     if IERS_A_in_cache():
---> 53         iers.IERS.iers_table = _get_IERS_A_table()
     54     else:
     55         Time._get_delta_ut1_utc = _low_precision_utc_to_ut1

/home/pi/astroplan/astroplan/utils.py in _get_IERS_A_table(warn_update)
     86     if IERS_A_in_cache():
     87         path = download_file(iers.IERS_A_URL, cache=True, show_progress=True)
---> 88         table = iers.IERS_A.open(path)
     89         # Use polar motion flag to identify last observation before predictions
     90         index_of_last_observation = ''.join(table['PolPMFlag_A']).index('IP')

/home/pi/env/allsky/local/lib/python2.7/site-packages/astropy/utils/iers/iers.pyc in open(cls, file, cache, **kwargs)
    143                 else:
    144                     kwargs.update(file=file)
--> 145             cls.iers_table = cls.read(**kwargs)
    146         return cls.iers_table
    147 

/home/pi/env/allsky/local/lib/python2.7/site-packages/astropy/utils/iers/iers.pyc in read(cls, file, readme)
    372         # presumably to be filled later.  Exclude those a priori -- there
    373         # should at least be a predicted UT1-UTC and PM!
--> 374         return cls(iers_a[~iers_a['UT1_UTC_A'].mask &
    375                           ~iers_a['PolPMFlag_A'].mask])
    376 

AttributeError: 'Column' object has no attribute 'mask'
bmorris3 commented 8 years ago

Maybe @eteq or @mhvk would know, since it looks like the problem is occurring in astropy/utils/iers/iers.py.

zemogle commented 8 years ago

I was thinking that too. Maybe clearing the cached file would be enough. I suspect the download only partially happened and something got itself in a pickle.

bmorris3 commented 8 years ago

If the IERS table was incompletely downloaded/corrupt, you can delete it by clearing the astropy cache.

If there is nothing in the astropy cache that you care about, I think you can clear it by deleting the files in ~/.astropy/cache/download (at least that's what I've done when I have similar problems). I don't know if that properly updates the download url map.

zemogle commented 8 years ago

So, I manually ran all the code in _get_IERS_A_table line by line and setting cache=False (i.e. force the file to download again) works. Clearly the cached version of the IERS A table was mess, and clearing out all the cache fixed that nicely.

Thanks!

Ps. I love astroplan - I'm ditching pyephem in favour of it :grinning:

bmorris3 commented 8 years ago

Excellent, I'm glad the fix wasn't too painful.

I'm glad you love it! Would you mind sharing what you're doing with it on raspberry pi? I'm excited to see the code proliferating.

zemogle commented 8 years ago

Sure! I've installed an AllSky camera in a Dark Sky Reserve. Its being controlled by the Raspberry Pi using only Python (with the communication going through INDi). astropy has made my life so much simpler.

The biggest problem is making the USB cables waterproofed (I live in Wales) :umbrella:

bmorris3 commented 8 years ago

Awesome. Are you using astroplan to compute sunrise/set times?

zemogle commented 8 years ago

Yes indeed! Its not in the live version yet but hopefully it will be soon.

On 7 April 2016 at 19:55, Brett M. Morris notifications@github.com wrote:

Awesome. Are you using astroplan to compute sunrise/set times?

— You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub https://github.com/astropy/astroplan/issues/160#issuecomment-207049132

Edward Gomez - Education Director Las Cumbres Observatory Global Telescope Network, UK +44 (0) 29 2087 5121