#!/bin/ksh

# **************************** LICENSE START ***********************************
#
# Copyright 2012 ECMWF and INPE. This software is distributed under the terms
# of the Apache License version 2.0. In applying this license, ECMWF does not
# waive the privileges and immunities granted to it by virtue of its status as
# an Intergovernmental Organization or submit itself to any jurisdiction.
#
# ***************************** LICENSE END ************************************


# --------------------------------------------------------------
# Converting png files generated by Metview into a video format
# --------------------------------------------------------------

set -x

if [ $# -ne 3 ] 
then
	echo $0 ": worng number of arguments are specified!" 
fi  

if [ x$1 != x ]
then
    format=$1
fi

if [ x$2 != x ]
then
    fileBase=$2
fi

if [ x$3 != x ]
then
    outFile=$3
fi

retVal=0

if [ $format = "gif" ]
then
	convert -delay 10 ${fileBase}_*.png $outFile
	retVal=$0 
fi

#rm -f ${filePath}${fileBase}

#clear
rm -f ${fileBase}_*.png

exit retVal