Animating PUNCH data#

How to animate PUNCH data using built-in plotting tools

First we’ll load a set of libraries. This is minimal, but will give us the tools to query a sample of data to download and animate. Note that for animation, you’ll need a local copy of ffmpeg, which can be installed through tools such as homebrew or conda. Depending on your environment you may also need to install a corresponding python package with a command such as pip install ffmpeg-python. Also note that punchbowl is in active development at the moment. To install the bleeding-edge version, use a command such as pip install git+https://github.com/punch-mission/punchbowl@main.

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

import punchbowl  # Note that this import is needed to register PUNCH fido tools
from punchbowl.data.visualize import animate_punch

Next we’ll query a sample of data to animate. Note that you can modify the time range, the product code, and the data version code. Two useful datasets to visualize are CAM and PAM - level 3 clear and polarized low-noise mosaics.

result = Fido.search(a.Time('2025/10/14 14:30:00', '2025/10/14 17:00:00'),
                     a.punch.ProductCode.ca, # (ca for clear low-noise), or pa for polarized low-noise, etc.
                     a.Instrument.m, # (m for mosaic), or a.Instrument.nfi_4, etc for earlier levels.
                     a.Level.three,
                     a.punch.DataVersion.newest, # or a.punch.DataVersion.zero_j, etc.
                     a.punch.FileType.fits) # or a.punch.FileType.jp2

result
Results from 1 Provider:

5 Results from the PUNCHClient:
QueryResponse length=5
Start TimeEnd TimeLevelProductCodeInstrumentDataVersionSourceProviderFileType
TimeTimestr1str2str1str2str5str4str4
2025-10-14 14:40:00.0002025-10-14 14:40:00.9993CAM0lPUNCHSwRIfits
2025-10-14 15:12:00.0002025-10-14 15:12:00.9993CAM0lPUNCHSwRIfits
2025-10-14 15:44:00.0002025-10-14 15:44:00.9993CAM0lPUNCHSwRIfits
2025-10-14 16:16:00.0002025-10-14 16:16:00.9993CAM0lPUNCHSwRIfits
2025-10-14 16:48:00.0002025-10-14 16:48:00.9993CAM0lPUNCHSwRIfits



The resulting files can then be downloaded. Note that occasionally data access through these tools can be down for maintenance or other issues. To instead query a list of local files you may have on hand, import the glob package into python, and then use a command such as files = glob.glob("path/to/files/*.fits") followed by files.sort().

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




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

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



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





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


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

PUNCH_L3_CAM_20251014144000_v0l.fits:   0%|          | 40.5k/24.8M [00:00<01:02, 397kB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:   0%|          | 40.5k/24.8M [00:00<01:04, 384kB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:   0%|          | 88.5k/24.9M [00:00<00:29, 851kB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:   0%|          | 104k/25.0M [00:00<00:24, 1.02MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:   0%|          | 40.5k/25.0M [00:00<01:02, 400kB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:   4%|▍         | 1.06M/24.8M [00:00<00:04, 5.91MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:   4%|▍         | 960k/24.9M [00:00<00:04, 5.38MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:   4%|▍         | 1.06M/24.8M [00:00<00:04, 5.27MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:   6%|▋         | 1.58M/25.0M [00:00<00:02, 7.99MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:   4%|▎         | 920k/25.0M [00:00<00:05, 4.80MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  14%|█▍        | 3.51M/25.0M [00:00<00:01, 12.8MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:   8%|▊         | 1.97M/24.9M [00:00<00:03, 6.73MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  10%|▉         | 2.42M/24.8M [00:00<00:02, 8.26MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:   9%|▊         | 2.12M/24.8M [00:00<00:03, 7.16MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:   8%|▊         | 1.99M/25.0M [00:00<00:03, 6.96MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  22%|██▏       | 5.46M/25.0M [00:00<00:01, 13.8MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  16%|█▋        | 4.06M/24.8M [00:00<00:01, 10.7MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  12%|█▏        | 3.00M/24.9M [00:00<00:03, 7.18MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  13%|█▎        | 3.20M/25.0M [00:00<00:02, 8.10MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  15%|█▌        | 3.80M/24.8M [00:00<00:02, 9.09MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  31%|███       | 7.72M/25.0M [00:00<00:01, 15.3MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  25%|██▍       | 6.17M/24.8M [00:00<00:01, 12.9MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  21%|██        | 5.18M/24.8M [00:00<00:01, 9.82MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  16%|█▋        | 4.05M/24.9M [00:00<00:02, 7.45MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  18%|█▊        | 4.50M/25.0M [00:00<00:02, 8.68MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  38%|███▊      | 9.49M/25.0M [00:00<00:00, 15.9MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  33%|███▎      | 8.27M/24.8M [00:00<00:01, 15.2MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  25%|██▌       | 6.21M/24.8M [00:00<00:01, 9.91MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  21%|██▏       | 5.30M/24.9M [00:00<00:02, 8.07MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  24%|██▍       | 6.08M/25.0M [00:00<00:01, 9.80MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  46%|████▌     | 11.5M/25.0M [00:00<00:00, 16.6MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  42%|████▏     | 10.4M/24.8M [00:00<00:00, 16.6MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  29%|██▉       | 7.22M/24.8M [00:00<00:01, 9.54MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  30%|██▉       | 7.42M/25.0M [00:00<00:01, 10.6MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  26%|██▋       | 6.55M/24.9M [00:00<00:02, 8.37MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  53%|█████▎    | 13.1M/24.8M [00:00<00:00, 19.5MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  53%|█████▎    | 13.2M/25.0M [00:00<00:00, 16.4MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  35%|███▍      | 8.61M/24.8M [00:00<00:01, 9.94MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  36%|███▋      | 9.07M/25.0M [00:00<00:01, 11.5MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  31%|███▏      | 7.81M/24.9M [00:00<00:01, 8.95MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  59%|█████▉    | 14.8M/25.0M [00:01<00:00, 15.5MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  41%|████      | 10.0M/24.8M [00:01<00:01, 10.5MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  42%|████▏     | 10.4M/25.0M [00:01<00:01, 12.0MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  61%|██████    | 15.0M/24.8M [00:01<00:00, 16.2MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  38%|███▊      | 9.35M/24.9M [00:01<00:01, 9.63MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  65%|██████▌   | 16.3M/25.0M [00:01<00:00, 13.9MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  48%|████▊     | 11.8M/24.8M [00:01<00:01, 11.3MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  47%|████▋     | 11.8M/25.0M [00:01<00:01, 11.4MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  68%|██████▊   | 16.8M/24.8M [00:01<00:00, 15.2MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  44%|████▍     | 10.9M/24.9M [00:01<00:01, 10.4MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  56%|█████▌    | 13.8M/24.8M [00:01<00:00, 13.6MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  53%|█████▎    | 13.2M/25.0M [00:01<00:00, 12.0MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  76%|███████▌  | 18.8M/24.8M [00:01<00:00, 15.3MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  71%|███████   | 17.8M/25.0M [00:01<00:00, 11.5MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  50%|█████     | 12.5M/24.9M [00:01<00:01, 11.0MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  63%|██████▎   | 15.6M/24.8M [00:01<00:00, 14.1MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  59%|█████▉    | 14.8M/25.0M [00:01<00:00, 12.5MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  83%|████████▎ | 20.6M/24.8M [00:01<00:00, 15.0MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  57%|█████▋    | 14.2M/24.9M [00:01<00:00, 12.0MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  76%|███████▌  | 19.0M/25.0M [00:01<00:00, 9.98MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  72%|███████▏  | 17.8M/24.8M [00:01<00:00, 15.7MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  66%|██████▌   | 16.4M/25.0M [00:01<00:00, 13.2MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  89%|████████▉ | 22.2M/24.8M [00:01<00:00, 15.0MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  66%|██████▋   | 16.5M/24.9M [00:01<00:00, 14.5MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  80%|████████  | 20.1M/25.0M [00:01<00:00, 10.1MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  74%|███████▎  | 18.4M/25.0M [00:01<00:00, 14.6MB/s]




PUNCH_L3_CAM_20251014161600_v0l.fits:  95%|█████████▌| 23.7M/24.8M [00:01<00:00, 14.1MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  78%|███████▊  | 19.4M/24.8M [00:01<00:00, 13.1MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  74%|███████▍  | 18.4M/24.9M [00:01<00:00, 15.3MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  86%|████████▌ | 21.4M/25.0M [00:01<00:00, 10.2MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  80%|████████  | 20.1M/25.0M [00:01<00:00, 15.1MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  92%|█████████▏| 22.9M/25.0M [00:01<00:00, 11.3MB/s]



PUNCH_L3_CAM_20251014154400_v0l.fits:  84%|████████▍ | 21.0M/24.9M [00:01<00:00, 16.9MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  88%|████████▊ | 22.0M/25.0M [00:01<00:00, 15.6MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  84%|████████▍ | 20.8M/24.8M [00:01<00:00, 11.6MB/s]





Files Downloaded:  20%|██        | 1/5 [00:01<00:07,  1.94s/file]



PUNCH_L3_CAM_20251014154400_v0l.fits:  91%|█████████ | 22.7M/24.9M [00:01<00:00, 16.6MB/s]


PUNCH_L3_CAM_20251014151200_v0l.fits:  97%|█████████▋| 24.2M/25.0M [00:01<00:00, 17.1MB/s]

PUNCH_L3_CAM_20251014144000_v0l.fits:  94%|█████████▎| 23.2M/24.8M [00:01<00:00, 14.3MB/s]





PUNCH_L3_CAM_20251014164800_v0l.fits:  96%|█████████▋| 24.1M/25.0M [00:02<00:00, 9.98MB/s]



Files Downloaded:  40%|████      | 2/5 [00:02<00:02,  1.12file/s]











PUNCH_L3_CAM_20251014144000_v0l.fits: 100%|█████████▉| 24.7M/24.8M [00:02<00:00, 14.1MB/s]


Files Downloaded: 100%|██████████| 5/5 [00:02<00:00,  2.33file/s]

That file list is then passed into the animator function, along with an output filename.

animate_punch(files, output_path="PUNCH_CAM.mp4", axes_off=True, trim_edge=(0.13, 0.68))
  0%|          | 0/5 [00:00<?, ?it/s]
 20%|██        | 1/5 [00:06<00:27,  6.85s/it]
 60%|██████    | 3/5 [00:12<00:07,  3.83s/it]
100%|██████████| 5/5 [00:16<00:00,  2.82s/it]
100%|██████████| 5/5 [00:16<00:00,  3.22s/it]

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

Gallery generated by Sphinx-Gallery