// Retrieving sunset from BOM | Light At The End Of The Tunnel Retrieving sunset from BOM – Light At The End Of The Tunnel

Light At The End Of The Tunnel

systems administration meanderings

Retrieving sunset from BOM

I needed to find the sunset time, so I can turn on my path lights for a couple of hours each night.  The BOM usually display the sunrise and sunset times when they provide the weather forecast. Having looked at the site I found that it provides a tool, via Geoscience Australia, to find out the sunset and sunrise times each day or for a whole year.

As I needed the sunset time I came up with a command to retrieve it [bash]LATHEMI=south #Latitude Hemisphere LONGHEMI=east #Longitude hemisphere  LOCATION=SOMEWHERE #Your location LATDEG=0 #Latitude degrees LATMIN=0 #Latitude minutes LATSEC=0 # Latitude seconds LONGDEG=0 # Longitude degrees LONGMIN=0 # Longitude minutes LONGSEC=0 # Longitude seconds STATE=“NT%20-%20Darwin%20(most%20location)” #Australian state DST=No #Daylight Savings Time (Yes|No) TZ=10 #Timezone UTCOFF=10 #Offset from UTC ATZ=“(EST) #Eastern Standard Time  LT=“00:00:00 PM” #Time making the call AUSTZONE=“+10” EVENT=1 TIMEZONE=“+10” DATE=date +"%d/%m/%Y"

SUNSET=wget -O - -q --post-data="END=END&lathemi=$LATHEMI\ &longhemi=$LONGHEMI&Location=$LOCATION&LatDeg=$LATDEG\ &LatMin=$LATMIN&LatSec=$LATSEC&LongDeg=LONGDEG\ &LongMin=LONGMIN&LongSec=LONGSEC&State=$STATE&DST=$DST\ &TZ=$TZ&UTCOFF=$UTCOFF&ATZ=$ATZ&LT=$LT&austzone=$AUSTZONE\ &event=$EVENT&TimeZone=$TIMEZONE&Date=$DATE"\ http://www.ga.gov.au/bin/geodesy/run/sunrisenset | grep Rise | \ cut -d' ' -f 7[/bash]

The good news is, you can get all the parameters to slot into the variables from Geoscience Australia site, here.