pam.operations.cropping
Methods for cropping plans outside core areas.
create_leg(previous_act, next_act, travel_mode='car')
#
Create a leg between two activities.
Source code in src/pam/operations/cropping.py
crop_leg(leg, boundary)
#
Crop a leg to a boundary.
Source code in src/pam/operations/cropping.py
crop_plan(plan, kept_activities)
#
Crop a plan in a way that exludes any external-external movement (and the corresponding activities). If no plan components are left in scope, the plan will have a single "external" activity.
Source code in src/pam/operations/cropping.py
empty_day()
#
filter_component(component, kept_activities)
#
Check if an activity/leg should be kept.
Source code in src/pam/operations/cropping.py
get_kept_activities(plan, boundary)
#
Get a list of the activities to keep after cropping external-external movements.
Source code in src/pam/operations/cropping.py
get_leg_path(leg)
#
infill_legs(plan)
#
Infill missing legs. If there is no leg between two activities, a new one is created linking them.
Source code in src/pam/operations/cropping.py
leg_intersects(leg, boundary)
#
link_plan(plan)
#
Link a plan: each activity/leg gets a pointer to the previous/next plan component.
Source code in src/pam/operations/cropping.py
link_population(population)
#
Link the plan components of every agent in the population.
list_get(list_to_access, idx)
#
rename_external(plan, boundary)
#
Rename all external-area activities as "external".
simplify_external_plans(plan, boundary, snap_to_boundary=False, rename_external_activities=False)
#
Simplify any activities happening outside the boundary area.
Method
- Identify which legs touch the boundary area
- Keep the relevant legs/activities and drop the remaining components
- Infill: create any new legs between external activities as necessary
- Ensure plan consistency: start/end times, sequences, etc
- optional Rename activities to "external"
- optional Crop the leg geometries to start/stop at the core area boundaries
PARAMETER | DESCRIPTION |
---|---|
plan
|
a PAM plan
TYPE:
|
boundary
|
the geometry of the core modelled area
TYPE:
|
snap_to_boundary
|
whether to crop legs to stop at the core area boundary. Defaults to False.
TYPE:
|
rename_external_activities
|
whether to rename all external-area activities as "external" Defaults to False.
TYPE:
|
Source code in src/pam/operations/cropping.py
simplify_population(population, boundary, snap_to_boundary=False, rename_external_activities=False)
#
Simplify external plans across a population.