#!/bin/bash

genimg () {
  width=`identify -format %w $1.png`; \
  factor=`echo "scale=4; ${width}/5424" | bc`
  height=`echo "scale=4; 1+${factor}*250" | bc`
  shift=`echo "scale=4; ${factor}*60" | bc`
  convert -background '#0008' -fill lightgray -gravity center -size ${width}x${height} \
           caption:"$2" \
           $1.png +swap -gravity south -geometry +0+${shift} -composite $1s.png
}

cd /media/ramdisk/montage
genimg fc "False Color"
genimg ch02 "Channel 2"
genimg ch07_enhanced "Channel 7e"
genimg ch08_enhanced "Channel 8e"
genimg ch09_enhanced "Channel 9e"
genimg ch13_enhanced "Channel 13e"
genimg ch14_enhanced "Channel 14e"
genimg ch15 "Channel 15"
genimg ch15_enhanced "Channel 15e"
genimg goes17 "GOES 17 Channel 13e"

cd /media/ramdisk/montage2
genimg acha "Average Cloud Height Altitude"
genimg acht "Average Cloud Height Temperature"
genimg dsi "Derived Stability Index"
genimg rrqpe "Rain Rate"
genimg st "Surface Temperature"
genimg tpw2 "Total Precipitable Water"

cd /media/ramdisk
montage montage/fc.png montage/ch02.png montage/ch07_enhanced.png montage/ch08_enhanced.png montage/ch09_enhanced.png montage/ch13_enhanced.png montage/ch14_enhanced.png montage/ch15.png montage/ch15_enhanced.png montage/goes17.png montage2/acha.png montage2/acht.png montage2/dsi.png montage2/rrqpe.png montage2/st.png montage2/tpw2.png -geometry 600x600 latest_COMPLETENL.png

montage montage/fcs.png montage/ch02s.png montage/ch07_enhanceds.png montage/ch08_enhanceds.png montage/ch09_enhanceds.png montage/ch13_enhanceds.png montage/ch14_enhanceds.png montage/ch15s.png montage/ch15_enhanceds.png montage/goes17s.png montage2/achas.png montage2/achts.png montage2/dsis.png montage2/rrqpes.png montage2/sts.png montage2/tpw2s.png -geometry 600x600 latest_COMPLETEL.png
