opendrift icon indicating copy to clipboard operation
opendrift copied to clipboard

animation gif example_leeway

Open Alonso112358 opened this issue 2 years ago • 6 comments

Hello, Im new on opendrift and python , and I'd like to know how to save and generate a gif animation. Im using WScode and conda. Im performing the example_leeway.py image

Alonso112358 avatar Apr 19 '23 15:04 Alonso112358

You can add filename='filename.gif' to save animation to file. But .mp4 generates much smaller files, that also can be paused.

knutfrode avatar Apr 19 '23 15:04 knutfrode

Ok thanks, I did it but I dont see any files , Is there another comands lilke save or anything else?

image

Alonso112358 avatar Apr 19 '23 16:04 Alonso112358

You add that inside the call to animation

lw.animation(background=['x_sea_water_velocity', 'y_sea_water_velocity'], skip=5,filename='filename.mp4', # show every 5th vector cmap=cmocean.cm.speed, vmin=0, vmax=.8, bgalpha=.7, land_color='#666666', fast=True)

AndresSepulveda avatar Apr 19 '23 16:04 AndresSepulveda

Thanks so much, It works!!! I suppose for generating images like png files is similar image

Alonso112358 avatar Apr 19 '23 16:04 Alonso112358

Same, inside the call

lw.plot(fast=True,filename1='filename1.png')

AndresSepulveda avatar Apr 19 '23 16:04 AndresSepulveda

Thanks so much, It works!!

Alonso112358 avatar Apr 19 '23 17:04 Alonso112358