-
Notifications
You must be signed in to change notification settings - Fork 3
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
[Refactor] Rename/define Scenario variables so they make sense when building tiered scenarios #277
Comments
I think the functionality for tags is already there. Network Wrangler does something similar to git when adding new cards: first they are added and then they are applied (~ committed)
Calling |
Are you thinking similar to the "plans" we had in the og network wrangler 1.0? |
Ahh got it. So I think I would like to do something like this # Apply base roadway fixes first
scenario.add_project_cards_from_tags(folder=card_path, tags=['Managed Lanes', 'toll review', 'Exclude Trucks'])
scenario.apply_all_projects()
# [do checks or whatever, possibly save it out]
scenario.remove_all_projects()
scenario.add_project_cards_from_tags(folder=card_path, tags=['Major Transit links'])
scenario.apply_all_projects()
# [do checks or whatever, possibly save it out]
scenario.remove_all_projects()
# This is what will be most clear for planners, see net_spec_blueprint.py link above
PLAN_PROJECTS = collections.OrderedDict([
(2020: [
'proj1',
'proj2',
'proj3']),
(2025: [
'proj4',
'proj5'])
])
for year in PLAN_PROJECTS.keys():
scenario.add_project_cards_from_list(PLAN_PROJECTS[year])
scenario.apply_all_projects()
scenario.write(output_path[year])
scenario.remove_all_projects() |
|
I think this should work - what is it not happy about? for year in PLAN_PROJECTS.keys():
scenario.add_project_cards_from_list(PLAN_PROJECTS[year])
scenario.apply_all_projects()
scenario.write(output_path[year]) |
Ahh... I was under the impression that rerunning |
AH - looking at it more I think you are right. I guess we could do either:
for year in PLAN_PROJECTS.keys():
scenario.add_project_cards_from_list(PLAN_PROJECTS[year])
scenario.apply_all_projects()
scenario.write(output_path[year])
scenario.remove_all_projects()
Either would be straightforward to implement... |
I think it would be intuitive to have
(In the meantime, I am invoking |
@lmz @DavidOry @i-am-sijia @kulshresthaa Thinking about this some more, I'd like to propose changing some attribute definitions 😨 😬 so we are:
Current Definitions
Issues
Proposed Definitions
Corresponding function definitions would be:
Considerations:
|
I like it. Agree that |
Changes how scenarios works per description in #277 and updates relevant documentation about API changes. Also: - various efficiencies and consistency fixes
Changes how scenarios works per description in #277 and updates relevant documentation about API changes. Also: - various efficiencies and consistency fixes - Update example notebooks for tiny API changes - Fix default project_card_list to be [] not None - Require minimum variables in base_scenario: applied_projects and conflicts - Varia fixes from Sijia! (thx!) - Scenario tests now use fixtures + are consistently formatted - added specific Exception types for better error catching in testing - black Remaining: - project card handling Co-authored-by: Sijia Wang and Lisa Zorn
Implemented. |
User Story
As a travel modeler who is building networks, I would like to apply projects for a given set of tags without creating a new scenario instance.
Maybe this is already doable using
scenario.add_project_cards_from_tags()
-- what do these add methods do? Is there a list of cards that are waiting to be applied?Maybe I'm looking for another layer of cards, like a card set, rather than just the single list in scenario.project_cards?
Right now, our notebook creates new scenario instances over and over just to apply cards for certain tags, which seems unncessary. (Also, this notebook has a huge memory footprint which likely is related...)
Priority
Level of Effort
Resolution Ideas
Project
MTC
Who should be involved?
Implementer: I am happy do this with some guidance
Commenters:
Users:
Reviewers:
Risk
Will this potentially break anything?
Tests
What are relevant tests or what tests need to be created in order to determine that this issue is complete?
The text was updated successfully, but these errors were encountered: