#!/usr/bin/env bash

if [ "$1" == "" ]; then
	echo "Start year required. Exit."
	exit 1
elif [ "$2" == "" ]; then
	echo "End year required. Exit."
	exit 1
fi

syear=$1
eyear=$2

for year in $(seq ${eyear} -1 ${syear})
do
	echo -n "Calculating  $year SPRING ... "
	(time ipython nc2scores_aeronet_new.py all aeronet ${year}03,${year}04,${year}05 &> ${year}03_${year}05.log);
	echo "done.";
	rsync -avz --no-links /data/daily_dashboard/obs/aeronet/h5_new/${year}03-${year}05*.h5 bscesdust02.bsc.es:/data/daily_dashboard/obs/aeronet/h5/
	wait
	echo -n "Calculating  $year SUMMER ... ";
	(time ipython nc2scores_aeronet_new.py all aeronet ${year}06,${year}07,${year}08 &> ${year}06_${year}08.log);
	echo "done.";
	rsync -avz --no-links /data/daily_dashboard/obs/aeronet/h5_new/${year}06-${year}08*.h5 bscesdust02.bsc.es:/data/daily_dashboard/obs/aeronet/h5/
	wait
	echo -n "Calculating  $year AUTUMN ... ";
	(time ipython nc2scores_aeronet_new.py all aeronet ${year}09,${year}10,${year}11 &> ${year}09_${year}11.log);
	echo "done."
	rsync -avz --no-links /data/daily_dashboard/obs/aeronet/h5_new/${year}09-${year}11*.h5 bscesdust02.bsc.es:/data/daily_dashboard/obs/aeronet/h5/
done
