Querying PUNCH Data#

A notebook guide to querying and loading PUNCH data using SunPy.

This notebook provides a guide on how to use tools to query PUNCH data from the VSO / SDAC using Python tools, and how to load and display this data using SunPy.

Load libraries

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

from punchbowl.data.visualize import cmap_punch

Data querying#

With a range of dates and a PUNCH instrument in mind, we can begin querying data. Here we’ll consider data from the first hour of the first of June, and focus on data from WFI-2 only.

We can construct a query using the Fido tool, specifying search attributes:

time_range = a.Time('2025/06/01 00:00:00', '2025/06/01 01:00:00')
result = Fido.search(time_range, a.Instrument('WFI-2'))
result
Results from 1 Provider:

37 Results from the VSOClient:
VSOQueryResponseTable length=37
Start TimeEnd TimeInstrumentWavelengthProviderPhysobsWavetypeExtent XExtent YExtent WidthExtent LengthExtent TypeSize
nmMibyte
TimeTimestr5float64[2]str10str9str7str8str8str17str16str11float64
2025-06-01 00:00:17.0002025-06-01 00:00:41.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible19.667314.47310.19555555284023350.0622215270996FAR_OFF_SUN1.51074
2025-06-01 00:00:17.0002025-06-01 00:00:41.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible18.872614.76810.78222221136093150.0622215270996FAR_OFF_SUN6.30371
2025-06-01 00:05:01.0002025-06-01 00:05:52.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible10.043822.1830.19555555284023350.0622215270996FAR_OFF_SUN1.55762
2025-06-01 00:06:05.0002025-06-01 00:06:56.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible10.057822.17830.19555555284023350.0622215270996FAR_OFF_SUN1.57129
2025-06-01 00:07:07.0002025-06-01 00:07:58.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible10.058522.17790.19555555284023350.0622215270996FAR_OFF_SUN1.58203
2025-06-01 00:08:17.0002025-06-01 00:08:41.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible10.0622.1780.19555555284023350.0622215270996FAR_OFF_SUN1.58203
2025-06-01 00:08:17.0002025-06-01 00:08:41.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible9.1782522.0260.78222221136093150.0622215270996FAR_OFF_SUN6.27637
2025-06-01 00:13:00.0002025-06-01 00:13:51.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-3.0602524.06380.19555555284023350.0622215270996FAR_OFF_SUN1.58496
2025-06-01 00:14:05.0002025-06-01 00:14:56.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-3.0484324.06680.19555555284023350.0622215270996FAR_OFF_SUN1.59863
.......................................
2025-06-01 00:46:05.0002025-06-01 00:46:56.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-20.4159-13.37410.19555555284023350.0622215270996FAR_OFF_SUN1.64551
2025-06-01 00:47:07.0002025-06-01 00:47:58.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-20.4151-13.3730.19555555284023350.0622215270996FAR_OFF_SUN1.65332
2025-06-01 00:48:17.0002025-06-01 00:48:41.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-20.4148-13.37280.19555555284023350.0622215270996FAR_OFF_SUN1.65625
2025-06-01 00:48:17.0002025-06-01 00:48:41.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-19.6241-13.71270.78222221136093150.0622215270996FAR_OFF_SUN6.29004
2025-06-01 00:53:01.0002025-06-01 00:53:52.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-11.3829-21.55310.19555555284023350.0622215270996FAR_OFF_SUN1.60156
2025-06-01 00:54:05.0002025-06-01 00:54:56.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-11.395-21.54790.19555555284023350.0622215270996FAR_OFF_SUN1.61816
2025-06-01 00:55:07.0002025-06-01 00:55:58.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-11.3954-21.54690.19555555284023350.0622215270996FAR_OFF_SUN1.62598
2025-06-01 00:56:17.0002025-06-01 00:56:41.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-11.395-21.54690.19555555284023350.0622215270996FAR_OFF_SUN1.63184
2025-06-01 00:56:17.0002025-06-01 00:56:41.000WFI-2530.0 .. 530.0SDAC_PUNCHintensityvisible-10.5481-21.48990.78222221136093150.0622215270996FAR_OFF_SUN6.30371



This results in a table of available data products that match the search criteria. Next, let’s download the first file from this list of results:

files = Fido.fetch(result)
Files Downloaded:   0%|          | 0/37 [00:00<?, ?file/s]



PUNCH_L0_PM2_20250601000526_v0a.fits:   0%|          | 0.00/1.63M [00:00<?, ?B/s]





PUNCH_L0_PP2_20250601000732_v0a.fits:   0%|          | 0.00/1.66M [00:00<?, ?B/s]

PUNCH_L0_CR2_20250601000029_v0a.fits:   0%|          | 0.00/1.58M [00:00<?, ?B/s]




PUNCH_L0_PZ2_20250601000630_v0a.fits:   0%|          | 0.00/1.65M [00:00<?, ?B/s]



PUNCH_L0_PM2_20250601000526_v0a.fits:  26%|██▌       | 424k/1.63M [00:00<00:00, 4.19MB/s]





PUNCH_L0_PP2_20250601000732_v0a.fits:  32%|███▏      | 528k/1.66M [00:00<00:00, 5.25MB/s]

PUNCH_L0_CR2_20250601000029_v0a.fits:  20%|██        | 320k/1.58M [00:00<00:00, 3.18MB/s]




PUNCH_L0_PZ2_20250601000630_v0a.fits:  11%|█         | 176k/1.65M [00:00<00:00, 1.75MB/s]






Files Downloaded:   3%|▎         | 1/37 [00:00<00:14,  2.41file/s]








PUNCH_L0_CR2_20250601000829_v0a.fits:   0%|          | 0.00/1.66M [00:00<?, ?B/s]






PUNCH_L0_PZ2_20250601001430_v0a.fits:   0%|          | 0.00/1.68M [00:00<?, ?B/s]



PUNCH_L0_PM2_20250601001326_v0a.fits:   0%|          | 0.00/1.66M [00:00<?, ?B/s]




PUNCH_L0_PP2_20250601001532_v0a.fits:   0%|          | 0.00/1.68M [00:00<?, ?B/s]


PUNCH_L0_CR2_20250601000829_v0a.fits:  14%|█▍        | 240k/1.66M [00:00<00:00, 2.38MB/s]

PUNCH_L0_PZ2_20250601001430_v0a.fits:  25%|██▌       | 424k/1.68M [00:00<00:00, 4.22MB/s]



PUNCH_L0_PM2_20250601001326_v0a.fits:  30%|███       | 500k/1.66M [00:00<00:00, 5.00MB/s]




PUNCH_L0_PP2_20250601001532_v0a.fits:  21%|██▏       | 360k/1.68M [00:00<00:00, 3.59MB/s]



Files Downloaded:  14%|█▎        | 5/37 [00:00<00:03,  9.71file/s]





PUNCH_L0_CR2_20250601001629_v0a.fits:   0%|          | 0.00/1.69M [00:00<?, ?B/s]














PUNCH_L0_PM2_20250601002126_v0a.fits:   0%|          | 0.00/1.64M [00:00<?, ?B/s]

PUNCH_L0_PZ2_20250601002230_v0a.fits:   0%|          | 0.00/1.66M [00:00<?, ?B/s]




PUNCH_L0_PP2_20250601002332_v0a.fits:   0%|          | 0.00/1.67M [00:00<?, ?B/s]





PUNCH_L0_CR2_20250601001629_v0a.fits:  32%|███▏      | 536k/1.69M [00:00<00:00, 5.06MB/s]






Files Downloaded:  24%|██▍       | 9/37 [00:00<00:01, 15.03file/s]



PUNCH_L0_PM2_20250601002126_v0a.fits:  25%|██▍       | 409k/1.64M [00:00<00:00, 4.09MB/s]

PUNCH_L0_PZ2_20250601002230_v0a.fits:  20%|█▉        | 328k/1.66M [00:00<00:00, 3.28MB/s]




PUNCH_L0_PP2_20250601002332_v0a.fits:  24%|██▍       | 403k/1.67M [00:00<00:00, 4.03MB/s]













PUNCH_L0_CR2_20250601002429_v0a.fits:   0%|          | 0.00/1.67M [00:00<?, ?B/s]




PUNCH_L0_PP2_20250601003132_v0a.fits:   0%|          | 0.00/1.67M [00:00<?, ?B/s]



PUNCH_L0_PZ2_20250601003030_v0a.fits:   0%|          | 0.00/1.67M [00:00<?, ?B/s]

PUNCH_L0_PM2_20250601002926_v0a.fits:   0%|          | 0.00/1.66M [00:00<?, ?B/s]


PUNCH_L0_CR2_20250601002429_v0a.fits:   3%|▎         | 56.2k/1.67M [00:00<00:02, 562kB/s]



Files Downloaded:  35%|███▌      | 13/37 [00:01<00:01, 14.31file/s]





PUNCH_L0_CR2_20250601003229_v0a.fits:   0%|          | 0.00/1.68M [00:00<?, ?B/s]




PUNCH_L0_PP2_20250601003132_v0a.fits:  14%|█▍        | 231k/1.67M [00:00<00:00, 2.31MB/s]



PUNCH_L0_PZ2_20250601003030_v0a.fits:  28%|██▊       | 472k/1.67M [00:00<00:00, 4.63MB/s]

PUNCH_L0_PM2_20250601002926_v0a.fits:  24%|██▎       | 392k/1.66M [00:00<00:00, 3.88MB/s]
















PUNCH_L0_CR2_20250601003229_v0a.fits:  20%|██        | 336k/1.68M [00:00<00:00, 3.36MB/s]



PUNCH_L0_PM2_20250601003726_v0a.fits:   0%|          | 0.00/1.68M [00:00<?, ?B/s]

PUNCH_L0_PZ2_20250601003830_v0a.fits:   0%|          | 0.00/1.70M [00:00<?, ?B/s]




PUNCH_L0_PP2_20250601003932_v0a.fits:   0%|          | 0.00/1.70M [00:00<?, ?B/s]






Files Downloaded:  46%|████▌     | 17/37 [00:01<00:01, 17.08file/s]


PUNCH_L0_CR2_20250601004029_v0a.fits:   0%|          | 0.00/1.71M [00:00<?, ?B/s]



PUNCH_L0_PM2_20250601003726_v0a.fits:  17%|█▋        | 288k/1.68M [00:00<00:00, 2.86MB/s]

PUNCH_L0_PZ2_20250601003830_v0a.fits:  20%|█▉        | 336k/1.70M [00:00<00:00, 3.34MB/s]




PUNCH_L0_PP2_20250601003932_v0a.fits:  35%|███▍      | 592k/1.70M [00:00<00:00, 5.90MB/s]




PUNCH_L0_CR2_20250601004029_v0a.fits:   6%|▌         | 96.9k/1.71M [00:00<00:01, 967kB/s]




Files Downloaded:  51%|█████▏    | 19/37 [00:01<00:01, 16.57file/s]






PUNCH_L0_PM2_20250601004526_v0a.fits:   0%|          | 0.00/1.71M [00:00<?, ?B/s]



PUNCH_L0_PZ2_20250601004630_v0a.fits:   0%|          | 0.00/1.73M [00:00<?, ?B/s]




PUNCH_L0_PP2_20250601004732_v0a.fits:   0%|          | 0.00/1.73M [00:00<?, ?B/s]


PUNCH_L0_CR2_20250601004029_v0a.fits:  53%|█████▎    | 906k/1.71M [00:00<00:00, 5.16MB/s]



Files Downloaded:  57%|█████▋    | 21/37 [00:01<00:00, 16.66file/s]





PUNCH_L0_CR2_20250601004829_v0a.fits:   0%|          | 0.00/1.74M [00:00<?, ?B/s]

PUNCH_L0_PM2_20250601004526_v0a.fits:  32%|███▏      | 545k/1.71M [00:00<00:00, 5.45MB/s]



PUNCH_L0_PZ2_20250601004630_v0a.fits:  26%|██▌       | 448k/1.73M [00:00<00:00, 4.45MB/s]






PUNCH_L0_PP2_20250601004732_v0a.fits:  39%|███▊      | 669k/1.73M [00:00<00:00, 6.69MB/s]




Files Downloaded:  62%|██████▏   | 23/37 [00:01<00:00, 17.26file/s]










PUNCH_L0_CR2_20250601004829_v0a.fits:   0%|          | 1.02k/1.74M [00:00<03:54, 7.41kB/s]

PUNCH_L0_PM2_20250601005326_v0a.fits:   0%|          | 0.00/1.68M [00:00<?, ?B/s]



PUNCH_L0_PZ2_20250601005430_v0a.fits:   0%|          | 0.00/1.70M [00:00<?, ?B/s]




PUNCH_L0_PP2_20250601005532_v0a.fits:   0%|          | 0.00/1.70M [00:00<?, ?B/s]






Files Downloaded:  68%|██████▊   | 25/37 [00:01<00:00, 17.15file/s]

PUNCH_L0_PM2_20250601005326_v0a.fits:  22%|██▏       | 368k/1.68M [00:00<00:00, 3.68MB/s]



PUNCH_L0_PZ2_20250601005430_v0a.fits:  21%|██        | 360k/1.70M [00:00<00:00, 3.59MB/s]


PUNCH_L0_CR2_20250601005629_v0a.fits:   0%|          | 0.00/1.71M [00:00<?, ?B/s]




PUNCH_L0_PP2_20250601005532_v0a.fits:  27%|██▋       | 457k/1.70M [00:00<00:00, 4.57MB/s]













PUNCH_L0_CR2_20250601005629_v0a.fits:  21%|██▏       | 368k/1.71M [00:00<00:00, 3.68MB/s]



Files Downloaded:  78%|███████▊  | 29/37 [00:01<00:00, 18.26file/s]

8/0 files failed to download. Please check `.errors` for details

Files Downloaded:  78%|███████▊  | 29/37 [00:01<00:00, 18.26file/s]2025-07-03 15:15:20 - parfive - INFO: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601000029_v0a.fits failed to download with exception
Download Failed: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601000029_v0a.fits with error <ClientResponse(https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601000029_v0a.fits) [404 Not Found]>
<CIMultiDictProxy('Date': 'Thu, 03 Jul 2025 15:15:18 GMT', 'Server': 'Apache', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Content-Length': '196', 'Connection': 'close', 'Content-Type': 'text/html; charset=iso-8859-1')>

2025-07-03 15:15:20 - parfive - INFO: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601000829_v0a.fits failed to download with exception
Download Failed: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601000829_v0a.fits with error <ClientResponse(https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601000829_v0a.fits) [404 Not Found]>
<CIMultiDictProxy('Date': 'Thu, 03 Jul 2025 15:15:18 GMT', 'Server': 'Apache', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Content-Length': '196', 'Connection': 'close', 'Content-Type': 'text/html; charset=iso-8859-1')>

2025-07-03 15:15:20 - parfive - INFO: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601001629_v0a.fits failed to download with exception
Download Failed: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601001629_v0a.fits with error <ClientResponse(https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601001629_v0a.fits) [404 Not Found]>
<CIMultiDictProxy('Date': 'Thu, 03 Jul 2025 15:15:18 GMT', 'Server': 'Apache', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Content-Length': '196', 'Connection': 'close', 'Content-Type': 'text/html; charset=iso-8859-1')>

2025-07-03 15:15:20 - parfive - INFO: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601002429_v0a.fits failed to download with exception
Download Failed: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601002429_v0a.fits with error <ClientResponse(https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601002429_v0a.fits) [404 Not Found]>
<CIMultiDictProxy('Date': 'Thu, 03 Jul 2025 15:15:19 GMT', 'Server': 'Apache', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Content-Length': '196', 'Connection': 'close', 'Content-Type': 'text/html; charset=iso-8859-1')>

2025-07-03 15:15:20 - parfive - INFO: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601003229_v0a.fits failed to download with exception
Download Failed: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601003229_v0a.fits with error <ClientResponse(https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601003229_v0a.fits) [404 Not Found]>
<CIMultiDictProxy('Date': 'Thu, 03 Jul 2025 15:15:19 GMT', 'Server': 'Apache', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Content-Length': '196', 'Connection': 'close', 'Content-Type': 'text/html; charset=iso-8859-1')>

2025-07-03 15:15:20 - parfive - INFO: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601004029_v0a.fits failed to download with exception
Download Failed: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601004029_v0a.fits with error <ClientResponse(https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601004029_v0a.fits) [404 Not Found]>
<CIMultiDictProxy('Date': 'Thu, 03 Jul 2025 15:15:19 GMT', 'Server': 'Apache', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Content-Length': '196', 'Connection': 'close', 'Content-Type': 'text/html; charset=iso-8859-1')>

2025-07-03 15:15:20 - parfive - INFO: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601004829_v0a.fits failed to download with exception
Download Failed: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601004829_v0a.fits with error <ClientResponse(https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601004829_v0a.fits) [404 Not Found]>
<CIMultiDictProxy('Date': 'Thu, 03 Jul 2025 15:15:19 GMT', 'Server': 'Apache', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Content-Length': '196', 'Connection': 'close', 'Content-Type': 'text/html; charset=iso-8859-1')>

2025-07-03 15:15:20 - parfive - INFO: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601005629_v0a.fits failed to download with exception
Download Failed: https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601005629_v0a.fits with error <ClientResponse(https://vso1.nascom.nasa.gov/data/punch/1/CR2/2025/06/01/PUNCH_L1_CR2_20250601005629_v0a.fits) [404 Not Found]>
<CIMultiDictProxy('Date': 'Thu, 03 Jul 2025 15:15:20 GMT', 'Server': 'Apache', 'Strict-Transport-Security': 'max-age=31536000; includeSubDomains', 'Content-Length': '196', 'Connection': 'close', 'Content-Type': 'text/html; charset=iso-8859-1')>


Files Downloaded:  78%|███████▊  | 29/37 [00:01<00:00, 15.36file/s]

This returns a list of paths to files that have been downloaded. Note that the Fido.fetch tool can specify a particular download directory for larger data searches. With that file downloaded, we can load it into a SunPy map object, and display it.

map = Map(files[0])
map.peek(cmap=cmap_punch)
PUNCH - WFI-2 $530 \; \mathrm{nm}$ 2025-06-01 00:00:29

And that’s it! From here the data is encapsulated into a SunPy map object, which supports that framework for plotting, coordinate transformations, etc. Note that in SunPy 7.0+, SunPy will use the PUNCH colormap natively, and will no longer need to be specified manually.

Of course this is just one path, you could always load the data using Astropy fits tools, load it into an NDCube, or any other FITS-compliant tool.

Total running time of the script: (0 minutes 9.448 seconds)

Gallery generated by Sphinx-Gallery