#! /bin/csh -f

set start_time = `date +%s`
source /aca1/nb965428/.cshrc

set mm = `date -u +%m`
set dd = `date -u +%d`
set hh = `date -u +%k`
set yy = `date -u +%y`
echo The Current Date Is $yy$mm$dd
set date = $yy$mm$dd

cd /aca1/nb965428/wrf2gem/mesonet/climate/daily

rm *three*dat
#foreach station (ADDI BKLN BUFF CONS DOVE FAYE HART MORR OSWE QUEE BNLX BURD CLAR COOP DUAN HERK \
#                 NBRA RAND WARS BURT CLIF EAUR HNTC MALO NEWC OWEG REDF TUPP GOVX \
#                 BREW CAMD CLYM CORN EDIN ILAK MARC OLDF PENN REDH TYRO BELM BROC CROG EDWA GROV ITHA MEDI \
#                 OLEA PHIL ROCK SPRI VALA WBOU BRON CHAZ COHO ELMI HAMM MEDU ONTA PISE RUSH STAT VOOR YORK BING BROO \
#                 HARP MORA OSSI POTS SARA WALL SCHA EHAM LGEO WANT RAQU ELDR ELLE COPA ROXB OSCE BALL \
#                 DEPO TANN ANDE BARN NHUD OPPE WOOD)

#cp ../../meta/$station.txt station.ascii
#ncl blank.ncl
#convert $station.png -gravity North -chop 0x100 temp.png
#convert -shave 150x60 temp.png $station.png
#rm temp.png
#cp $station.png /home/nb965428/public_html/climate/daily/$station.png
#end


foreach station (SCHU WHIT WATE CSQR SPRA COLD JORD WEST BERK BELD ESSX CHES STEP OTIS LAUR GABR COBL TICO WFMB COPE BATA SBRI SHER DELE WOLC JOHN LOUI TULL WARW WALT CINC FRED BRAN WELL CAPE BELL WARS BELM COHO BURD TYRO PENN CLYM RAND OLEA BURT BROC SCHA REDF HARR OSCE WALL MORR CAMD ELMI PHIL POTS OSWE CHAZ SARA RUSH TUPP CLIF FAYE EDIN MEDI GROV OWEG NBRA DUAN ILAK ANDE HARP BROO EAUR YORK HART HERK)

#foreach station (WELL CAPE BELL COPE)
cp ../../meta/$station.txt station.ascii
ncl ninety.ncl
convert $station.png -gravity North -chop 0x100 temp.png
convert -shave 150x60 temp.png ${station}90.png
rm temp.png 

#rm /home/nb965428/public_html/climate/daily/$station.png
cp ${station}90.png /home/nb965428/public_html/climate/daily/${station}90.png

#cp ${station}data stationdata
#ncl solar.ncl

end
# the below adds in fake data that won't be plotted to get ncl to read all of the previous data
#echo "-80,-80,0" >> monthly.dat
#echo "-80,-80,0" >> weekly.dat
#echo "-80,-80,0" >> daily.dat
#echo "-80,-80,0" >> precipmonthly.dat
#echo "-80,-80,0" >> precipweekly.dat
#echo "-80,-80,0" >> preciptotalmonthly.dat
#echo "-80,-80,0" >> preciptotalweekly.dat
#echo "-80,-80,0" >> preciptotaldaily.dat
#echo "-80,-80,0" >> solarmonthly.dat
#echo "-80,-80,0" >> solarweekly.dat
#echo "-80,-80,0" >> solardaily.dat
echo "-80,-80,0" >> solarthreemonthly.dat
echo "-80,-80,0" >> preciptotalthreemonthly.dat
echo "-80,-80,0" >> precipthreemonthly.dat
echo "-80,-80,0" >> threemonthly.dat
ncl temp.ncl 
convert preciptotalthreemonthly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png preciptotalthreemonthly.png
convert precipthreemonthly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png precipthreemonthly.png
convert threemonthly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png threemonthly.png
convert solarthreemonthly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png solarthreemonthly.png
cp *threemonthly*png /home/nb965428/public_html/climate/daily/
#ncl departure.ncl
#convert daily.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png daily.png
#convert weekly.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png weekly.png
#convert monthly.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png monthly.png
#convert solarweekly.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png solarweekly.png
#convert solarmonthly.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png solarmonthly.png
#convert solardaily.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png solardaily.png
#convert precipweekly.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png precipweekly.png
#convert precipmonthly.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png precipmonthly.png
#convert preciptotaldaily.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png preciptotaldaily.png
#convert preciptotalweekly.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png preciptotalweekly.png
#convert preciptotalmonthly.png -gravity North -chop 0x50 temp.png
#convert -shave 175x300 temp.png preciptotalmonthly.png

rm temp.png
#cp daily.png weekly.png monthly.png solar*png precip*png /home/nb965428/public_html/climate/daily/

#cp *ncl *csh save
set end_time  = `date +%s`
@ length_time = $end_time - $start_time
echo "It took this long to run getthirty.csh: $length_time seconds"
