#----------- # Variables to enter: Sunset calculator for local sunset (both LST and UTC relative) # ---------- let day=15 let month=7 let year=2005 let lat2=20.50 let lon2=-65.50 pi=$(echo "scale=10; 4*$((atan(1)))" | bc) let n1=$((floor(275*$month/9))) let n2=$((floor(($month+9)/12))) let n3=$(((1+floor(($year-4*$((floor($year/4)))+2)/3)))) let n=$n1-($n2*$n3)+$day-30 lngHour=$(echo "scale=5; ($lon2/15)" | bc) let t=$n+((18-($lngHour))/24) let M=0.9856*$t-3.289 let L=$M+(1.916*$((sin($pi/180*$M)))+(0.02*$((sin($pi/180*2*$M)))))+282.634-360 let RA=180/$pi*$((atan(0.91764*$((tan($pi/180*$L)))))) let Lquadrant=$((floor($L/90)))*90 let RAquadrant=$((floor($RA/90)))*90 let RA2=$RA+($Lquadrant-($RAquadrant)) let RAhr=$RA2/15 let sinDec=0.39782*$((sin($pi/180*$L))) let cosDec=$((cos($pi/180*(180/$pi)*$((asin($sinDec)))))) let cosHa=$((cos($pi/180*90.833)))-($sinDec*$((sin($pi/180*$lat2)))) let cosHb=cosDec*$((cos($pi/180*$lat2))) let cosH=$cosHa/$cosHb let H=180/$pi*$((acos($cosH))) let H2=$H/15 let T=$H2+$RAhr-(0.06571*$t)-6.622 let utc=24+$T-($lngHour) let utchh=$((floor($utc))) let utcmm=60*($utc-($utchh)) printf %.0f $lngHour | read timezoneadj let localthh=$utchh+$timezoneadj printf %.0f $utcmm | read localtmm echo echo Local sunset at the current storm position is: $localthh":"$localtmm LST echo echo Local sunset at the current storm position is: $localthh":"$localtmm UTC