Skip to content

eis_pointing.utils.aia.get_fits() downloads empty AIA fits files #4

@yjzhu-solar

Description

@yjzhu-solar

When I was running compute_eis_pointing in command lines, I got an error because the AIA files used to build the synthetic raster are not properly downloaded.

[2024-03-25 14:01:13.525676] skipping compute_eis_aia_emission
[2024-03-25 14:01:13.525775] running compute_pointing to make 1 target
/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/eis_pointing/eis_aia_registration.py:378: UserWarning: No steps file provided, falling back to default.
  warnings.warn('No steps file provided, falling back to default.')
[2024-03-25 14:01:13.529208] > build relative and absolute date arrays
[2024-03-25 14:01:13.548018] > get EIS grid info and add margin
[2024-03-25 14:01:13.549017] > get AIA data
Loading client : https://idoc-medoc.ias.u-psud.fr
65 results returned
filename defined by user : aia.lev1.193A_2022-10-25T01-47-28.image_lev1.fits
Download file ./sdo/aia/level1/2022/10/25/aia.lev1.193A_2022-10-25T01-47-28.image_lev1.fits completed
Traceback (most recent call last):
  File "/home/yjzhu/anaconda3/envs/eis_pointing/bin/compute_eis_pointing", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/eis_pointing/driver_cli.py", line 38, in main
    compute(
  File "/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/eis_pointing/driver.py", line 193, in compute
    make(filenames['pointing'], filenames['eis_aia_emission'],
  File "/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/eis_pointing/driver.py", line 78, in make
    return_value = method(
                   ^^^^^^^
  File "/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/eis_pointing/driver.py", line 149, in compute_pointing
    pointing = eis_aia_registration.optimal_pointing(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/eis_pointing/eis_aia_registration.py", line 429, in optimal_pointing
    raster_builder.get_data()
  File "/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/eis_pointing/utils/aia_raster.py", line 333, in get_data
    return self._download_data(rotate, update_cache)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/eis_pointing/utils/aia_raster.py", line 178, in _download_data
    primary, img = fits.open(fits_path)
                   ^^^^^^^^^^^^^^^^^^^^
  File "/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/astropy/io/fits/hdu/hdulist.py", line 222, in fitsopen
    return HDUList.fromfile(
           ^^^^^^^^^^^^^^^^^
  File "/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/astropy/io/fits/hdu/hdulist.py", line 486, in fromfile
    return cls._readfrom(
           ^^^^^^^^^^^^^^
  File "/home/yjzhu/anaconda3/envs/eis_pointing/lib/python3.12/site-packages/astropy/io/fits/hdu/hdulist.py", line 1236, in _readfrom
    raise OSError("Empty or corrupt FITS file")
OSError: Empty or corrupt FITS file

It is because the filename given by filename_from_medoc_result is passed to Method get_file() of Class SdoData in sitools2. In lines 270-272 of sitools.clients.sdo_data.py

        segment, segment_allowed, url = self.scan_segment(segment,
                                                          filename,
                                                          ias_path)

filename is the name of the downloaded FITS, However, it does not perfectly match the requirements of self.scan_segment(), which gives an incorrect URL to download. A dirty fix would be replacing filename by None.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions