Note
Go to the end to download the full example code.
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:
3 Results from the SOARClient:
Instrument Data product Level Start time End time Filesize SOOP Name Detector Wavelength
Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------- -------- ----------
PHI phi-hrt-blos 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-blos 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-blos 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-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
3 Results from the SOARClient:
Instrument Data product Level Start time End time Filesize SOOP Name Detector Wavelength
Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------- -------- ----------
PHI phi-hrt-icnt 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-icnt 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-icnt 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
Fetching the First Available PHI-HRT Files#
files_phi_hrt_all = Fido.fetch(search_results_phi_hrt_all[:, 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])
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/sunpy/map/sources/solo.py:147: SunpyUserWarning: The WCS of this SO/PHI-HRT PHIMap may not be fully calibrated. Use caution when using the WCS for scientific analysis.
warn_user("The WCS of this SO/PHI-HRT PHIMap may not be fully calibrated. "
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())

<matplotlib.colorbar.Colorbar object at 0x7275f31b1810>
phi_hrt_bazi_map.plot()
plt.colorbar(label=phi_hrt_bazi_map.unit.to_string())

<matplotlib.colorbar.Colorbar object at 0x7275f3128f50>
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)
Results from 6 Providers:
1 Results from the SOARClient:
Instrument Data product Level Start time End time Filesize SOOP Name Detector Wavelength
Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------------- -------- ----------
PHI phi-fdt-blos L2 2025-02-25 21:15:09.335 2025-02-25 21:18:33.049 4.556 R_FULL_LRES_LCAD_RS-Synoptics-High FDT 6173.341
1 Results from the SOARClient:
Instrument Data product Level Start time End time Filesize SOOP Name Detector Wavelength
Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------------- -------- ----------
PHI phi-fdt-bmag L2 2025-02-25 21:15:09.335 2025-02-25 21:18:33.049 4.556 R_FULL_LRES_LCAD_RS-Synoptics-High FDT 6173.341
1 Results from the SOARClient:
Instrument Data product Level Start time End time Filesize SOOP Name Detector Wavelength
Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------------- -------- ----------
PHI phi-fdt-binc L2 2025-02-25 21:15:09.335 2025-02-25 21:18:33.049 4.556 R_FULL_LRES_LCAD_RS-Synoptics-High FDT 6173.341
1 Results from the SOARClient:
Instrument Data product Level Start time End time Filesize SOOP Name Detector Wavelength
Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------------- -------- ----------
PHI phi-fdt-bazi L2 2025-02-25 21:15:09.335 2025-02-25 21:18:33.049 4.556 R_FULL_LRES_LCAD_RS-Synoptics-High FDT 6173.341
1 Results from the SOARClient:
Instrument Data product Level Start time End time Filesize SOOP Name Detector Wavelength
Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------------- -------- ----------
PHI phi-fdt-vlos L2 2025-02-25 21:15:09.335 2025-02-25 21:18:33.049 4.556 R_FULL_LRES_LCAD_RS-Synoptics-High FDT 6173.341
1 Results from the SOARClient:
Instrument Data product Level Start time End time Filesize SOOP Name Detector Wavelength
Mbyte
---------- ------------ ----- ----------------------- ----------------------- -------- ---------------------------------- -------- ----------
PHI phi-fdt-icnt L2 2025-02-25 21:15:09.335 2025-02-25 21:18:33.049 4.556 R_FULL_LRES_LCAD_RS-Synoptics-High FDT 6173.341
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)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/sunpy/map/sources/solo.py:156: SunpyUserWarning: This dataset was generated using on-board averaging of 3 individual observations.
warn_user(f"This dataset was generated using on-board averaging of {accumulations} individual observations.")
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/sunpy/map/sources/solo.py:156: SunpyUserWarning: This dataset was generated using on-board averaging of 3 individual observations.
warn_user(f"This dataset was generated using on-board averaging of {accumulations} individual observations.")
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/sunpy/map/sources/solo.py:156: SunpyUserWarning: This dataset was generated using on-board averaging of 3 individual observations.
warn_user(f"This dataset was generated using on-board averaging of {accumulations} individual observations.")
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/sunpy/map/sources/solo.py:156: SunpyUserWarning: This dataset was generated using on-board averaging of 3 individual observations.
warn_user(f"This dataset was generated using on-board averaging of {accumulations} individual observations.")
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/sunpy/map/sources/solo.py:156: SunpyUserWarning: This dataset was generated using on-board averaging of 3 individual observations.
warn_user(f"This dataset was generated using on-board averaging of {accumulations} individual observations.")
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/sunpy/map/sources/solo.py:156: SunpyUserWarning: This dataset was generated using on-board averaging of 3 individual observations.
warn_user(f"This dataset was generated using on-board averaging of {accumulations} individual observations.")
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/sunpy/map/sources/solo.py:156: SunpyUserWarning: This dataset was generated using on-board averaging of 3 individual observations.
warn_user(f"This dataset was generated using on-board averaging of {accumulations} individual observations.")
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)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/latest/lib/python3.13/site-packages/sunpy/map/sources/solo.py:156: SunpyUserWarning: This dataset was generated using on-board averaging of 3 individual observations.
warn_user(f"This dataset was generated using on-board averaging of {accumulations} individual observations.")
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())

<matplotlib.colorbar.Colorbar object at 0x7275f0701590>
phi_fdt_bazi_map.plot()
plt.colorbar(label=phi_fdt_bazi_map.unit.to_string())

<matplotlib.colorbar.Colorbar object at 0x7275f0703c50>
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: (0 minutes 47.019 seconds)