I am attempting to use the astroquery.gaia module and finding it very useful. However, I have been getting the error messages copied below when using gaia.query_object. These warnings aren't preventing the function call from returning results. I have attached a MWE which replicates the error with the modules:
Python 3.5.4
astropy 3.0.1
astroquery 0.3.7
import numpy as np
from astropy.coordinates import SkyCoord as coord
import astropy.units as un
from astroquery.gaia import Gaia
Mradec=str("19:51:04.10821+22:36:36.1732")
c=coord(Mradec,unit=(un.hourangle, un.deg),frame='icrs')
result = Gaia.query_object(c, radius=2.0*un.arcsecond)
Errors:
WARNING: W27: None:3:0: W27: COOSYS deprecated in VOTable 1.2 [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - W27: None:3:0: W27: COOSYS deprecated in VOTable 1.2
WARNING: W35: None:5:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - W35: None:5:0: W35: 'value' attribute required for INFO elements
WARNING: W35: None:6:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - W35: None:6:0: W35: 'value' attribute required for INFO elements
WARNING: W35: None:7:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - W35: None:7:0: W35: 'value' attribute required for INFO elements
WARNING: W35: None:8:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - W35: None:8:0: W35: 'value' attribute required for INFO elements
WARNING: W35: None:9:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - W35: None:9:0: W35: 'value' attribute required for INFO elements
WARNING: W35: None:10:0: W35: 'value' attribute required for INFO elements [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - W35: None:10:0: W35: 'value' attribute required for INFO elements
WARNING: W06: None:13:0: W06: Invalid UCD 'meta.id;meta.version': Primary word 'meta.version' is not valid as a secondary word [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W06: None:13:0: W06: Invalid UCD 'meta.id;meta.version': Primary word 'meta.version' is not valid as a secondary word
WARNING: W50: None:76:0: W50: Invalid unit string 'Time[Julian Years]' [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W50: None:76:0: W50: Invalid unit string 'Time[Julian Years]'
WARNING: W50: None:84:0: W50: Invalid unit string 'Angle[mas]' [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W50: None:84:0: W50: Invalid unit string 'Angle[mas]'
WARNING: W50: None:92:0: W50: Invalid unit string 'Angle[mas]' [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W50: None:92:0: W50: Invalid unit string 'Angle[mas]'
WARNING: W50: None:96:0: W50: Invalid unit string 'Angle[mas]' [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W50: None:96:0: W50: Invalid unit string 'Angle[mas]'
WARNING: W50: None:100:0: W50: Invalid unit string 'Angle[mas]' [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W50: None:100:0: W50: Invalid unit string 'Angle[mas]'
WARNING: W50: None:122:0: W50: Invalid unit string 'Dimensionless[see description]' [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W50: None:122:0: W50: Invalid unit string 'Dimensionless[see description]'
WARNING: W50: None:126:0: W50: Invalid unit string 'Dimensionless[see description]' [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W50: None:126:0: W50: Invalid unit string 'Dimensionless[see description]'
WARNING: W50: None:130:0: W50: Invalid unit string 'Dimensionless[see description]' [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W50: None:130:0: W50: Invalid unit string 'Dimensionless[see description]'
WARNING: W50: None:134:0: W50: Invalid unit string 'Dimensionless[see description]' [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W50: None:134:0: W50: Invalid unit string 'Dimensionless[see description]'
WARNING: W50: None:138:0: W50: Invalid unit string 'Dimensionless[see description]' (suppressing further warnings of this type...) [astropy.io.votable.tree]
- - - - - - - - - - - - - - - - - - - - - - - - - - - W50: None:138:0: W50: Invalid unit string 'Dimensionless[see description]'
These is an upstream issue either with the gaia catalogue not using VO standards and units, or issues within the votable module.
What do you think @jcsegovia and @pllim, which one is the case?
@DouglasBoubert - You can silence the warnings if you like, or just ignore them as they doesn't affect the functionality.
import warnings
warnings.filterwarnings("ignore")
I ran into this as well - thanks for the posted message on how to silence those warnings. Just a quick comment on a slightly safer way to do this. The solution above silences all warnings of any kind in your code. To only catch the specific warnings listed above, you can use:
warnings.filterwarnings("ignore", module='astropy.io.votable.tree')
instead. That way other warnings will still be seen.
EDIT: amended original code above; hadn't realized that the module name wasn't part of the message matched by the message field in filterwarnings, so it's better to just match on module name instead.
Most helpful comment
I ran into this as well - thanks for the posted message on how to silence those warnings. Just a quick comment on a slightly safer way to do this. The solution above silences all warnings of any kind in your code. To only catch the specific warnings listed above, you can use:
warnings.filterwarnings("ignore", module='astropy.io.votable.tree')instead. That way other warnings will still be seen.
EDIT: amended original code above; hadn't realized that the module name wasn't part of the message matched by the
messagefield infilterwarnings, so it's better to just match on module name instead.