Import VDF data

23 views
Skip to first unread message

Chris Burns

unread,
Nov 14, 2024, 6:34:38 PM11/14/24
to AequilibraE
Hi all

I am trying to import some link-specific VDF attributes (rather than global).

I bring in my dataframe from a csv, iterate through and using the links.new() method, am able to read in the main attributes such as [direction, link_type, name, capacity_ab, capacity_ba], but when I try to read in my own such as alpha, I get this error:

AttributeError: "alpha" is not a valid attribute for a link
I'm guessing they should be stored somewhere else in the database, but could anyone provide me with a simple example of reading in other parameters that I want to use in my assignment, such as those in the VDF like alpha, or free_flow_speed:
assig.set_vdf_parameters({'capacity': 'capacity','alpha': 'alpha','free_flow_speed': 'free_flow_speed'})
I'd really appreciate the help, as none of the examples online seem to handle this task.
Thanks in advance!Chris

Chris Burns

unread,
Nov 14, 2024, 7:23:45 PM11/14/24
to AequilibraE
I think I figured it out - I was missing a refresh_fields() step after adding the field. 

Thanks all!

Pedro Camargo

unread,
Nov 14, 2024, 7:27:37 PM11/14/24
to AequilibraE
Hi Chris,


I am glad you figured it out.  You can also do these changes on the fly (without commiting to the DB) if you'd like.

The way to do that is to add them to the network dataframe (a Pandas DataFrame) inside the Graph object. For example


graph.network = graph.network.assign(alpha=0.18, beta=03.9)
graph.network.loc[graph.link_id<1000, "alpha"] = 0.21 # Or any other change you'd like to make
graph.prepare_graph(graph.centroids)


Cheers,
Pedro


---- On Fri, 15 Nov 2024 09:57:51 +1000 Chris Burns <ginge...@gmail.com> wrote ---

--
You received this message because you are subscribed to the Google Groups "AequilibraE" group.
To unsubscribe from this group and stop receiving emails from it, send an email to aequilibrae...@googlegroups.com.


Chris Burns

unread,
Nov 14, 2024, 7:59:25 PM11/14/24
to AequilibraE
Good to know! Many thanks for the pointers
Reply all
Reply to author
Forward
0 new messages