pyBrowzarr
Export & Animation
Static image export, video export, and scripted walkthrough keyframes with pyBrowzarr.
The export() method configures a static image or animated export of the current
plot. Unlike the other plot methods, export() immediately calls .plot() for you, so
a single chained call both configures the export and launches the view.
Browzarr(dataset="gs://store", variable="temp").volume().export(main_title="My Map")
export() signature
def export(open_browser: bool = True, **kwargs) -> Browzarr
| Argument | Default | Description |
|---|---|---|
open_browser | True | Open the browser/iframe after configuring the export. Pass False to configure only. |
**kwargs | — | Any option listed below. |
All options are optional — only the keys you pass are included in the export config.
Keys are snake_case in Python and delivered camel-cased to the frontend.
Image options
| Option | Type | Description |
|---|---|---|
include_background | bool | Include the background. If false then transparent |
main_title | str | Main title drawn on the export. |
custom_res | tuple[float, float] | Custom export resolution (width, height) in pixels. |
include_axis | bool | Draw the axes in the export. |
include_colorbar | bool | Draw a colorbar in the export. |
| Colorbar Options | ||
cbar_loc | str | Colorbar position ("left", "right", "top", "bottom"). |
cbar_num | int | Number of tick marks on the colorbar. |
cbar_label | str | Text label shown on the colorbar. |
cbar_units | str | Units shown alongside the colorbar label. |
.export(
include_background=True,
include_colorbar=True,
include_axis=False,
cbar_loc="right",
cbar_num=8,
cbar_label="Temperature",
cbar_units="K",
main_title="July Mean Temperature",
custom_res=(1920, 1080),
)
Animation options
Enable animate=True to produce a video/animation. The following options control how
the animation is driven.
| Option | Type | Description |
|---|---|---|
animate | bool | Export as animation |
frames | int | Total number of frames to render. |
frame_rate | int | Frames per second (FPS) of the output. |
orbit | bool | Animate a camera orbit around the globe. |
orbit_deg | float | Total degrees of orbit to sweep during the animation duration. |
use_time | bool | Animate the time/Z-axis along with the animation. |
time_rate | int | Time playback rate (FPS) to play slower or faster than camera FPS. |
loop_time | bool | Loop the time axis back to the start when it reaches the end. |
.export(
animate=True,
frames=120,
frame_rate=30,
use_time=True,
time_rate=1.0,
loop_time=True,
)
Camera orbit example
.export(
animate=True,
frames=180,
frame_rate=30,
orbit=True,
orbit_deg=360.0,
)
Keyframes
For a fully scripted camera/visual walkthrough, pass keyframes as a dict (or point to
a file with keyframes_path). Each keyframe maps a frame number to a visual and
camera state, and an optional time.
| Option | Type | Description |
|---|---|---|
keyframes | object | A dict of keyframes. When provided, it is written to a keyframes.json file and that path is passed to the frontend. |
keyframes_path | str | Path to an existing keyframes JSON file to use instead of passing keyframes inline. |
from browzarr import Browzarr
keyframes = {
"0": {
"visual": {"transparency": 0.0, "valueRange": [0, 1], "nanTransparency": 1},
"camera": {
"position": {"x": -4.5, "y": 2.4, "z": 4.8},
"rotation": {"isEuler": True, "_x": -0.46, "_y": -0.70, "_z": -0.31, "_order": "XYZ"},
},
"time": 0,
},
"31": {
"visual": {"transparency": 0.0, "valueRange": [0, 1], "nanTransparency": 1},
"camera": {
"position": {"x": 2.2, "y": 2.9, "z": 6.0},
"rotation": {"isEuler": True, "_x": -0.44, "_y": 0.32, "_z": 0.15, "_order": "XYZ"},
},
"time": 0,
},
}
Browzarr(dataset="gs://store", variable="temperature").volume().export(
animate=True,
frames=60,
frame_rate=30,
keyframes=keyframes,
)
Or reference a file on disk:
Browzarr(dataset="gs://store", variable="temperature").volume().export(
animate=True,
frames=60,
frame_rate=30,
keyframes_path=r"C:\path\to\keyframes.json",
)
The
keyframes/keyframes_path options are mutually exclusive — provide one or the
other, not both.