Skip to content

Commit d0a4412

Browse files
committed
FIX: replaced attachments by image links in jupyter notebook
1 parent efe4f6a commit d0a4412

7 files changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import json
2+
import base64
3+
from pathlib import Path
4+
5+
notebook_path = "plot_radar_data.ipynb"
6+
output_dir = Path("images")
7+
output_dir.mkdir(exist_ok=True)
8+
9+
with open(notebook_path, "r", encoding="utf-8") as f:
10+
nb = json.load(f)
11+
12+
for cell in nb["cells"]:
13+
if "attachments" in cell:
14+
for name, data in cell["attachments"].items():
15+
if "image/png" in data:
16+
img_data = base64.b64decode(data["image/png"])
17+
out_file = output_dir / name
18+
with open(out_file, "wb") as f:
19+
f.write(img_data)
20+
print(f"Saved: {out_file}")
39.5 KB
Loading
185 KB
Loading
1.2 MB
Loading
835 KB
Loading
810 KB
Loading
98.3 KB
Loading

0 commit comments

Comments
 (0)