I’ve been working on a package that turns images into animations, using sensible defaults for fun, hassle-free creation. Built atop dask, imageio, and param.
Docs here: streamjoy (ahuang11.github.io)
It cuts down the boilerplate and time to work on animations; for example you can create GOES animations in just a few lines of code.
from streamjoy import stream
if __name__ == "__main__":
URL_FMT = "https://www.goes.noaa.gov/dimg/jma/fd/vis/{i}.gif"
resources = [URL_FMT.format(i=i) for i in range(1, 11)]
stream(resources, uri="goes.gif") # .gif and .mp4 supported
It does this blazingly fast because it saturates all the processors on your machine (or whatever you set on the Dask client).
Also, note that it simply reads from the URLs so you don’t have to manually download the files!
Another highlight is that you can add an intro to provide context:
from streamjoy import stream
if __name__ == "__main__":
URL_FMT = "https://www.goes.noaa.gov/dimg/jma/fd/vis/{i}.gif"
resources = [URL_FMT.format(i=i) for i in range(1, 11)]
himawari_stream = stream(
resources,
uri="goes_custom.gif",
intro_title="Himawari Visible",
intro_subtitle="10 Hours Loop",
intro_pause=1,
ending_pause=1,
optimize=True,
)
But what makes it stand out from other animation libraries is that you have full control of each frame in the animation, including what it renders in parallel and when it pauses!
from streamjoy import stream
def plot_frame(time)
important_time = ...
if time == important_time:
return Paused(fig, seconds=3)
else:
return fig
stream(..., renderer=plot_frame)
It supports images, URLs, directories, pandas, xarray, and holoviews objects straight out of the box! Supported formats - streamjoy (ahuang11.github.io)
It’s still in its early stages, so any testing and feedback is appreciated!
Many earth sciences related recipes here:
The repo: ahuang11/streamjoy: Enjoy animating images into GIFs and MP4s in parallel! (github.com)
The internals are based on the ideas presented in Using Dask to parallelize plotting - Pangeo. There’s also a short description of the package design in the docs Package design - streamjoy (ahuang11.github.io)