genghisken / ps1

Pan-STARRS and ATLAS code
3 stars 0 forks source link

Postage stamp downloader occasionally falls over with IOError - leaving objects with no RB factors #165

Open genghisken opened 4 years ago

genghisken commented 4 years ago

Downloading stamps occasionally falls over with the error below. This leaves batches of images with no RB factors because the summary image ID is not attached to the object, which is the last stage of the downloading process for a batch of images. Not sure if the FITS file I'm downloading from Hawaii is malformed or the download process has failed or corrupted the file somehow. Logging this here for investigation.

Traceback (most recent call last):
  File "/usr/local/swtools/python/pstc/anaconda3/envs/panstarrs/lib/python2.7/multiprocessing/process.py", line 267, in _bootstrap
    self.run()
  File "/usr/local/swtools/python/pstc/anaconda3/envs/panstarrs/lib/python2.7/multiprocessing/process.py", line 114, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/ps1code/gitrelease/ps1yse/code/experimental/pstamp/python/pstampGetResultsMultiprocess.py", line 39, in worker
    downloadPostageStampResults(conn, requests, PSSImageRootLocation)
  File "/usr/local/ps1code/gitrelease/ps1yse/code/experimental/pstamp/python/pstamp_get_results.py", line 168, in downloadPostageStampResults
    if downloadAllPostageStampImages(conn, requestName, PSSImageRootLocation) == 0:
  File "/usr/local/ps1code/gitrelease/ps1yse/code/experimental/pstamp/python/pstamp_get_results.py", line 129, in downloadAllPostageStampImages
    downloadStatus = downloadPostageStampImage(conn, requestName, fitsRow, dataStoreFileInfo, PSSImageRootLocation)
  File "/usr/local/ps1code/gitrelease/ps1yse/code/experimental/pstamp/python/pstamp_utils.py", line 776, in downloadPostageStampImage
    hdus = pf.open(absoluteLocalImageName)
  File "/usr/local/swtools/python/pstc/anaconda3/envs/panstarrs/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 148, in fitsopen
    lazy_load_hdus, **kwargs)
  File "/usr/local/swtools/python/pstc/anaconda3/envs/panstarrs/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 402, in fromfile
    lazy_load_hdus=lazy_load_hdus, **kwargs)
  File "/usr/local/swtools/python/pstc/anaconda3/envs/panstarrs/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 1031, in _readfrom
    read_one = hdulist._read_next_hdu()
  File "/usr/local/swtools/python/pstc/anaconda3/envs/panstarrs/lib/python2.7/site-packages/astropy/io/fits/hdu/hdulist.py", line 1106, in _read_next_hdu
    hdu = _BaseHDU.readfrom(fileobj, **kwargs)
  File "/usr/local/swtools/python/pstc/anaconda3/envs/panstarrs/lib/python2.7/site-packages/astropy/io/fits/hdu/base.py", line 332, in readfrom
    **kwargs)
  File "/usr/local/swtools/python/pstc/anaconda3/envs/panstarrs/lib/python2.7/site-packages/astropy/io/fits/hdu/base.py", line 397, in _readfrom_internal
    header = Header.fromfile(data, endcard=not ignore_missing_end)
  File "/usr/local/swtools/python/pstc/anaconda3/envs/panstarrs/lib/python2.7/site-packages/astropy/io/fits/header.py", line 449, in fromfile
    padding)[1]
  File "/usr/local/swtools/python/pstc/anaconda3/envs/panstarrs/lib/python2.7/site-packages/astropy/io/fits/header.py", line 518, in _from_blocks
    raise IOError('Header missing END card.')
IOError: Header missing END card.