Plotting Solar Orbiter PHI Data#

This example demonstrates how to plot Solar Orbiter PHI images.

The Polarimetric and Helioseismic Imager (PHI) is an imager on the Solar Orbiter mission. See this page for instrument details.

import matplotlib.pyplot as plt

import sunpy.map
from sunpy.net import Fido
from sunpy.net import attrs as a

Searching for PHI-HRT Data#

We first search for all Solar Orbiter PHI-HRT (High Resolution Telescope) data products # (excluding ‘phi-hrt-stokes’ which is not compatible with sunpy.map)

search_results_phi_hrt_all = Fido.search(a.Instrument('PHI'), a.Time('2024-03-23T20:00', '2024-03-23T23:59'),
                                         (a.soar.Product('phi-hrt-blos') | a.soar.Product('phi-hrt-bmag') |
                                          a.soar.Product('phi-hrt-binc') | a.soar.Product('phi-hrt-bazi')|
                                          a.soar.Product('phi-hrt-vlos') | a.soar.Product('phi-hrt-icnt')))

print(search_results_phi_hrt_all)
Results from 6 Providers:

0 Results from the SOARClient:
Errors: HTTPConnectionPool(host='soar.esac.esa.int', port=80): Read timed out. (read timeout=60)

<No columns>

3 Results from the SOARClient:

Instrument Data product Level        Start time               End time        Filesize          SOOP Name           Detector Wavelength
                                                                               Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------- -------- ----------
       PHI phi-hrt-bmag    L2 2024-03-23 22:30:09.921 2024-03-23 22:31:35.697   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341
       PHI phi-hrt-bmag    L2 2024-03-23 23:00:08.797 2024-03-23 23:01:34.683   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341
       PHI phi-hrt-bmag    L2 2024-03-23 23:30:08.808 2024-03-23 23:31:34.930   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341

3 Results from the SOARClient:

Instrument Data product Level        Start time               End time        Filesize          SOOP Name           Detector Wavelength
                                                                               Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------- -------- ----------
       PHI phi-hrt-binc    L2 2024-03-23 22:30:09.921 2024-03-23 22:31:35.697   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341
       PHI phi-hrt-binc    L2 2024-03-23 23:00:08.797 2024-03-23 23:01:34.683   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341
       PHI phi-hrt-binc    L2 2024-03-23 23:30:08.808 2024-03-23 23:31:34.930   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341

3 Results from the SOARClient:

Instrument Data product Level        Start time               End time        Filesize          SOOP Name           Detector Wavelength
                                                                               Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------- -------- ----------
       PHI phi-hrt-bazi    L2 2024-03-23 22:30:09.921 2024-03-23 22:31:35.697   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341
       PHI phi-hrt-bazi    L2 2024-03-23 23:00:08.797 2024-03-23 23:01:34.683   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341
       PHI phi-hrt-bazi    L2 2024-03-23 23:30:08.808 2024-03-23 23:31:34.930   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341

3 Results from the SOARClient:

Instrument Data product Level        Start time               End time        Filesize          SOOP Name           Detector Wavelength
                                                                               Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------- -------- ----------
       PHI phi-hrt-vlos    L2 2024-03-23 22:30:09.921 2024-03-23 22:31:35.697   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341
       PHI phi-hrt-vlos    L2 2024-03-23 23:00:08.797 2024-03-23 23:01:34.683   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341
       PHI phi-hrt-vlos    L2 2024-03-23 23:30:08.808 2024-03-23 23:31:34.930   17.001 L_BOTH_HRES_HCAD_Major-Flare      HRT   6173.341

0 Results from the SOARClient:
Errors: HTTPConnectionPool(host='soar.esac.esa.int', port=80): Read timed out. (read timeout=60)

<No columns>

Fetching the First Available PHI-HRT Files#

files_phi_hrt_all = Fido.fetch(search_results_phi_hrt_all[:, 0])
Traceback (most recent call last):
  File "/home/docs/checkouts/readthedocs.org/user_builds/sunpy/checkouts/latest/examples/plotting/phi_example.py", line 38, in <module>
    files_phi_hrt_all = Fido.fetch(search_results_phi_hrt_all[:, 0])
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/sunpy/net/fido_factory.py", line 116, in __getitem__
    ret.append(client_resp[aslice[1]])
               ~~~~~~~~~~~^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/astropy/table/table.py", line 2106, in __getitem__
    return self.Row(self, item)
           ~~~~~~~~^^^^^^^^^^^^
  File "/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/astropy/table/row.py", line 39, in __init__
    raise IndexError(
        f"index {index} out of range for table with length {len(table)}"
    )
IndexError: index 0 out of range for table with length 0

Loading and Plotting PHI-HRT Data#

phi_hrt_blos_map = sunpy.map.Map(files_phi_hrt_all[0])
phi_hrt_bmag_map = sunpy.map.Map(files_phi_hrt_all[1])
phi_hrt_binc_map = sunpy.map.Map(files_phi_hrt_all[2])
phi_hrt_bazi_map = sunpy.map.Map(files_phi_hrt_all[3])
phi_hrt_vlos_map = sunpy.map.Map(files_phi_hrt_all[4])
phi_hrt_icnt_map = sunpy.map.Map(files_phi_hrt_all[5])
phi_hrt_blos_map.plot()
plt.colorbar(label=phi_hrt_blos_map.unit.to_string())
plt.clim(-1500, 1500)
phi_hrt_bmag_map.plot()
plt.colorbar(label=phi_hrt_bmag_map.unit.to_string())
plt.clim(0, 2500)
phi_hrt_binc_map.plot()
plt.colorbar(label=phi_hrt_binc_map.unit.to_string())
phi_hrt_bazi_map.plot()
plt.colorbar(label=phi_hrt_bazi_map.unit.to_string())
phi_hrt_vlos_map.plot()
plt.colorbar(label=phi_hrt_vlos_map.unit.to_string())
plt.clim(-2, 2)
phi_hrt_icnt_map.plot()
plt.colorbar(label=phi_hrt_icnt_map.unit.to_string())
plt.clim(0, 1.2)

Searching for PHI-FDT Data#

We first search for all Solar Orbiter PHI-FDT (Full Disc Telescope) data products (excluding ‘phi-fdt-stokes’ which is not compatible with sunpy.map)

search_results_phi_fdt_all = Fido.search(a.Instrument('PHI'), a.Time('2025-02-25T20:00', '2025-02-25T23:59'),
                                          (a.soar.Product('phi-fdt-blos') | a.soar.Product('phi-fdt-bmag') |
                                            a.soar.Product('phi-fdt-binc') | a.soar.Product('phi-fdt-bazi')|
                                            a.soar.Product('phi-fdt-vlos')| a.soar.Product('phi-fdt-icnt')))

print(search_results_phi_fdt_all)

Fetching the First Available PHI-FDT File#

files_phi_fdt_all = Fido.fetch(search_results_phi_fdt_all)

Loading PHI-FDT Data#

We load each map and rotate to point Solar North up

phi_fdt_blos_map = sunpy.map.Map(files_phi_fdt_all[0]).rotate(recenter=True)
phi_fdt_bmag_map = sunpy.map.Map(files_phi_fdt_all[1]).rotate(recenter=True)
phi_fdt_binc_map = sunpy.map.Map(files_phi_fdt_all[2]).rotate(recenter=True)
phi_fdt_bazi_map = sunpy.map.Map(files_phi_fdt_all[3]).rotate(recenter=True)
phi_fdt_vlos_map = sunpy.map.Map(files_phi_fdt_all[4]).rotate(recenter=True)
phi_fdt_icnt_map = sunpy.map.Map(files_phi_fdt_all[5]).rotate(recenter=True)

Make a mask to mask out off-disc pixels and make new maps#

hpc_coords = sunpy.map.all_coordinates_from_map(phi_fdt_blos_map)
mask = ~sunpy.map.coordinate_is_on_solar_disk(hpc_coords)

phi_fdt_blos_map = sunpy.map.Map(phi_fdt_blos_map.data, phi_fdt_blos_map.meta, mask=mask)
phi_fdt_bmag_map = sunpy.map.Map(phi_fdt_bmag_map.data, phi_fdt_bmag_map.meta, mask=mask)
phi_fdt_binc_map = sunpy.map.Map(phi_fdt_binc_map.data, phi_fdt_binc_map.meta, mask=mask)
phi_fdt_bazi_map = sunpy.map.Map(phi_fdt_bazi_map.data, phi_fdt_bazi_map.meta, mask=mask)
phi_fdt_vlos_map = sunpy.map.Map(phi_fdt_vlos_map.data, phi_fdt_vlos_map.meta, mask=mask)
phi_fdt_icnt_map = sunpy.map.Map(phi_fdt_icnt_map.data, phi_fdt_icnt_map.meta, mask=mask)

Plotting PHI-FDT Data#

phi_fdt_blos_map.plot()
plt.colorbar(label=phi_fdt_blos_map.unit.to_string())
plt.clim(-1500, 1500)
phi_fdt_bmag_map.plot()
plt.colorbar(label=phi_fdt_bmag_map.unit.to_string())
plt.clim(0, 1500)
phi_fdt_binc_map.plot()
plt.colorbar(label=phi_fdt_binc_map.unit.to_string())
phi_fdt_bazi_map.plot()
plt.colorbar(label=phi_fdt_bazi_map.unit.to_string())
phi_fdt_vlos_map.plot()
plt.colorbar(label=phi_fdt_vlos_map.unit.to_string())
plt.clim(-2, 2)
phi_fdt_icnt_map.plot()
plt.colorbar(label=phi_fdt_icnt_map.unit.to_string())
plt.clim(0, 1.2)

Total running time of the script: (3 minutes 54.826 seconds)

🏷 Tags: Visualization, SOAR, Solar Orbiter, PHI

Gallery generated by Sphinx-Gallery