-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Based on 7.1 Loop over multiple datetimes (plots) in https://github.com/jgieseler/solarmach/blob/main/examples/example.ipynb, provide a function that creates an animated gif. The current code in the Notebook is the following:
body_list = ['Earth', 'STEREO A', 'Solar Orbiter', 'PSP', 'BepiColombo']
vsw_list = len(body_list) * [350]
for i in range(2,19,1):
j = str(i).rjust(2, '0')
date = f'2022-6-{j} 12:00:00'
filename = f'animate_{date[:-9]}.png' # define filename of output figure
sm7 = SolarMACH(date, body_list, vsw_list, coord_sys='Stoneyhurst')
sm7.plot(plot_sun_body_line=False, transparent=False, markers='numbers', outfile=filename)
import glob
files = sorted(glob.glob(filename.replace(f'{i}', '*')))
import imageio
images_data = []
for filename in files:
data = imageio.v2.imread(filename)
images_data.append(data)
# write to animated gif; duration (in ms) defines how fast the animation is.
imageio.mimwrite('solarmach.gif', images_data, format= '.gif', duration=100, loop=0)Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request