🐛 Describe the bug
astropy.io.fits.open() no longer accepts HTTP URLs directly as of astropy 7.x. The notebook passes a URL string to fits.open(), which now raises OSError: No SIMPLE card found, this file does not appear to be a valid FITS file.
🕵️ Expected behavior
Notebook opens FITS files over HTTP and renders the BepiColombo image grid without error.
📜 To Reproduce
- Install
requirements-geo.txt
- Run
notebooks/discipline/geo/BepiColombo_FlybyVisualization.ipynb
- Cell that calls
fits.open(image_path) with an HTTP URL raises OSError
⚙️ Fix
Add fsspec and aiohttp to requirements-geo.txt and pass use_fsspec=True to fits.open(), or download the file to a temp path before opening:
# Option A
with fits.open(image_path, use_fsspec=True) as hdul:
image_data = hdul[1].data
# Option B
import tempfile, requests
with tempfile.NamedTemporaryFile(suffix='.fits') as tmp:
tmp.write(requests.get(image_path).content)
tmp.flush()
with fits.open(tmp.name) as hdul:
image_data = hdul[1].data
🖥 Environment Info
- astropy~=7.2.0, Python 3.13.1
🐛 Describe the bug
astropy.io.fits.open()no longer accepts HTTP URLs directly as of astropy 7.x. The notebook passes a URL string tofits.open(), which now raisesOSError: No SIMPLE card found, this file does not appear to be a valid FITS file.🕵️ Expected behavior
Notebook opens FITS files over HTTP and renders the BepiColombo image grid without error.
📜 To Reproduce
requirements-geo.txtnotebooks/discipline/geo/BepiColombo_FlybyVisualization.ipynbfits.open(image_path)with an HTTP URL raisesOSError⚙️ Fix
Add
fsspecandaiohttptorequirements-geo.txtand passuse_fsspec=Truetofits.open(), or download the file to a temp path before opening:🖥 Environment Info