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.9993CAM0kPUNCHSwRIfits
2025-10-14 15:12:00.0002025-10-14 15:12:00.9993CAM0kPUNCHSwRIfits
2025-10-14 15:44:00.0002025-10-14 15:44:00.9993CAM0kPUNCHSwRIfits
2025-10-14 16:16:00.0002025-10-14 16:16:00.9993CAM0kPUNCHSwRIfits
2025-10-14 16:48:00.0002025-10-14 16:48:00.9993CAM0kPUNCHSwRIfits



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_v0k.fits:   0%|          | 0.00/20.5M [00:00<?, ?B/s]





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

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



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


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




PUNCH_L3_CAM_20251014161600_v0k.fits:   0%|          | 1.02k/20.5M [00:00<52:11, 6.56kB/s]




PUNCH_L3_CAM_20251014161600_v0k.fits:   3%|▎         | 713k/20.5M [00:00<00:05, 3.40MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:   0%|          | 1.02k/20.3M [00:00<1:35:28, 3.55kB/s]




PUNCH_L3_CAM_20251014161600_v0k.fits:  13%|█▎        | 2.74M/20.5M [00:00<00:01, 10.2MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:   0%|          | 1.02k/20.5M [00:00<1:58:48, 2.88kB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:   1%|          | 113k/20.3M [00:00<00:54, 370kB/s]




PUNCH_L3_CAM_20251014161600_v0k.fits:  26%|██▌       | 5.30M/20.5M [00:00<00:00, 15.6MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:   1%|          | 185k/20.5M [00:00<00:39, 518kB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:   3%|▎         | 673k/20.3M [00:00<00:09, 2.02MB/s]




PUNCH_L3_CAM_20251014161600_v0k.fits:  38%|███▊      | 7.88M/20.5M [00:00<00:00, 18.6MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:   0%|          | 1.02k/20.5M [00:00<2:50:49, 2.00kB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:   4%|▍         | 921k/20.5M [00:00<00:07, 2.45MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:   9%|▉         | 1.92M/20.3M [00:00<00:03, 5.18MB/s]




PUNCH_L3_CAM_20251014161600_v0k.fits:  52%|█████▏    | 10.7M/20.5M [00:00<00:00, 21.6MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:   1%|          | 185k/20.5M [00:00<00:50, 401kB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  10%|█         | 2.07M/20.5M [00:00<00:03, 5.05MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  18%|█▊        | 3.71M/20.3M [00:00<00:01, 9.01MB/s]




PUNCH_L3_CAM_20251014161600_v0k.fits:  63%|██████▎   | 12.9M/20.5M [00:00<00:00, 21.0MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  17%|█▋        | 3.40M/20.5M [00:00<00:02, 7.31MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:   3%|▎         | 632k/20.5M [00:00<00:15, 1.32MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  25%|██▍       | 5.07M/20.3M [00:00<00:01, 9.93MB/s]




PUNCH_L3_CAM_20251014161600_v0k.fits:  73%|███████▎  | 15.1M/20.5M [00:00<00:00, 20.1MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:   0%|          | 1.02k/20.4M [00:00<4:23:10, 1.29kB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:   7%|▋         | 1.52M/20.5M [00:00<00:06, 3.14MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  25%|██▌       | 5.14M/20.5M [00:00<00:01, 9.97MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  34%|███▍      | 6.97M/20.3M [00:00<00:01, 12.4MB/s]




PUNCH_L3_CAM_20251014161600_v0k.fits:  83%|████████▎ | 17.1M/20.5M [00:01<00:00, 18.7MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  13%|█▎        | 2.73M/20.5M [00:00<00:03, 5.41MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  33%|███▎      | 6.78M/20.5M [00:00<00:01, 11.7MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  42%|████▏     | 8.53M/20.3M [00:01<00:00, 13.3MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:   0%|          | 24.9k/20.4M [00:00<10:24, 32.6kB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  41%|████      | 8.35M/20.5M [00:01<00:00, 12.9MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  20%|█▉        | 4.00M/20.5M [00:01<00:02, 7.26MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  49%|████▉     | 9.93M/20.3M [00:01<00:00, 13.3MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:   2%|▏         | 320k/20.4M [00:01<00:40, 496kB/s]




PUNCH_L3_CAM_20251014161600_v0k.fits:  93%|█████████▎| 19.0M/20.5M [00:01<00:00, 14.6MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  26%|██▌       | 5.34M/20.5M [00:01<00:01, 8.85MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  47%|████▋     | 9.72M/20.5M [00:01<00:00, 12.3MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  56%|█████▌    | 11.3M/20.3M [00:01<00:00, 12.3MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:   4%|▍         | 840k/20.4M [00:01<00:14, 1.35MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  32%|███▏      | 6.55M/20.5M [00:01<00:01, 9.36MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  54%|█████▎    | 11.0M/20.5M [00:01<00:00, 11.4MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  62%|██████▏   | 12.6M/20.3M [00:01<00:00, 10.7MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  37%|███▋      | 7.58M/20.5M [00:01<00:01, 8.99MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:   8%|▊         | 1.60M/20.4M [00:01<00:08, 2.28MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  59%|█████▉    | 12.2M/20.5M [00:01<00:00, 10.3MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  42%|████▏     | 8.55M/20.5M [00:01<00:01, 9.11MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  67%|██████▋   | 13.7M/20.3M [00:01<00:00, 10.2MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:  14%|█▍        | 2.88M/20.4M [00:01<00:04, 4.23MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  65%|██████▌   | 13.4M/20.5M [00:01<00:00, 10.5MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  48%|████▊     | 9.74M/20.5M [00:01<00:01, 9.87MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  73%|███████▎  | 14.9M/20.3M [00:01<00:00, 10.1MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  70%|███████   | 14.4M/20.5M [00:01<00:00, 10.5MB/s]





Files Downloaded:  20%|██        | 1/5 [00:02<00:08,  2.01s/file]


PUNCH_L3_CAM_20251014151200_v0k.fits:  21%|██        | 4.27M/20.4M [00:01<00:02, 5.83MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  53%|█████▎    | 10.8M/20.5M [00:01<00:01, 9.30MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  78%|███████▊  | 16.0M/20.3M [00:01<00:00, 9.46MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  76%|███████▌  | 15.6M/20.5M [00:01<00:00, 10.6MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:  27%|██▋       | 5.58M/20.4M [00:01<00:01, 7.43MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  58%|█████▊    | 11.9M/20.5M [00:01<00:00, 9.77MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  84%|████████▎ | 17.0M/20.3M [00:01<00:00, 9.57MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  81%|████████  | 16.7M/20.5M [00:01<00:00, 10.4MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:  34%|███▍      | 6.90M/20.4M [00:01<00:01, 8.54MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  64%|██████▍   | 13.2M/20.5M [00:01<00:00, 10.4MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  90%|████████▉ | 18.2M/20.3M [00:02<00:00, 10.3MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:  41%|████      | 8.34M/20.4M [00:01<00:01, 10.0MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  87%|████████▋ | 17.9M/20.5M [00:02<00:00, 9.67MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  71%|███████   | 14.5M/20.5M [00:02<00:00, 10.8MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:  47%|████▋     | 9.53M/20.4M [00:02<00:01, 9.94MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  77%|███████▋  | 15.7M/20.5M [00:02<00:00, 10.9MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  92%|█████████▏| 18.9M/20.5M [00:02<00:00, 8.28MB/s]





PUNCH_L3_CAM_20251014164800_v0k.fits:  95%|█████████▍| 19.3M/20.3M [00:02<00:00, 7.39MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:  53%|█████▎    | 10.8M/20.4M [00:02<00:00, 10.5MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  84%|████████▎ | 17.1M/20.5M [00:02<00:00, 11.8MB/s]

PUNCH_L3_CAM_20251014144000_v0k.fits:  98%|█████████▊| 20.0M/20.5M [00:02<00:00, 8.38MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:  63%|██████▎   | 12.9M/20.4M [00:02<00:00, 13.2MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  89%|████████▉ | 18.3M/20.5M [00:02<00:00, 11.7MB/s]


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





PUNCH_L3_CAM_20251014164800_v0k.fits:  99%|█████████▉| 20.2M/20.3M [00:02<00:00, 6.25MB/s]


PUNCH_L3_CAM_20251014151200_v0k.fits:  72%|███████▏  | 14.7M/20.4M [00:02<00:00, 14.4MB/s]



PUNCH_L3_CAM_20251014154400_v0k.fits:  96%|█████████▌| 19.7M/20.5M [00:02<00:00, 12.4MB/s]








PUNCH_L3_CAM_20251014151200_v0k.fits:  85%|████████▌ | 17.4M/20.4M [00:02<00:00, 17.9MB/s]




Files Downloaded:  80%|████████  | 4/5 [00:02<00:00,  1.94file/s]


PUNCH_L3_CAM_20251014151200_v0k.fits: 100%|█████████▉| 20.3M/20.4M [00:02<00:00, 21.0MB/s]



Files Downloaded: 100%|██████████| 5/5 [00:02<00:00,  1.68file/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:26,  6.59s/it]
 40%|████      | 2/5 [00:06<00:08,  2.95s/it]
 60%|██████    | 3/5 [00:11<00:07,  3.76s/it]
 80%|████████  | 4/5 [00:12<00:02,  2.58s/it]
100%|██████████| 5/5 [00:14<00:00,  2.55s/it]
100%|██████████| 5/5 [00:14<00:00,  3.00s/it]

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

Gallery generated by Sphinx-Gallery