Astroquery: ESASky.query_region_maps: expected property missing from Herschel data

Created on 14 Oct 2020  路  3Comments  路  Source: astropy/astroquery

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/astropy-tutorials#463

changed remote API esasky

Most helpful comment

Thanks for reporting this. We have changed the jsons slightly in the latest release of ESASky & forgot to properly change the astroquery module. I'll fix it today.

Cheers,
Henrik

All 3 comments

1446 says maybe @imbasimba can advise?

the VOTable warnings are no surprise I suppose

Yeah... 馃槵

Thanks for reporting this. We have changed the jsons slightly in the latest release of ESASky & forgot to properly change the astroquery module. I'll fix it today.

Cheers,
Henrik

Fixed in this PR #1858

Cheers,
Henrik

Was this page helpful?
0 / 5 - 0 ratings