echo $0
cd "$(dirname "$0")"
echo $(date)


. ./config.cfg  ##include configuration file


product="NESDIS-GHE-HourlyRainfall"
output="re_nesdis_ghe.gif"
curl "https://realearth.ssec.wisc.edu/api/image?products=$product&width=1662&height=888&client=RealEarth&bounds=0,-120,35,-50&timespan=-8t&animate=true&animationspeed=90" > $web_path/$output
/usr/bin/convert -dispose previous $web_path/$output -fuzz 20% -transparent black $web_path/$output

product="G16-ABI-FD-BAND13-GRAD.100"
output="re_goes16_13.gif"
curl "https://realearth.ssec.wisc.edu/api/image?products=$product&width=1662&height=888&client=RealEarth&bounds=0,-120,35,-50&timespan=-8t&animate=true&animationspeed=90" > $web_path/$output


product="MIMICTPW2"
output="re_tpw.gif"
curl "https://realearth.ssec.wisc.edu/api/image?products=$product&width=1662&height=888&client=RealEarth&bounds=0,-120,35,-50&timespan=-8t&animate=true&animationspeed=90" > $web_path/$output


product="G16-ABI-FD-true-color"
output="re_truecolor.gif"
curl "https://realearth.ssec.wisc.edu/api/image?products=$product&width=2493&height=1332&client=RealEarth&bounds=0,-120,35,-50&timespan=-8t&animate=true&animationspeed=90" > $web_path/$output

product="G16-ABI-FD-BAND02"
output="re_goes16_02.gif"
curl "https://realearth.ssec.wisc.edu/api/image?products=$product&width=2493&height=1332&client=RealEarth&bounds=0,-120,35,-50&timespan=-8t&animate=true&animationspeed=90" > $web_path/$output

product="G16-ABI-FD-BAND09"
output="re_goes16_09.gif"
curl "https://realearth.ssec.wisc.edu/api/image?products=$product&width=1662&height=888&client=RealEarth&bounds=0,-120,35,-50&timespan=-8t&animate=true&animationspeed=90" > $web_path/$output

##glmgroupdensity
product="glmgroupdensity"
output="re_glmgroupdensity.gif"
curl "https://realearth.ssec.wisc.edu/api/image?products=$product&width=1662&height=888&client=RealEarth&bounds=0,-120,35,-50&timespan=-20t&animate=true&animationspeed=90" > $web_path/$output
/usr/bin/convert -dispose previous $web_path/$output -fuzz 20% -transparent black $web_path/$output

##	G16-daynight
product="G16-daynight"
output="re_G16-daynight.gif"
### descontinuado 240529 no se usa :: curl "https://realearth.ssec.wisc.edu/api/image?products=$product&width=1662&height=888&client=RealEarth&bounds=0,-120,35,-50&timespan=-8t&animate=true&animationspeed=90" > $web_path/$output

##	globalwv-grad
product="globalwv-grad"
output="re_globalwv-grad.gif"
curl "https://realearth.ssec.wisc.edu/api/image?products=$product&width=1662&height=888&client=RealEarth&bounds=0,-120,35,-50&timespan=-8t&animate=true&animationspeed=90" > $web_path/$output


######## Google cloud

# Check if gsutil is installed
if ! command -v gsutil &> /dev/null; then
  echo "Error: gsutil is not installed."
  exit 1
fi



# Copy files and subdirectories to the bucket
echo "Copying files to bucket..."
gsutil -m cp -r "$web_path/*.gif" "$gcbucket_folder"



echo $(date)