<br><font size=2 face="sans-serif">John: One way to handle the situation
of longitude is to make everything west of the Greenwich meridan a negative
value until -180 degrees and everything east of Greenwich a positive value.
HTH.</font>
<br><font size=2 face="sans-serif"> Albert</font>
<br>
<br>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>John <washakie@gmail.com></b>
</font>
<br><font size=1 face="sans-serif">Sent by: tutor-bounces@python.org</font>
<p><font size=1 face="sans-serif">07/10/2007 04:22 PM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">tutor@python.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">[Tutor] An interesting case... of east
vs. west</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=3>I was trying to read in a tab delimited file i was given
with lat and lon, the thing is I needed decimal lat, and decimal long...
well, anyway I think you can see what my problem was:</font>
<br><font size=3> </font>
<br><font size=3>for i in range(0,344)
<br>
y=d[i][2].split('\xb0')
<br>
x=d[i][3].split('\xb0')
<br>
ydeg,ymin=y[0].strip(),y[1].rstrip('\' N').rstrip("\'
S") <br>
xdeg,xmin=x[0].strip(),x[1].rstrip("\' E").rstrip("\'
W")<br>
if re.search('\ZW','x[1]') xmin=-1*xmin <br>
if re.search('\ZS','y[1]') ymin=-1*ymin
<br>
declat=int(ydeg)+(float(ymin)/60)
<br>
declon=int(xdeg)+(float(xmin)/60) </font>
<br><font size=3> </font>
<br><font size=3>The thing is, it isn't terribly robust (I'm not even positive
it's working correctly!!). For instance, as you might have guessed I was
given Lat and Lon in the following format:</font>
<br><font size=3>STNA 45° 49' N 08° 38' E<br>
STNB 46° 58' 19° 33' E<br>
STNC 53°33' -9°54' <br>
STND 51°32' N 12°54' W <br>
</font>
<br><font size=3>Some indicating north or some, and some not. This wasn't
a concern, as I knew they were all North. However, the West / East issue
is another story. Anyone have a more elegant solution?</font>
<br><font size=3> </font>
<br><font size=3>-john</font>
<br><font size=3> </font><font size=2><tt>_______________________________________________<br>
Tutor maillist - Tutor@python.org<br>
http://mail.python.org/mailman/listinfo/tutor<br>
</tt></font>
<br>