Create initial logic for seperating maz table from taz table#215
Create initial logic for seperating maz table from taz table#215lachlan-git wants to merge 26 commits intodevelopfrom
Conversation
|
The threshold for whether the trip from CTRAMP becomes a maz trip or a taz trip is in the "highway" section of the model config # threshold (miles) where a drive trip is short enough to be moved to a taz
maz_drive_distance_threshold = 0.5This will require a new file in tm2py-utils. |
| it = it_full[it_full.time_period == time_period] | ||
| jt = jt_full[jt_full.time_period == time_period] | ||
| it_both_taz_and_maz = it_full[it_full.time_period == time_period] | ||
| jt_both_taz_and_maz = jt_full[jt_full.time_period == time_period] |
There was a problem hiding this comment.
I understand that whoever first authored this function did not do this - can we please be more intentional with object naming? E.g., if it is a dataframe, put a _df suffix in the name please.
There was a problem hiding this comment.
will keep naming convention for the code I write, I wont refactor the entire function
Good catch. It does seem problematic. If 15-taxi and 16-tnc are removed from the list above, do they not get created in the output trip tables? I think that is fine if the intention here is to reclassify taxi and tnc and assign them as part of the DA, HOV2, HOV3 trip tables. |
This comment was marked as duplicate.
This comment was marked as duplicate.
Code seemed stale, has some updates to be reviewed |
i-am-sijia
left a comment
There was a problem hiding this comment.
I know this is still a WIP. Just leaving some incremental comments before you finalize the code changes. We should also run the model through to confirm code changes do not break things.
| interchange_nodes_file: str = Field() | ||
| apply_msa_demand: bool = True | ||
| reliability: bool = Field(default=True) | ||
| maz_drive_distance_threshold: float = Field() |
There was a problem hiding this comment.
If we are adding a new paramemter to the model config, we should create a corresponding PR with actual config changes to tm2py-utils.
| taxi_split: Dict[str, float] | ||
| single_tnc_split: Dict[str, float] | ||
| shared_tnc_split: Dict[str, float] | ||
| ctramp_mode_names: Dict[float, str] |
There was a problem hiding this comment.
Same here, make sure this is in a PR to tm2py-utls. We should also run the model after deleting this from the model config to make sure it does not break anything.
| def _copy_maz_flow(self): | ||
| """Copy maz_flow from MAZ demand assignment to ul1 for background traffic.""" | ||
| self._network_calculator("ul1", "0") | ||
| self._network_calculator("ul1", "@maz_flow") |
There was a problem hiding this comment.
Have this been tested to confirm there is background flow in the network?
There was a problem hiding this comment.
Note: On review of the code, this is likely because the code filters out MAZ trips longer than 10 miles.
https://github.com/BayAreaMetro/tm2py/blob/d454ee0b7aae02b8d454431ccc11077c2f8c2a5a/tm2py/components/network/highway/highway_maz.py#L52C1-L52C20
There was a problem hiding this comment.
2 changes improved this, but did not completely mitigate this discrepency.
- by using a TAZ matrix (instead of ct-ramps internal distance) implemented in fe20e44. There were no trips over the 10 miles this lead. to incomplete demand assignment
- self trips (starting and ending at the same maz node) were also filtered out of the maz_demands, as these do not appear on the network.
| ) | ||
| continue | ||
| self._process_demand(time, i, maz_ids) | ||
| self._process_demand(time, i, maz_ids, model_id_to_maz) |
There was a problem hiding this comment.
I'm not a fan of calling it model_id_to_maz. Let's be as explicit as we can and avoid ambiguity. There are three types of IDs: MAZ labels (county-based), MAZ sequentials (starts from 1 and used by CT-RAMP), MAZ EMME node IDs. Maybe we should call them labels, sequentials, and emmes. Please coordinate with @yueshuaing to confirm the final namings and mappings.
There was a problem hiding this comment.
Unfortunately, reviewing the tests this week, it appears there may still be some crosswalk issues,
| it = it_full[it_full.time_period == time_period] | ||
| jt = jt_full[jt_full.time_period == time_period] | ||
| individual_trip_both_taz_and_maz_df = it_full[it_full.time_period == time_period] | ||
| joint_trip_both_taz_and_maz = jt_full[jt_full.time_period == time_period] |
There was a problem hiding this comment.
joint_trip_both_taz_and_maz_df?
|
@i-am-sijia The person trips get converted into vehicle trips at this point in the code |
Thank you. CTRAMP used 0.5 to convert SR2 person trips into vehicles, and 0.3 for SR3. [1][2]. I do not like how this is hardcoded in tm2py. Shall we expose it to the config? |
|
Oh wow! You've been doing lots of work here which is great. Could you write me up a couple paragraphs to describe what you did and what you're still working on? |
|
This PR started off to address the two existing issues of MAZ assignment. One being that the MAZ demand matrices in OMX format were all zero from CT-RAMP (#210), and the other being that the background traffic, which is a result of MAZ assignment, was not being set correctly (#212). To address #210, instead of reading the MAZ OMX matrices generated by CT-RAMP, we decided to directly create MAZ vehicle trip tables from the CT-RAMP person trip list, because:
To address #212, we just need to swap two lines of code in As Lachlan dug into the code to implement these changes, he found a few other things that were not originally part of the two issues, but worth fixing while he was at it. For example, the Instead of making a bunch of small PRs for each of these additional fixes that all touch the same files, we decided to bundle them all into this one PR. The following check list summarizes all the completed and open items in this PR:
@lachlan-git will also create a PR to the |
|
Update (11/17). Uncompleted items:
MAZ auto trip demand for MAZ assignment for Early Morning. Note the difference in
|
maz demands




What existing problem does the pull request solve and why should we include it?
PR created to address issue #210 and #212
Separating / re-implementing MAZ travel demands and integrating with assignment in Emme without storing an intermediate OMX file.
@lachlan-git, please update the PR description to include brief descriptions for each work item, use checkbox to track progress. For example:
What is the testing plan?
Rerun household and highway_maz_assign, the following conditions should be met:
Code formatting
will be PEP8 Compliant on all changed files
Applicable Issues
Please do not create a Pull Request without creating an issue first.
Put
closes #XXXXin your comment to auto-close the issue that your PR fixes.