pam.write.matsim
Writer(path, household_key='hid', comment=None, keep_non_selected=False, coordinate_reference_system=None)
#
Context Manager for writing to xml.
Designed to handle the boilerplate xml.
Example
Source code in src/pam/write/matsim.py
comment = comment
instance-attribute
#
compression = DEFAULT_GZIP_COMPRESSION if is_gzip(path) else 0
instance-attribute
#
coordinate_reference_system = coordinate_reference_system
instance-attribute
#
household_key = household_key
instance-attribute
#
keep_non_selected = keep_non_selected
instance-attribute
#
path = path
instance-attribute
#
population_writer = None
instance-attribute
#
writer = None
instance-attribute
#
xmlfile = None
instance-attribute
#
add_hh(household)
#
add_attribute(attributes, k, v)
#
Source code in src/pam/write/matsim.py
create_person_element(pid, person, keep_non_selected=False)
#
Source code in src/pam/write/matsim.py
object_attributes_dtd()
#
population_v6_dtd()
#
write_matsim(population, plans_path, attributes_path=None, vehs_path=None, evs_path=None, version=None, comment=None, household_key='hid', keep_non_selected=False, coordinate_reference_system=None)
#
Write a core population to matsim population v6 xml format. Note that this requires activity locs to be set (shapely.Point).
PARAMETER | DESCRIPTION |
---|---|
population
|
population to be writen to disk
TYPE:
|
plans_path
|
output path (.xml or .xml.gz) |
attributes_path
|
legacy parameter, does not have an effect. Defaults to None. |
vehs_path
|
path to output vehicle file. Defaults to None. |
evs_path
|
path to output ev file. Defaults to None. |
version
|
legacy parameter, does not have an effect. Defaults to None. |
comment
|
default None, optionally add a comment string to the xml outputs. Defaults to None. |
household_key
|
optionally add household id to person attributes. Defaults to "hid". |
keep_non_selected
|
Defaults to False.
TYPE:
|
coordinate_reference_system
|
optionally add CRS attribute to xml outputs. Defaults to None. |
RAISES | DESCRIPTION |
---|---|
UserWarning
|
If population includes vehicles, |
Source code in src/pam/write/matsim.py
write_matsim_population_v6(population, path, household_key='hid', comment=None, keep_non_selected=False, coordinate_reference_system=None)
#
Write matsim population v6 xml (persons plans and attributes combined).
PARAMETER | DESCRIPTION |
---|---|
population
|
population to be writen to disk
TYPE:
|
path
|
output path (.xml or .xml.gz)
TYPE:
|
household_key
|
Defaults to "hid". |
comment
|
optionally add a comment string to the xml outputs. Defaults to None. |
keep_non_selected
|
Defaults to False.
TYPE:
|
coordinate_reference_system
|
Defaults to None.
TYPE:
|