echo $0
cd "$(dirname "$0")"
echo $(date)
. ./config.cfg  ##include configuration file

## guardar el geotiff en web

cmp -s $web_path/goes16_RR_1h.tif $web_path/goes16_RR_1h_last.tif
resultado=$?
echo "Resultado $resultado"
if test $resultado -eq 0
    then
    echo " The files match"
else
    echo " The files are different... process"
    cp $web_path/goes16_RR_1h.tif $web_path/goes16_RR_1h_last.tif
    $gdal_path/python goes_RR1h.py $gdal_path $web_path

    $gdal_path/gdalwarp $web_path/goes16_RR_3h.tif -t_srs EPSG:3857 -r cubicspline -tr 1500 1500 goes16_RR_3h_3857r.tif -overwrite
    $gdal_path/gdaldem color-relief goes16_RR_3h_3857r.tif -nearest_color_entry ./colorsRR.txt $web_path/goes16_accRR_3h.png -alpha
    
    $gdal_path/gdalwarp $web_path/goes16_RR_6h.tif -t_srs EPSG:3857 -r cubicspline -tr 1500 1500 goes16_RR_6h_3857r.tif -overwrite
    $gdal_path/gdaldem color-relief goes16_RR_6h_3857r.tif -nearest_color_entry ./colorsRR.txt $web_path/goes16_accRR_6h.png -alpha
    
    $gdal_path/gdalwarp $web_path/goes16_RR_12h.tif -t_srs EPSG:3857 -r cubicspline -tr 1500 1500 goes16_RR_12h_3857r.tif -overwrite
    $gdal_path/gdaldem color-relief goes16_RR_12h_3857r.tif -nearest_color_entry ./colorsRR.txt $web_path/goes16_accRR_12h.png -alpha
    
    $gdal_path/gdalwarp $web_path/goes16_RR_24h.tif -t_srs EPSG:3857 -r cubicspline -tr 1500 1500 goes16_RR_24h_3857r.tif -overwrite
    $gdal_path/gdaldem color-relief goes16_RR_24h_3857r.tif -nearest_color_entry ./colorsRR.txt $web_path/goes16_accRR_24h.png -alpha
    
 fi