Skip to content
Permalink
Browse files

Minor changes to the seed pipeline from running on real data

As always, no commit survives the first encounter with real data
- Ensure that the backup database step is read from the database at the correct URL
- deal with some data that is still in lat, lng format during conversion

```
WARNING:root:Found OutOfRangeError while converting=[37.2793693359, -121.9477739912], swapping
WARNING:root:Found OutOfRangeError while converting=[37.8450065077, -122.2505039016], swapping
WARNING:root:Found OutOfRangeError while converting=[37.7934984948, -122.396811555], swapping
WARNING:root:Found OutOfRangeError while converting=[37.8701622504, -122.2680943316], swapping
WARNING:root:Found OutOfRangeError while converting=[37.786435505, -122.4023798827], swapping
WARNING:root:Found OutOfRangeError while converting=[37.8702876992, -122.2685171307], swapping
WARNING:root:Found OutOfRangeError while converting=[37.7890437261, -122.4031406148], swapping
```
  • Loading branch information...
shankari committed Feb 22, 2018
1 parent 66954ad commit ead85e30da16796b075955445e259c434e31d749
@@ -51,7 +51,7 @@ def runPipeline(self):
logging.info("initial loadTrainingDataStep DONE")

logging.debug("finished loading current training set, now loading from backup!")
backupSections = MongoClient('localhost').Backup_database.Stage_Sections
backupSections = MongoClient(edb.url).Backup_database.Stage_Sections
self.backupConfirmedSections = self.loadTrainingDataStep(allConfirmedTripsQuery, backupSections)
logging.info("loadTrainingDataStep DONE")

@@ -6,13 +6,14 @@
from sklearn.cluster import DBSCAN

# Our imports
import emission.core.get_database as edb
from emission.core.get_database import get_section_db, get_mode_db, get_routeCluster_db,get_transit_db
from emission.core.common import calDistance, Include_place_2
from emission.analysis.modelling.tour_model.trajectory_matching.route_matching import getRoute,fullMatchDistance,matchTransitRoutes,matchTransitStops

Sections = get_section_db()
from pymongo import MongoClient
BackupSections = MongoClient("localhost").Backup_database.Stage_Sections
BackupSections = MongoClient(edb.url).Backup_database.Stage_Sections
Modes = get_mode_db()


@@ -288,9 +289,16 @@ def mode_cluster(mode,eps,sam):
utm_y = []
for row in mode_change_pnts:
# GEOJSON order is lng, lat
utm_loc = utm.from_latlon(row[1],row[0])
utm_x = np.append(utm_x,utm_loc[0])
utm_y = np.append(utm_y,utm_loc[1])
try:
utm_loc = utm.from_latlon(row[1],row[0])
utm_x = np.append(utm_x,utm_loc[0])
utm_y = np.append(utm_y,utm_loc[1])
except utm.error.OutOfRangeError as oore:
logging.warning("Found OutOfRangeError while converting=%s, swapping" % row)
utm_loc = utm.from_latlon(row[0],row[1])
utm_x = np.append(utm_x,utm_loc[1])
utm_y = np.append(utm_y,utm_loc[0])

utm_location = np.column_stack((utm_x,utm_y))
db = DBSCAN(eps=eps,min_samples=sam)
db_fit = db.fit(utm_location)

0 comments on commit ead85e3

Please sign in to comment.
You can’t perform that action at this time.