Changeset 166

Show
Ignore:
Timestamp:
01/21/08 22:39:12 (1 year ago)
Author:
vud1
Message:

"solve the Martin Erikson bug"

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pytrainer/trunk/pytrainer/lib/gpx.py

    r161 r166  
    146146                                if last_lat != "False": 
    147147                                        time_ = tmp_time - last_time 
    148                                         tempnum=(math.sin(last_lat)*math.sin(tmp_lat))+(math.cos(last_lat)*math.cos(tmp_lat)*math.cos(tmp_lon-last_lon)) 
    149                                         #try: 
    150                                         #Obtenemos el punto respecto al punto anterior 
    151                                         try: 
    152                                                 dist=math.acos(tempnum)*111.302*57.29577951 
    153                                         except: 
    154                                                 dist=0 
    155                                         total_dist += dist 
    156                                         total_hr += hr 
    157                                         #dividimos kilometros por hora (no por segundo) 
    158                                         tmp_vel = dist/((time_)/3600.0) 
    159                                         vel,his_vel = self._calculate_velocity(tmp_vel,his_vel) 
    160                                         #si la velocidad es menor de 90 lo damos por bueno 
    161                                         if vel<90 and time_ <100: 
    162                                                 self.total_time += time_ 
    163                                                 retorno.append((total_dist,tmp_alt, self.total_time,vel,lat,lon,hr)) 
    164                                                 rel_alt = tmp_alt - last_alt 
    165                                                 if rel_alt > 0: 
    166                                                         self.upositive += rel_alt 
    167                                                 elif rel_alt < 0: 
    168                                                         self.unegative -= rel_alt 
     148                                        if time_>0: 
     149                                                tempnum=(math.sin(last_lat)*math.sin(tmp_lat))+(math.cos(last_lat)*math.cos(tmp_lat)*math.cos(tmp_lon-last_lon)) 
     150                                                #try: 
     151                                                #Obtenemos el punto respecto al punto anterior 
     152                                                try: 
     153                                                        dist=math.acos(tempnum)*111.302*57.29577951 
     154                                                except: 
     155                                                        dist=0 
     156                                                total_dist += dist 
     157                                                total_hr += hr 
     158                                                #dividimos kilometros por hora (no por segundo) 
     159                                                tmp_vel = dist/((time_)/3600.0) 
     160                                                vel,his_vel = self._calculate_velocity(tmp_vel,his_vel) 
     161                                                #si la velocidad es menor de 90 lo damos por bueno 
     162                                                if vel<90 and time_ <100: 
     163                                                        self.total_time += time_ 
     164                                                        retorno.append((total_dist,tmp_alt, self.total_time,vel,lat,lon,hr)) 
     165                                                        rel_alt = tmp_alt - last_alt 
     166                                                        if rel_alt > 0: 
     167                                                                self.upositive += rel_alt 
     168                                                        elif rel_alt < 0: 
     169                                                                self.unegative -= rel_alt 
    169170                                 
    170171                                last_lat = tmp_lat