Supported formats¶
StreamJoy supports a variety of input types!
📋 List of Images, GIFs, Videos, or URLs¶
from streamjoy import stream
URL_FMT = "https://noaadata.apps.nsidc.org/NOAA/G02135/north/daily/images/2024/01_Jan/N_202401{day:02d}_conc_v3.0.png"
stream([URL_FMT.format(day=day) for day in range(1, 31)], uri="2024_jan_sea_ice.mp4")
📁 Directory of Images, GIFs, Videos, or URLs¶
from streamjoy import stream
URL_DIR = "https://downloads.psl.noaa.gov/Datasets/ncep.reanalysis/Dailies/surface/"
stream(URL_DIR, uri="air_temperature.mp4", pattern="air.sig995.194*.nc")
🧮 Numpy NdArray¶
from streamjoy import stream
import imageio.v3 as iio
array = iio.imread("imageio:newtonscradle.gif") # is a 4D numpy array
stream(array, max_frames=-1).write("newtonscradle.mp4")
🐼 Pandas DataFrame or Series¶
Additional Requirements
You will need to additionally install pandas
and matplotlib
to support this format:
from streamjoy import stream
import pandas as pd
df = pd.read_csv(
"https://raw.githubusercontent.com/franlopezguzman/gapminder-with-bokeh/master/gapminder_tidy.csv"
).set_index("Year")
df = df.query("Country in ['United States', 'China', 'South Africa']")
stream(df, uri="gapminder.mp4", groupby="Country", title="{Year}")
🐻❄️ Polars DataFrame¶
Additional Requirements
You will need to additionally install polars
, pyarrow
, hvplot
, selenium
, and webdriver-manager
to support this format:
You must also have firefox
or chromedriver
installed on your system.
from streamjoy import stream
import polars as pl
df = pl.read_csv(
"https://raw.githubusercontent.com/franlopezguzman/gapminder-with-bokeh/master/gapminder_tidy.csv"
)
df = df.filter(pl.col("Country").is_in(['United States', 'China', 'South Africa']))
stream(df, uri="gapminder.mp4", groupby="Country", title="{Year}")
🗄️ XArray Dataset or DataArray¶
Additional Requirements
You will need to additionally install xarray
and matplotlib
to support this format:
For this example, you will also need to install pooch
and netcdf4
:
from streamjoy import stream
import xarray as xr
ds = xr.tutorial.open_dataset("air_temperature").isel(time=slice(0, 100))
stream(ds, uri="air.mp4", cmap="RdBu_r")
📊 HoloViews HoloMap or DynamicMap¶
Additional Requirements
You will need to additionally install holoviews
to support this format:
For the bokeh backend, you will need to install bokeh
, selenium
, and webdriver-manager
:
For the matplotlib backend, you will need to install matplotlib
:
For this example, you will also need to install pooch
, netcdf4,
hvplot, and
xarray`:
You must also have firefox
or chromedriver
installed on your system.