-
-
Notifications
You must be signed in to change notification settings - Fork 423
Closed
Labels
Description
The following example results in an exception, KeyError: 'isSurveyMission'
:
>>> from astropy import units as u
>>> from astroquery.esasky import ESASky
>>> ESASky.query_region_maps('SMC', radius=1*u.deg, missions='Herschel')
It seems the expected property isSurveyMission
is not present in the JSON response. I was able to work around it like so, but I don't know if it's the most responsible solution:
diff --git a/astroquery/esasky/core.py b/astroquery/esasky/core.py
index cc630509..cc72e7c3 100644
--- a/astroquery/esasky/core.py
+++ b/astroquery/esasky/core.py
@@ -709,8 +709,8 @@ class ESASkyClass(BaseQuery):
for entry in metadata])
from_query = " FROM {}".format(json[self.__TAP_TABLE_STRING])
- if (radiusDeg != 0 or json[self.__IS_SURVEY_MISSION_STRING]):
- if (json[self.__IS_SURVEY_MISSION_STRING]):
+ if (radiusDeg != 0 or json.get(self.__IS_SURVEY_MISSION_STRING, False)):
+ if (json.get(self.__IS_SURVEY_MISSION_STRING, False)):
where_query = (" WHERE 1=CONTAINS(pos, CIRCLE('ICRS', {}, {}, {}));".
format(ra, dec, radiusDeg))
else:
After I apply this fix I get:
WARNING: W50: None:37:0: W50: Invalid unit string 'microns' [astropy.io.votable.tree]
WARNING: W50: None:43:0: W50: Invalid unit string 'seconds' [astropy.io.votable.tree]
Out[3]:
TableList with 1 tables:
'0:HERSCHEL' with 12 column(s) and 28 row(s)
which seems reasonable (the VOTable warnings are no surprise I suppose :)
Originally reported at astropy-learn/astropy-tutorials#463
HugoDelgado