<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -23,4 +23,4 @@ measure sun location with great precision, but I'd love to hear reports of
 &quot;Yeah, it worked to within a degree over the course of an afternoon in Spain.&quot;
 
 Brandon Stafford
-&lt;first_name&gt; @ pingswept org
\ No newline at end of file
+first_name @ pingswept org
\ No newline at end of file</diff>
      <filename>README.markdown</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,31 @@
-import urllib, urllib2, datetime
+#!/usr/bin/python
+ 
+# Tool for requesting data from US Naval Observatory
+ 
+# Copyright 2007 Brandon Stafford
+#
+# This file is part of Pysolar.
+#
+# Pysolar is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# Pysolar is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with Pysolar. If not, see &lt;http://www.gnu.org/licenses/&gt;.
 
-def EncodeRequest(timestamp, longitude, latitude, height):
+import urllib, urllib2, datetime, solar
+
+def EncodeRequest(latitude, longitude, timestamp, elevation):
 	params = {}
 	params['FFX'] = '2' # use worldwide locations script
 	params['ID'] = 'Pysolar'
-	params['pos'] = '8'
+	params['pos'] = '9'
 	params['obj'] = '10' # Sun
 	params['xxy'] = str(timestamp.year)
 	params['xxm'] = str(timestamp.month)
@@ -14,7 +35,7 @@ def EncodeRequest(timestamp, longitude, latitude, height):
 	params['t3'] = str(timestamp.second)
 	params['intd'] = '1.0'
 	params['unit'] = '1'
-	params['rep'] = '5'
+	params['rep'] = '1'
 	params['place'] = 'Name omitted'
 
 	(deg, rem) = divmod(longitude, 1)
@@ -31,21 +52,43 @@ def EncodeRequest(timestamp, longitude, latitude, height):
 	params['yy2'] = str(min) # minutes
 	params['yy3'] = str(sec) # seconds
 	
-	params['hh1'] = str(height) # height above sea level in meters
+	params['hh1'] = str(elevation) # height above sea level in meters
 	params['ZZZ'] = 'END'
 	data = urllib.urlencode(params)
 	return data
 
+latitude = 70
+longitude = 42
 d = datetime.datetime.utcnow()
-data = EncodeRequest(d,2,3,0)
+elevation = 100.0
+data = EncodeRequest(latitude, longitude, d, elevation)
 url = 'http://aa.usno.navy.mil/cgi-bin/aa_topocentric2.pl'
 req = urllib2.Request(url, data)
 response = urllib2.urlopen(req)
 
 lines = response.readlines()
-for line in lines:
-	print line
-
-the_page = response.read()
 response.close()
-# FFX=1&amp;ID=AA&amp;pos=8&amp;obj=10&amp;xxy=2008&amp;xxm=4&amp;xxd=19&amp;t1=0&amp;t2=0&amp;t3=0.0&amp;intd=1.0&amp;unit=1&amp;rep=5&amp;st=MA&amp;place=Boston&amp;hh1=0&amp;ZZZ=END
\ No newline at end of file
+
+print lines[21]
+result = lines[21]
+tokens = result.split(' ')
+print tokens
+
+usno_alt = float(tokens[9]) + float(tokens[10])/60.0 + float(tokens[11])/3600.0
+usno_az = float(tokens[16]) + float(tokens[17])/60.0 + float(tokens[18])/3600.0
+print usno_alt
+print usno_az
+
+alt = solar.GetAltitude(latitude, longitude, d, elevation)
+pysolar_alt = (90.0 - alt)
+az = solar.GetAzimuth(latitude, longitude, d, elevation)
+pysolar_az = (180.0 - az)%360.0
+
+print pysolar_alt
+print pysolar_az
+
+alt_delta = usno_alt - pysolar_alt
+az_delta = usno_az - pysolar_az
+
+print alt_delta
+print az_delta
\ No newline at end of file</diff>
      <filename>query_usno.py</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>e4dfbdec88b0f5fe60f876759ad5ae75baeb8958</id>
    </parent>
  </parents>
  <author>
    <name>Brandon Stafford</name>
    <email>brandon@pingswept.org</email>
  </author>
  <url>http://github.com/pingswept/pysolar/commit/32927a2b34e7bccb1328704ae431f813d4b64c38</url>
  <id>32927a2b34e7bccb1328704ae431f813d4b64c38</id>
  <committed-date>2008-04-20T21:27:51-07:00</committed-date>
  <authored-date>2008-04-20T21:27:51-07:00</authored-date>
  <message>More hackery on US Naval Observatory query script. Fixed email address in README.</message>
  <tree>34abe06208438b20d034d24832b3ebe229f242c5</tree>
  <committer>
    <name>Brandon Stafford</name>
    <email>brandon@pingswept.org</email>
  </committer>
</commit>
