#! /bin/csh -f

set start_time = `date +%s`
source ~/.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 /network/rit/lab/mesonet/mesonet/climate/daily

rm *png precip*.dat solar*.dat monthly*.dat weekly*.dat daily*.dat *three*dat

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 OPPE REDH COPA ANDE HARP BROO EAUR YORK HART HERK ADDI SPRI MALO VOOR HAMM EDWA SUFF BSPA BEAC DEPO MEDU ROXB ELDR GFLD WGAT ELLE KIND WBOU OLDF NHUD SCIP BING NEWC CLAR ONTA CROG RAQU WANT SOUT HFAL DOVE GROT SCHO TANN SOME BUFF GFAL PISE BREW QUEE STAT BKLN MANH BRON STON)

cp ../../meta/$station.txt station.ascii
ncl thirty.ncl
convert $station.png -gravity North -chop 0x100 temp.png
convert -shave 150x60 temp.png $station.png
rm temp.png
pngquant ${station}.png
mv ${station}-fs8.png ${station}.png

scp $station.png nbassill@operations.nysmesonet.org:/home/nbassill/public_html/plots/climate/daily/$station.png

ncl ninety.ncl
convert ${station}90.png -gravity North -chop 0x100 temp.png
convert -shave 150x60 temp.png ${station}90.png
rm temp.png
pngquant ${station}90.png
mv ${station}90-fs8.png ${station}90.png

rm /home/nb965428/public_html/climate/daily/${station}90.png
scp ${station}90.png nbassill@operations.nysmesonet.org:/home/nbassill/public_html/plots/climate/daily/${station}90.png

end

ncl maps.ncl
convert daily.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png daily.png
convert dailyhigh.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png dailyhigh.png
convert dailylow.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png dailylow.png
convert dailymean.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png dailymean.png
convert dailyhighanomaly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png dailyhighanomaly.png
convert dailylowanomaly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png dailylowanomaly.png
convert weekly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png weekly.png
convert weeklyhigh.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png weeklyhigh.png
convert weeklylow.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png weeklylow.png
convert weeklymean.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png weeklymean.png
convert weeklyhighanomaly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png weeklyhighanomaly.png
convert weeklylowanomaly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png weeklylowanomaly.png
convert monthly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png monthly.png
convert monthlyhigh.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png monthlyhigh.png
convert monthlylow.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png monthlylow.png
convert monthlymean.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png monthlymean.png
convert monthlyhighanomaly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png monthlyhighanomaly.png
convert monthlylowanomaly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png monthlylowanomaly.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 precipdaily.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png precipdaily.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
convert weeklyheating.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png weeklyheating.png
convert monthlyheating.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png monthlyheating.png
convert dailyheating.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png dailyheating.png
convert weeklycooling.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png weeklycooling.png
convert monthlycooling.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png monthlycooling.png
convert dailycooling.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png dailycooling.png
convert threemonthlycooling.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png threemonthlycooling.png
convert threemonthlyheating.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png threemonthlyheating.png
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
convert threemonthlyhigh.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png threemonthlyhigh.png
convert threemonthlylow.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png threemonthlylow.png
convert threemonthlymean.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png threemonthlymean.png
convert threemonthlyhighanomaly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png threemonthlyhighanomaly.png
convert threemonthlylowanomaly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png threemonthlylowanomaly.png
convert dailyhighsigmaanomaly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png dailyhighsigmaanomaly.png
convert dailylowsigmaanomaly.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png dailylowsigmaanomaly.png

ncl extremes.ncl

convert threemonthlymaximum.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png threemonthlymaximum.png
convert threemonthlyminimum.png -gravity North -chop 0x50 temp.png
convert -shave 175x300 temp.png threemonthlyminimum.png

rm temp.png
scp daily*.png weekly*.png monthly*.png threemonthly*.png solar*png precip*png nbassill@operations.nysmesonet.org:/home/nbassill/public_html/plots/climate/daily/

makespatialclimate.csh #make spatial map version of above maps

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"
