pyBrowzarr

API Reference

Full reference for the pyBrowzarr public API — Browzarr, its methods, module functions, and plot-type options.

This page documents the public, user-facing API. Everything lives under the browzarr package.

Exports

from browzarr import Browzarr, build_browzarr, update_browzarr, main
NameKindPurpose
BrowzarrclassThe user-facing configuration object.
build_browzarr()functionRebuild the bundled frontend from the upstream source.
update_browzarr()functionUpdate the bundled frontend from the prebuilt python-dist branch.
main()functionCommand-line entry point (browzarr launcher).

Browzarr

A Browzarr object holds the configuration for a single visualization. Set attributes or pass them as keyword arguments, chain a plot type, then call .plot().

Constructor

Browzarr(
    dataset,                       # str, required
    variable,                      # str, required
    x_slice=(0, None),             # tuple[int, int | None]
    y_slice=(0, None),             # tuple[int, int | None]
    z_slice=(0, None),             # tuple[int, int | None]
    extra_params={},               # dict[str, Any]
)

All fields are also accessible as attributes after construction.

extra_params is a catch-all dictionary that gets merged into the final plot state. Use it to pass any option not explicitly modeled — keys are camel-cased automatically.

bz = Browzarr(dataset="gs://store", variable="temp")
bz.extra_params["myCustomOption"] = True
There is no keyword validation — any unexpected keyword on a plot method is silently serialized rather than raising. Be careful with typos.

Plot methods

Each of these records the plot configuration and returns self, so calls can be chained or stored.

def volume(**kwargs) -> Browzarr   # 3D volume render
def points(**kwargs) -> Browzarr   # point cloud
def flat(**kwargs)   -> Browzarr   # flat surface (can be displaced)
def sphere(**kwargs) -> Browzarr   # globe/sphere

Only the last plot method called takes effect. See the common options and the plot-type-specific sections below for the accepted keyword arguments.

bz = Browzarr(dataset="gs://store", variable="temp")
bz.volume(transparency=0.5).points(point_size=3)   # points() wins — last call

Export method

def export(open_browser: bool = True, **kwargs) -> Browzarr

Configures an export (with optional animation) and immediately launches the plot by calling .plot(). See Export & Animation for the accepted keyword arguments.

Browzarr(dataset="gs://store", variable="temp").volume().export(
    main_title="My Map",
    animate=True,
    frames=120,
    frame_rate=30,
)

plot()

def plot(
    width=720,
    height=720,
    give_url: bool = False,
    external_browser: bool = False,
    wait: float = 0.3,
) -> str | None

Launches (or reuses) the local Browzarr server and opens the view configured on this object.

ArgumentDefaultDescription
width720Iframe width in Jupyter/Colab.
height720Iframe height in Jupyter/Colab.
give_urlFalseWhen True, returns the hosted URL string instead of opening anything.
external_browserFalseForce opening in an external browser, bypassing environment detection.
wait0.3Seconds to wait before opening, so the server is ready.

Return value: the URL string when give_url=True, otherwise None.

bz.plot()
bz.plot(give_url=True)          # -> "https://browzarr.io/latest/?data=..."
bz.plot(width=900, height=600)  # larger iframe in notebooks
bz.plot(external_browser=True)  # always open in the OS browser

Where the view opens is auto-detected. See Environments.

Plot types

The four plot types below share a common set of options; each also accepts its own type-specific keyword arguments. Unset options use their default values.

Common options

Every plot method (volume(), points(), flat(), sphere()) accepts the keyword arguments below.

OptionTypeDefaultDescription
colormapstr"Spectral"Name of the colormap to use (e.g. "turbo", "inferno").
flip_colormapboolfalseReverse the colormap direction.
bottom_leftstrCorner color of the bivariate colormap (bottom left).
top_leftstrCorner color of the bivariate colormap (top left).
bottom_rightstrCorner color of the bivariate colormap (bottom right).
resolutionint10Resolution of the bivariate colormap texture grid.
mix_modeint2Mixing mode of the colormap: 0 = darken, 1 = lighten, 2 = multiply, 3 = difference
bivariate_selectionint0Which variable to send to the colormap when bivariate and only one value should be shown.
value_rangetuple[float, float](0, 1)Fixed (min, max) bounds of the color mapping.
show_bordersboolfalseDraw country/coastline borders over the plot.
use_border_textureboolfalseDraw the borders into the shaders instead of physical lines
border_widthfloat0.05Line width of the borders. (Requires use_border_texture=True)
border_colorstr"#000000"Border color (CSS color string).
lon_extenttuple[float, float]Detects automatically. If fail then --> (-180, 180)Longtude extent of data.
lat_extenttuple[float, float]Detects automatically. If fail then --> (-90, 90)Latitude extent of data.
lon_resolutionfloatDetects automatically. If fail then --> 1Grid resolution (degrees).
lat_resolutionfloatDetects automatically. If fail then --> 1Grid resolution (degrees)g.
interp_pixelsboolfalseInterpolate between pixels for smoother rendering.
use_orthoboolfalseUse an orthographic camera.
fill_valuefloatNoneValue to treat as the data fill/missing value.
mask_featureLiteral[0, 1, 2]0Mask by geographic feature: 0 = no mask, 1 = mask land, 2 = mask ocean.
mask_valuefloatNoneValue to mask out.
camera_positionVector3[0, 0, 5]Camera position {x, y, z}.
native_CRSstrNoneNative CRS of the data (used for reprojection).
dest_CRSstrNoneTarget CRS to reproject to. When both CRS options are set, reprojection is enabled.

See extra_params above for how pass-through keyword arguments are merged into the final plot state.

from browzarr import Browzarr

Browzarr(dataset="gs://some-zarr-store", variable="temperature").volume(
    colormap="inferno",
    transparency=0.5,
    value_range=(270, 310),
).plot()

volume()

The volume plot renders the variable as a 3D volumetric data cube. It is selected with the volume() method:

from browzarr import Browzarr

Browzarr(dataset="gs://some-zarr-store", variable="temperature").volume(
    colormap="turbo",
    transparency=0.6,
    value_range=(270, 310),
).plot()

In addition to the common options, volume() accepts the following volume-specific keyword arguments. Unset options fall back to the frontend's default state, listed below.

OptionTypeDefaultDescription
use_ray_marchboolfalseUse Ray Marcher renderer. If false, volume uses DDA render
transparencyfloat0Global opacity of the rendered volume, from 0 (opaque) to 1 (fully transparent).
nan_transparencyfloat1Opacity applied to cells whose value is missing (NaN / fill_value).
qualityfloat200The quality of the ray marcher renderer. Higher values mean smaller step-sizes and better visuals. (Requires use_ray_march=True)

points()

The points plot renders the variable as a high-density interactive 3D point cloud. It is selected with the points() method:

from browzarr import Browzarr

Browzarr(dataset="gs://some-zarr-store", variable="temperature").points(
    point_size=3,
).plot()

In addition to the common options, points() accepts the following point-specific keyword arguments. Unset options fall back to the frontend's default state, listed below.

OptionTypeDefaultDescription
point_sizefloat5Base size of the rendered points.
time_scalefloat1Scaling factor applied to points along the z-axis. Higher values spread them out.
scale_pointsboolfalseScale point size with the data value (intensity-scaled points).
scale_intensityfloat1How exaggerated point scaling is.

flat() - sphere()

Both the Flatmap and Sphere renderes present a 2D slice/representation of data that can be displaced in 3D.

from browzarr import Browzarr

Browzarr(dataset="gs://some-zarr-store", variable="temperature").flat().plot()
Browzarr(dataset="gs://some-zarr-store", variable="temperature").sphere().plot()

In addition to the common options, flat() and sphere() accept the keyword arguments below. Unset options fall back to the frontend's default state, listed below.

Shared by flat() and sphere()

OptionTypeDefaultDescription
displace_facesboolfalseDisplace the individual faces according to the data values.
displacementfloat0Magnitude of the vertical displacement of the surface/faces.
offset_negativesbooltrueOffset negative values so the surface is not displaced below the base plane/globe.

flat() only

OptionTypeDefaultDescription
rotate_flatboolfalseRotate the flat surface to face up along the Y-axis.

Session lifecycle

BrowzarrSession.shutdown()

A single local server is shared across all Browzarr instances in the same process, so repeated .plot() calls reuse it instead of spawning duplicates.

To stop the shared server and free its port:

from browzarr.api import BrowzarrSession

BrowzarrSession.shutdown()

Module functions

build_browzarr()

Rebuilds the bundled frontend distribution from the upstream source.

from browzarr import build_browzarr

build_browzarr()

Requires pnpm on your PATH.

  1. Downloads the latest source from the main branch of the upstream repo.
  2. Runs pnpm install and pnpm run build.
  3. Replaces web/dist with the freshly built output.

The build output is written in the package data directory, which requires write access.

update_browzarr()

Updates the bundled frontend from the upstream prebuilt python-dist branch — faster than a full source rebuild.

from browzarr import update_browzarr

update_browzarr()

Downloads the tarball, extracts it, and replaces web/dist.

main()

The command-line entry point registered as the browzarr console script. Run it from a terminal:

browzarr
Copyright © 2026