Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling of mexico-city survey data for scenario generation #26

Draft
wants to merge 16 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions matsim/scenariogen/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

import argparse

from .data import run_create_ref_data
from .data import run_extract_activities
from .data import run_lookup_regiostar
from .network import run_collect_results
from .network import run_edges as sumo_edges
from .network import run_intersections as sumo_intersections
from .network import run_routes as sumo_routes
from .network import run_train_model
from matsim.scenariogen.data import run_create_ref_data
from data import run_extract_activities
from matsim.scenariogen.data import run_lookup_regiostar
from matsim.scenariogen.network import run_collect_results
from matsim.scenariogen.network import run_edges as sumo_edges
from matsim.scenariogen.network import run_intersections as sumo_intersections
from matsim.scenariogen.network import run_routes as sumo_routes
from matsim.scenariogen.network import run_train_model


def _add(subparsers, m):
Expand Down
22 changes: 18 additions & 4 deletions matsim/scenariogen/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def _batch(iterable: list, max_batch_size: int):
def read_all(dirs: Union[str, List[str]], regio=None) -> Tuple[pd.DataFrame]:
""" Scan directories and read everything into one dataframe """

from .formats import srv, mid
from .formats import srv, mid, eodmx

hh = []
pp = []
Expand All @@ -42,7 +42,7 @@ def read_all(dirs: Union[str, List[str]], regio=None) -> Tuple[pd.DataFrame]:

for d in dirs:

for format in (srv, mid):
for format in (srv, mid, eodmx):

files = []

Expand Down Expand Up @@ -112,12 +112,14 @@ class HouseholdType(AutoNameLowerStrEnum):
MULTI_W_CHILDREN = auto()
MULTI_WO_CHILDREN = auto()
SINGLE = auto()
UNKNOWN = auto()


class EconomicStatus(AutoNameLowerStrEnum):
simei94 marked this conversation as resolved.
Show resolved Hide resolved
VERY_LOW = auto()
LOW = auto()
MEDIUM = auto()
MEDIUM_LOW = auto()
MEDIUM_HIGH = auto()
HIGH = auto()
VERY_HIGH = auto()
UNKNOWN = auto()
Expand Down Expand Up @@ -179,6 +181,7 @@ class Purpose(AutoNameLowerStrEnum):
HOME = auto()
WAYBACK = auto()
OTHER = auto()
ACCOMP_OTHER = auto()


class TripMode(AutoNameLowerStrEnum):
Expand All @@ -189,6 +192,8 @@ class TripMode(AutoNameLowerStrEnum):
PT = auto()
MOTORCYCLE = auto()
OTHER = auto()
# This transport mode represents what in english is known as shared taxi / taxibus / minibus / colectivo in spanish:
TAXIBUS = auto()


class DistanceGroup(AutoNameLowerStrEnum):
Expand Down Expand Up @@ -262,6 +267,7 @@ class SourceDestinationGroup(AutoNameLowerStrEnum):
OTHER_WORK = auto()
WORK_OTHER = auto()
OTHER_OTHER = auto()
VISIT_OTHER = auto()

UNKNOWN = auto()

Expand Down Expand Up @@ -309,6 +315,7 @@ class Person:
present_on_day: bool
reporting_day: int
n_trips: int
home_district: str = None


@dataclass
Expand All @@ -327,11 +334,14 @@ class Trip:
purpose: Purpose
sd_group: SourceDestinationGroup
valid: bool
dep_district: str = None
arr_district: str = None


@dataclass
class Activity:
""" Activity information (including leg) """
""" Activity information (including leg)
all leg information relates to the leg leading to the activity """
a_id: str
p_id: str
n: int
Expand All @@ -340,3 +350,7 @@ class Activity:
leg_dist: float
leg_duration: float
leg_mode: TripMode
leg_dep_district: str = None
leg_arr_district: str = None
leg_departure: int = 0
start_time: int = 0
2 changes: 1 addition & 1 deletion matsim/scenariogen/data/formats/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__all__ = ["srv", "mid"]
__all__ = ["srv", "mid", "eodmx"]
Loading