OpenDrift / opendrift

Open source framework for ocean trajectory modelling
https://opendrift.github.io
GNU General Public License v2.0
245 stars 120 forks source link

animation gif example_leeway #1088

Open Alonso112358 opened 1 year ago

Alonso112358 commented 1 year ago

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

knutfrode commented 1 year ago

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

Alonso112358 commented 1 year ago

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

image

AndresSepulveda commented 1 year ago

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)

Alonso112358 commented 1 year ago

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

AndresSepulveda commented 1 year ago

Same, inside the call

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

Alonso112358 commented 1 year ago

Thanks so much, It works!!