Time frames over multiple files and animation¶
In order to produce the same images over multiple files (time frames, harmonics, tracks, seasons, vertical modes, etc.), the POCViP script needs to be adapted and recursively apply to each file using a bash script.
1. In POCViP script¶
selectView view
#Setup colormap
--palette colors={-3 #408 -2 #88f -1 #088 0 #fff 1 #fd0 2 #f88 3 #c00}
setView fi=0; la=44.594;lo=-6.147;zo=42.6912098; li=0
#Replace the filename by 6/ (the forth item in the main window = first file called in the command)
selectFile 6/
selectVar ssh_w
setStatus interpto=p
#Replace the grid file by 7/ (the second file)
selectFile 7/
setStatus isgrid=true
#Setup range and isolines
selectFile formulaAndIso/
selectVar p
setStatus value={-2.5 *0.5 2.5};line={width=0.5;display="true";color="#000";style=""};label={display="false";fgColor="#000";bgColor="#fff";font="Sans";size="/2";border{width=0.5;display="true";color="#000";style=""}}
#Save the image with generic name that will be renamed afterward
renameView tmp.png
saveView 663 680
2. In bash script:¶
#!/bin/sh
cdir=`pwd`
#Create directory to gather all the frames
mkdir anim
i=0
#go to the wanted directory
cd /ecola/share/tmp/training/BOBIBE_hourly
#loop on the files
for file in `ls *.nc`
do
i=`printf '%03d' $[1+$i]`
#apply the POCViP script (grid/file order should match pocvip script)
pocvip -x -f $file -f ../BOBIBE_grid/grid.nc . $cdir/BOBIBE-hourly-ssh.pocvip -q
#Move and rename the image
mv tmp.png $cdir/anim/ssh-$i.png
done
cd $cdir/anim
#create movie from frame
ffmpeg -r 8 -i ssh-%03d.png ssh.mp4
Then run this bash script to get the images and the animation.