diff --git a/astroquery/esasky/core.py b/astroquery/esasky/core.py index fe5e71a150..5de2c83fb1 100644 --- a/astroquery/esasky/core.py +++ b/astroquery/esasky/core.py @@ -54,6 +54,7 @@ class ESASkyClass(BaseQuery): __TAP_DEC_COLUMN_STRING = "tapDecColumn" __METADATA_STRING = "metadata" __PRODUCT_URL_STRING = "product_url" + __EROSITA_PRODUCT_URL_STRING = "prod_url" __ACCESS_URL_STRING = "access_url" __USE_INTERSECT_STRING = "useIntersectPolygonInsteadOfContainsPoint" __ZERO_ARCMIN_STRING = "0 arcmin" @@ -1464,6 +1465,8 @@ def _get_maps_for_mission(self, maps_table, mission, download_dir, cache, json, url_key = self.__PRODUCT_URL_STRING if url_key == "" and self.__ACCESS_URL_STRING in maps_table.keys(): url_key = self.__ACCESS_URL_STRING + if url_key == "" and mission == 'EROSITA': + url_key = self.__EROSITA_PRODUCT_URL_STRING if url_key == "" or mission == "ALMA": log.info(mission + " does not yet support downloading of fits files") return maps @@ -1527,6 +1530,15 @@ def _get_maps_for_mission(self, maps_table, mission, download_dir, cache, json, if self._ends_with_fits_like_extentsion(info.filename): maps.append(self._open_fits( zip.extract(info.filename, path=mission_directory), verbose=verbose)) + elif ('Content-Type' in response.headers and + response.headers['Content-Type'] == 'application/x-gzip'): + with esatar.open(name='dummy', mode='r', fileobj=BytesIO(response.content)) as tar: + for file in tar.getmembers(): + if self._ends_with_fits_like_extentsion(file.name): + file.name = os.path.basename(file.name) + tar.extract(file, path=mission_directory) + maps.append(self._open_fits( + Path(mission_directory, file.name), verbose=verbose)) else: file_name = self._extract_file_name_from_response_header(response.headers) if file_name == "": diff --git a/astroquery/esasky/tests/test_esasky_remote.py b/astroquery/esasky/tests/test_esasky_remote.py index 9434dda82c..9f43ed294e 100755 --- a/astroquery/esasky/tests/test_esasky_remote.py +++ b/astroquery/esasky/tests/test_esasky_remote.py @@ -124,6 +124,15 @@ def test_esasky_get_images(self, tmp_path, mission): for hdu_list in result[mission.upper()]: hdu_list.close() + @pytest.mark.bigdata + def test_esasky_get_images_for_erosita(self, tmp_path): + mission = 'eROSITA' + result = ESASky.get_images(position="67.84 -61.44", missions=mission, download_dir=tmp_path) + assert tmp_path.stat().st_size + + for hdu_list in result[mission.upper()]: + hdu_list.close() + @pytest.mark.bigdata @pytest.mark.parametrize('mission, position', zip(['JWST-MID-IR', 'JWST-NEAR-IR'],