Repository navigation
Closed
Description
Dear all,
Using the following code:
from astroquery.esasky import ESASky
ESASky.list_maps()
maps = ESASky.query_object_maps('13 29 52.7 +47 11 43')
maps_data = ESASky.get_maps(maps,'all', download_dir = '/Users/astro_user/Downloads')
I get a long list of warning for HST only (the other mission work perfectly), like:
> WARNING: The following header keyword is invalid or follows an unrecognized non-standard convention:
�����������������������������������������������������������������ustar�00������� [astropy.io.fits.card]
Which finally ends with generating the following error messages and stops the download process:
> Downloading Observation ID: n48r020n0 from http://archives.esac.esa.int/ehst-sl-server/servlet/data-action?RETRIEVAL_TYPE=PRODUCT&OBSERVATION_ID=n48r020n0 Traceback (most recent call last):
File "<ipython-input-2-d0bbe0f5ca3a>", line 1, in <module>
maps_data = ESASky.get_maps(maps,'HST', download_dir = '/Users/Bastian/Downloads')
File "/anaconda3/lib/python3.6/site-packages/astroquery/esasky/core.py", line 374, in get_maps
cache))
File "/anaconda3/lib/python3.6/site-packages/astroquery/esasky/core.py", line 548, in _get_maps_for_mission
maps.append(fits.open(file_name))
File "/anaconda3/lib/python3.6/site-packages/astropy/io/fits/hdu/hdulist.py", line 164, in fitsopen
lazy_load_hdus, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/astropy/io/fits/hdu/hdulist.py", line 400, in fromfile
lazy_load_hdus=lazy_load_hdus, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/astropy/io/fits/hdu/hdulist.py", line 1012, in _readfrom
read_one = hdulist._read_next_hdu()
File "/anaconda3/lib/python3.6/site-packages/astropy/io/fits/hdu/hdulist.py", line 1087, in _read_next_hdu
hdu = _BaseHDU.readfrom(fileobj, **kwargs)
File "/anaconda3/lib/python3.6/site-packages/astropy/io/fits/hdu/base.py", line 328, in readfrom
**kwargs)
File "/anaconda3/lib/python3.6/site-packages/astropy/io/fits/hdu/base.py", line 393, in _readfrom_internal
header = Header.fromfile(data, endcard=not ignore_missing_end)
File "/anaconda3/lib/python3.6/site-packages/astropy/io/fits/header.py", line 447, in fromfile
padding)[1]
File "/anaconda3/lib/python3.6/site-packages/astropy/io/fits/header.py", line 516, in _from_blocks
raise OSError('Header missing END card.')
OSError: Header missing END card.
Many thanks for your help.
Best,
Bastian
Activity
bsipocz commentedon Jun 17, 2018
I got a messed up terminal while trying to reproduce, but after a reset and go into the debugger, rerunning the offending line got this.
Then the full traceback when trying to open the file:
On the other hand I think it's worth reporting this upstream to the archives as imo they should aim to provide fits files that follows the fits standard.Update: When reading the fits files individually, no warnings are issued, so there is nothing wrong with the archives.bsipocz commentedon Jun 17, 2018
Ohh, actually, with a more careful look it seems that the tar file contains two fits files.
Reading them and accessing the header works perfectly fine. So this is an issue for astroquery that the esasky module should handle those tar files.
For astropy.io.fits the task could be to provide a better error message that suggest that it wasn't really a fits file it tried to read in.
[-]astroquery.esasky warning about astropy.io.fits.card[/-][+]fits.open should gracefully exit when it's given a non FITS file[/+][-]fits.open should gracefully exit when it's given a non FITS file[/-][+]fits.open should raise useful exception when it's given a non FITS file[/+]astrofrog commentedon Jun 17, 2018
I think all FITS files are required to start with
SIMPLE- so maybe we could check for that? (note that we need to be careful about reading in compressed files though)