[Thread Prev][Thread Next][Index]

Re: [ferret_users] for multiple png or gif file for the use of animation



Hi
I have just one more thing to add.  Often it's cleaner to put the set of commands into a separate script, and just run that script in the loop.  Because all variables and symbols are defined globally within the Ferret session, the png file name symbol is available within the script; or you could send that in as an argument to the script as well.  For instance, you could break off the plot commands into a script:

use coads_climatology

repeat/l=1:12 (\

let li=`l`;\
define symbol stamp=`li,zw=3`;\
define symbol filename=sst_($stamp);\
sp rm ($filename).png;\
go timeplot sst[L=`li`])

Where the script timeplot.jnl might contain something like this:

! timeplot.jnl
! Argument 1 is the variable to plot

shade/set/pal=blue_orange $1
  ppl tics...
  ppl shakey...
ppl shade

go fland

frame/file=($filename).png/format=png/ypixel=1024

This could be all done in the repeat loop. Loops CAN contain all commands, including PPL commands, all separated by  semicolons, but once they start to get long, a separate script is easier to debug and maintain.

Ansley


On 11/16/2016 8:15 AM, Martin Schmidt wrote:

Hi,

using "frame" repeatedly with the same file name produces files with an additional extension. Just use the unix command 'ls' to explore this.

What image files are suitable for you depends on the software to compile the animation. There is a simple old tool 'whirlgif' to produce an animated gif. Its nice and easy to use, but vanishs out of sight of google. It requires gif input. Please note, the most favourable version of ferret, namely pyferret does not support gif anymore but produces png-files. If you need gifs just write a little shell script using the ImageMagic tool 'convert' to produce gif files. Something like

files=`ls *png`

for file in $files
do
  name=`echo $file | cut -f1 -d.`                                                                                                                       
  echo $name                                                                                                                                            
  convert $name.png $name.gif                                                                                                                           
done 

More complex tools like mencoder can be used to glue a sequence of png-files.                                                                                                                                                  

But now to ferret. Just organise a loop over the time slices. It is easy to generalise it for more than 12 steps.

use coads_climatology

repeat/l=1:12 (\
shade/pal=blue_orange sst;\
let li=`l`;\
define symbol stamp=`li,zw=3`;\
define symbol filename=sst_($stamp);\
sp rm ($filename).png;\
frame/file=($filename).png/format=png/ypixel=1024;\
)

You may guess the reason for the complex way to build the filename. Using ls *png produces the file list in the correct order, not only for 12 time slices but also for a larger number (<1000 or for more with zw=4). This allows to produce an ordered list of files to be glued to an animated file with a single unix command ls sst*.png > filelist.

Hope this helps to get you started. 

Best,

Martin

From: saurabh rathore

Sent: 15 November 2016 23:21
To: ferret users
Subject: [ferret_users] for multiple png or gif file for the use of animation

 

dear all,

i want to create multiple png or gif files to produce animation which is my next concern step. i am having the latest pyferret and ferret and by the use of pyferret i am doing in this way

use coads_climatology

REPEAT/L=1:12 (FILL SST; GO fland; FRAME/file=sst0_`l`.gif)

but i am getting only a single image of the last time step instead of 12 images which i want to use in further animation.

apart from this i also want to ask that can i create multiple .png files for my animation and for the beautification of my plots how to issue multiple commands like ppl tics, shakey, conset etc. in this excercise.

i hope i will get help on this regard. 

 

regards, saurabh

 


--

 

 

REGARDS

 

Saurabh Rathore

Research Scholar (PhD.)

Centre For Oceans, Rivers, Atmosphere & Land Science Technology

Indian Institute Of Technology, Kharagpur

contact :- 91- 8345984434

 




[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement