4747 requiring all edits to be in the same document. Typically this will get used by having
4848 a master alt file, and then an additional one containing scenario specific changes.
4949 0.3.1 Added call to remove_extra_links tool. 2016-08-24
50+ 0.3.2 Added a check to not run the cleaning algorithm if the cleaned scenario number is zero.
5051
5152'''
5253
7374##########################################################################################################
7475class FullNetworkSetGenerator (_m .Tool ()):
7576
76- version = '0.3.1 '
77+ version = '0.3.2 '
7778 tool_run_msg = ""
7879 number_of_tasks = 1 # For progress reporting, enter the integer number of tasks here
7980
@@ -948,9 +949,10 @@ def _Execute(self):
948949 print ("Prorated transit speeds" )
949950
950951 for scenarios in scenarioSet :
951- removeExtraLinks (scenarios [0 ], self .TransferModesString , True , scenarios [1 ], scenarios [3 ])
952-
953- removeExtraNodes (scenarios [1 ], self .NodeFilterAttributeId , self .StopFilterAttributeId , self .ConnectorFilterAttributeId , self .AttributeAggregatorString )
952+ # If the scenario number is 0 then don't clean the network.
953+ if scenarios [1 ] > 0 :
954+ removeExtraLinks (scenarios [0 ], self .TransferModesString , True , scenarios [1 ], scenarios [3 ])
955+ removeExtraNodes (scenarios [1 ], self .NodeFilterAttributeId , self .StopFilterAttributeId , self .ConnectorFilterAttributeId , self .AttributeAggregatorString )
954956 print ("Cleaned networks" )
955957
956958 self .BaseScenario .publish_network (network )
@@ -976,7 +978,7 @@ def _DeleteOldScenarios(self, scenarios):
976978 for items in scenarios :
977979 if bank .scenario (items [0 ]):
978980 bank .delete_scenario (items [0 ])
979- if bank .scenario (items [1 ]):
981+ if items [ 1 ] > 0 and bank .scenario (items [1 ]):
980982 bank .delete_scenario (items [1 ])
981983
982984 def _ParseCustomScenarioSet (self ):
@@ -988,19 +990,19 @@ def _ParseCustomScenarioSet(self):
988990 parts = component .split (':' )
989991 if len (parts ) not in [6 ,7 ]:
990992 if len (parts ) == 8 :
991- checkPath = parts [6 ] + ":" + parts [7 ]
992- if os .path .exists (os .path .dirname (checkPath )):
993- parts [6 ] = checkPath
994- del parts [7 ]
995- else :
996- msg = "Please verify that your scenario set is separated correctly and/or that the .nup file has a valid path"
997- msg += ". [%s]" % component
998- raise SyntaxError (msg )
993+ checkPath = parts [6 ] + ":" + parts [7 ]
994+ if os .path .exists (os .path .dirname (checkPath )):
995+ parts [6 ] = checkPath
996+ del parts [7 ]
997+ else :
998+ msg = "Please verify that your scenario set is separated correctly and/or that the .nup file has a valid path"
999+ msg += ". [%s]" % component
1000+ raise SyntaxError (msg )
9991001 else :
1000- msg = "Error parsing scenario set: Separate components with colons \
1001- Uncleaned scenario number:Cleaned scenario number:Uncleaned scenario description:Cleaned scenario description:Scenario start:Scenario End:.nup file"
1002- msg += ". [%s]" % component
1003- raise SyntaxError (msg )
1002+ msg = "Error parsing scenario set: Separate components with colons \
1003+ Uncleaned scenario number:Cleaned scenario number:Uncleaned scenario description:Cleaned scenario description:Scenario start:Scenario End:.nup file"
1004+ msg += ". [%s]" % component
1005+ raise SyntaxError (msg )
10041006 partsList = [int (parts [0 ]), int (parts [1 ]), parts [2 ], parts [3 ], int (parts [4 ]), int (parts [5 ])]
10051007 if len (parts ) == 7 :
10061008 if parts [6 ].lower () == 'none' :
0 commit comments