Note
Go to the end to download the full example code. or to run this example in your browser via Binder
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
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_PP2_20250601000732_v0a.fits: 0%| | 0.00/1.66M [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: 0%| | 0.00/1.63M [00:00<?, ?B/s]
PUNCH_L0_CR2_20250601000029_v0a.fits: 0%| | 0.00/1.58M [00:00<?, ?B/s]
PUNCH_L0_PP2_20250601000732_v0a.fits: 2%|▏ | 40.2k/1.66M [00:00<00:04, 378kB/s]
PUNCH_L0_PZ2_20250601000630_v0a.fits: 2%|▏ | 40.2k/1.65M [00:00<00:04, 389kB/s]
PUNCH_L0_CR2_20250601000029_v0a.fits: 3%|▎ | 40.2k/1.58M [00:00<00:03, 395kB/s]
PUNCH_L0_PM2_20250601000526_v0a.fits: 2%|▏ | 40.2k/1.63M [00:00<00:04, 372kB/s]
PUNCH_L0_CR2_20250601000829_v0a.fits: 0%| | 0.00/1.66M [00:00<?, ?B/s]
Files Downloaded: 3%|▎ | 1/37 [00:00<00:16, 2.13file/s]
PUNCH_L0_PP2_20250601001532_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_PZ2_20250601001430_v0a.fits: 0%| | 0.00/1.68M [00:00<?, ?B/s]
PUNCH_L0_CR2_20250601000829_v0a.fits: 27%|██▋ | 454k/1.66M [00:00<00:00, 4.54MB/s]
Files Downloaded: 14%|█▎ | 5/37 [00:00<00:03, 10.66file/s]
PUNCH_L0_PP2_20250601001532_v0a.fits: 31%|███ | 523k/1.68M [00:00<00:00, 5.23MB/s]
PUNCH_L0_PM2_20250601001326_v0a.fits: 36%|███▌ | 592k/1.66M [00:00<00:00, 5.87MB/s]
PUNCH_L0_PZ2_20250601001430_v0a.fits: 21%|██▏ | 360k/1.68M [00:00<00:00, 3.53MB/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: 25%|██▍ | 416k/1.69M [00:00<00:00, 4.08MB/s]
Files Downloaded: 24%|██▍ | 9/37 [00:00<00:01, 14.36file/s]
PUNCH_L0_PM2_20250601002126_v0a.fits: 1%|▏ | 24.5k/1.64M [00:00<00:06, 241kB/s]
PUNCH_L0_CR2_20250601002429_v0a.fits: 0%| | 0.00/1.67M [00:00<?, ?B/s]
PUNCH_L0_PZ2_20250601002230_v0a.fits: 2%|▏ | 40.2k/1.66M [00:00<00:04, 389kB/s]
PUNCH_L0_PP2_20250601002332_v0a.fits: 2%|▏ | 40.2k/1.67M [00:00<00:04, 390kB/s]
Files Downloaded: 32%|███▏ | 12/37 [00:00<00:01, 16.94file/s]
PUNCH_L0_CR2_20250601002429_v0a.fits: 21%|██ | 352k/1.67M [00:00<00:00, 3.51MB/s]
PUNCH_L0_PZ2_20250601003030_v0a.fits: 0%| | 0.00/1.67M [00:00<?, ?B/s]
PUNCH_L0_CR2_20250601003229_v0a.fits: 0%| | 0.00/1.68M [00:00<?, ?B/s]
PUNCH_L0_PM2_20250601002926_v0a.fits: 0%| | 0.00/1.66M [00:00<?, ?B/s]
PUNCH_L0_PP2_20250601003132_v0a.fits: 0%| | 0.00/1.67M [00:00<?, ?B/s]
PUNCH_L0_CR2_20250601003229_v0a.fits: 12%|█▏ | 200k/1.68M [00:00<00:00, 2.00MB/s]
PUNCH_L0_PZ2_20250601003030_v0a.fits: 14%|█▍ | 240k/1.67M [00:00<00:00, 2.31MB/s]
PUNCH_L0_PP2_20250601003132_v0a.fits: 10%|█ | 168k/1.67M [00:00<00:00, 1.68MB/s]
PUNCH_L0_PM2_20250601002926_v0a.fits: 12%|█▏ | 200k/1.66M [00:00<00:00, 1.96MB/s]
Files Downloaded: 41%|████ | 15/37 [00:01<00:01, 15.56file/s]
PUNCH_L0_PZ2_20250601003830_v0a.fits: 0%| | 0.00/1.70M [00:00<?, ?B/s]
PUNCH_L0_PM2_20250601003726_v0a.fits: 0%| | 0.00/1.68M [00:00<?, ?B/s]
PUNCH_L0_CR2_20250601004029_v0a.fits: 0%| | 0.00/1.71M [00:00<?, ?B/s]
PUNCH_L0_PP2_20250601003932_v0a.fits: 0%| | 0.00/1.70M [00:00<?, ?B/s]
PUNCH_L0_PZ2_20250601003830_v0a.fits: 33%|███▎ | 560k/1.70M [00:00<00:00, 5.45MB/s]
PUNCH_L0_CR2_20250601004029_v0a.fits: 22%|██▏ | 382k/1.71M [00:00<00:00, 3.82MB/s]
PUNCH_L0_PM2_20250601003726_v0a.fits: 38%|███▊ | 640k/1.68M [00:00<00:00, 6.19MB/s]
PUNCH_L0_PP2_20250601003932_v0a.fits: 15%|█▌ | 256k/1.70M [00:00<00:00, 2.50MB/s]
PUNCH_L0_PM2_20250601004526_v0a.fits: 0%| | 0.00/1.71M [00:00<?, ?B/s]
Files Downloaded: 49%|████▊ | 18/37 [00:01<00:01, 14.95file/s]
PUNCH_L0_PZ2_20250601004630_v0a.fits: 0%| | 0.00/1.73M [00:00<?, ?B/s]
PUNCH_L0_CR2_20250601004829_v0a.fits: 0%| | 0.00/1.74M [00:00<?, ?B/s]
PUNCH_L0_PP2_20250601004732_v0a.fits: 0%| | 0.00/1.73M [00:00<?, ?B/s]
PUNCH_L0_PM2_20250601004526_v0a.fits: 21%|██ | 352k/1.71M [00:00<00:00, 3.36MB/s]
Files Downloaded: 59%|█████▉ | 22/37 [00:01<00:00, 18.79file/s]
PUNCH_L0_PZ2_20250601004630_v0a.fits: 31%|███ | 528k/1.73M [00:00<00:00, 5.24MB/s]
PUNCH_L0_CR2_20250601004829_v0a.fits: 24%|██▍ | 424k/1.74M [00:00<00:00, 4.22MB/s]
PUNCH_L0_PP2_20250601004732_v0a.fits: 28%|██▊ | 480k/1.73M [00:00<00:00, 4.49MB/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]
PUNCH_L0_CR2_20250601005629_v0a.fits: 0%| | 0.00/1.71M [00:00<?, ?B/s]
PUNCH_L0_PM2_20250601005326_v0a.fits: 34%|███▍ | 578k/1.68M [00:00<00:00, 5.78MB/s]
PUNCH_L0_PZ2_20250601005430_v0a.fits: 39%|███▉ | 664k/1.70M [00:00<00:00, 6.27MB/s]
Files Downloaded: 70%|███████ | 26/37 [00:01<00:00, 18.76file/s]
PUNCH_L0_PP2_20250601005532_v0a.fits: 30%|███ | 512k/1.70M [00:00<00:00, 5.11MB/s]
PUNCH_L0_CR2_20250601005629_v0a.fits: 24%|██▍ | 416k/1.71M [00:00<00:00, 4.16MB/s]
8/0 files failed to download. Please check `.errors` for details
Files Downloaded: 78%|███████▊ | 29/37 [00:01<00:00, 18.76file/s]2025-07-23 21:51:55 - 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': 'Wed, 23 Jul 2025 21:51:54 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-23 21:51:55 - 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': 'Wed, 23 Jul 2025 21:51:54 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-23 21:51:55 - 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': 'Wed, 23 Jul 2025 21:51:54 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-23 21:51:55 - 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': 'Wed, 23 Jul 2025 21:51:54 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-23 21:51:55 - 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': 'Wed, 23 Jul 2025 21:51:55 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-23 21:51:55 - 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': 'Wed, 23 Jul 2025 21:51:55 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-23 21:51:55 - 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': 'Wed, 23 Jul 2025 21:51:55 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-23 21:51:55 - 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': 'Wed, 23 Jul 2025 21:51:55 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, 16.73file/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)

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.862 seconds)