Update of /cvsroot/freevo/freevo/src/util
In directory sc8-pr-cvs1:/tmp/cvs-serv32762

Modified Files:
        pymetar.py 
Log Message:
Updated from upstream... merged back in the timeoutsocket stuff, and removed
some extraneous 'print's


Index: pymetar.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/util/pymetar.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** pymetar.py  22 Nov 2003 21:06:41 -0000      1.2
--- pymetar.py  13 Jan 2004 00:15:09 -0000      1.3
***************
*** 1,5 ****
  # Copyright (C) 2002  Tobias Klausmann
  # Modified by Jerome Alet
! # Code contributed by Jerome Alet and Davide Di Blasi
  #
  # This program is free software; you can redistribute it and/or modify
--- 1,10 ----
+ # -*- coding: iso-8859-15 -*-
  # Copyright (C) 2002  Tobias Klausmann
  # Modified by Jerome Alet
! # 
! # Code contributed by:
! # Jerome Alet 
! # Davide Di Blasi
! # Adrian Holovaty
  #
  # This program is free software; you can redistribute it and/or modify
***************
*** 30,34 ****
  import string
  import urllib2
- import sys
  if float(sys.version[0:3]) >= 2.3:
      import socket
--- 35,38 ----
***************
*** 41,50 ****
          pass
  
- 
  __author__ = "[EMAIL PROTECTED]"
  
! __version__ = "0.6b"
  
! __doc__ = """Pymetar v%s (c) 2002, 2003 Tobias Klausman
  
  Pymetar is a python module and command line tool designed to fetch Metar
--- 45,53 ----
          pass
  
  __author__ = "[EMAIL PROTECTED]"
  
! __version__ = "0.7"
  
! __doc__ = """Pymetar v%s (c) 2002-2004 Tobias Klausman
  
  Pymetar is a python module and command line tool designed to fetch Metar
***************
*** 386,393 ****
--- 389,398 ----
          self.fullreport=None
          self.temp=None
+         self.tempf=None
          self.windspeed=None
          self.winddir=None
          self.vis=None
          self.dewp=None
+         self.dewpf=None
          self.humid=None
          self.press=None
***************
*** 436,440 ****
          Return the temperature in degrees Fahrenheit.
          """
!         return (self.temp * (9.0/5.0)) + 32.0
  
      def getDewPointCelsius(self):
--- 441,445 ----
          Return the temperature in degrees Fahrenheit.
          """
!         return self.tempf
  
      def getDewPointCelsius(self):
***************
*** 448,452 ****
          Return dewpoint in degrees Fahrenheit.
          """
!         return (self.dewp * (9.0/5.0)) + 32.0
  
      def getWindSpeed(self):
--- 453,457 ----
          Return dewpoint in degrees Fahrenheit.
          """
!         return self.dewpf
  
      def getWindSpeed(self):
***************
*** 456,459 ****
--- 461,471 ----
          return self.windspeed
  
+     def getWindSpeedMilesPerHour(self):
+         """
+         Return the wind speed in miles per hour.
+         """
+         if windspeed is not None:
+             return self.windspeed * 2.237
+ 
      def getWindDirection(self):
          """
***************
*** 693,697 ****
                  (name, pixmap, phenomenon) = phenomenon
                  pheninfo = phenomenon.get(squal, name)
!                 if type(pheninfo) != types.TupleType :
                      return (pheninfo, pixmap)
                  else :
--- 705,709 ----
                  (name, pixmap, phenomenon) = phenomenon
                  pheninfo = phenomenon.get(squal, name)
!                 if type(pheninfo) != type(()) :
                      return (pheninfo, pixmap)
                  else :
***************
*** 766,771 ****
          lines=self.Report.fullreport.split("\n")
  
-         #print "%s lines" % len(lines)
- 
          for line in lines:
              try:
--- 778,781 ----
***************
*** 777,782 ****
              data=data.strip()
  
-             #print header,'%%', data
- 
              # The station id inside the report
              if header.find("("+self.Report.givenstationid+")")!=-1:
--- 787,790 ----
***************
*** 814,831 ****
  
              elif (header == "Temperature"):
!                 t,i=data.split(" ",1)
!                 self.Report.temp=(float(t)-32)*(5.0/9.0)
  
              # wind dir and speed
              
              elif (header == "Wind"):
-                 #print header
                  if (data.find("Calm")!=-1):
-                     #print "calm"
                      self.Report.windspeed=0.0
                      self.Report.winddir=None
                      self.Report.windcomp=None
                  elif (data.find("Variable")!=-1):
-                     #print "var"
                      v,a,speed,r=data.split(" ",3)
                      self.Report.windspeed=(float(speed)*0.44704)
--- 822,839 ----
  
              elif (header == "Temperature"):
!                 f,i,c,i=data.split(None,3)
!                 self.Report.tempf=int(f)
!                 # The string we have split is "(NN C)", hence the slice
!                 self.Report.temp=int(c[1:])
! 
  
              # wind dir and speed
              
              elif (header == "Wind"):
                  if (data.find("Calm")!=-1):
                      self.Report.windspeed=0.0
                      self.Report.winddir=None
                      self.Report.windcomp=None
                  elif (data.find("Variable")!=-1):
                      v,a,speed,r=data.split(" ",3)
                      self.Report.windspeed=(float(speed)*0.44704)
***************
*** 833,837 ****
                      self.Report.windcomp=None
                  else:
-                     #print "elab"
                      f,t,comp,deg,r,d,speed,r=data.split(" ",7)
                      self.Report.winddir=int(deg[1:])
--- 841,844 ----
***************
*** 852,857 ****
              
              elif (header == "Dew Point"):
!                 dp,i=data.split(" ",1)
!                 self.Report.dewp=(float(dp)-32)*(5.0/9.0)
  
              # humidity
--- 859,866 ----
              
              elif (header == "Dew Point"):
!                 f,i,c,i=data.split(None,3)
!                 self.Report.dewpf=int(f)
!                 # The string we have split is "(NN C)", hence the slice
!                 self.Report.dewp=int(c[1:])
  
              # humidity




-------------------------------------------------------
This SF.net email is sponsored by: Perforce Software.
Perforce is the Fast Software Configuration Management System offering
advanced branching capabilities and atomic changes on 50+ platforms.
Free Eval! http://www.perforce.com/perforce/loadprog.html
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to