Skip to content

Commit

Permalink
fixes deprecated field from AequilibraE (#57)
Browse files Browse the repository at this point in the history
* Limits NumPy version because of deprecated use of NumPy by PopulationSim
* fixes deprecated field from AequilibraE
* Updates AequilibraE API

---------

Co-authored-by: pveigadecamargo <pveigadecamargo@anl.gov>
  • Loading branch information
pedrocamargo and pveigadecamargo authored May 29, 2023
1 parent 68e77c1 commit 1572e44
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
numpy<1.24
aequilibrae
shapely>=2.0
geopandas
Expand Down
5 changes: 5 additions & 0 deletions tradesman/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ def import_population(self, overwrite=False):
*overwrite* (:obj:`bool`): Deletes pre-existing population_source_import. Defaults to False
"""

fields = self._project.zoning.fields
if "population" not in fields.all_fields():
fields.add("population", "Total population", "INTEGER")
fields.save()

import_population(
self._project, self._project.about.country_name, self.__population_source, overwrite=overwrite
)
Expand Down
4 changes: 2 additions & 2 deletions tradesman/model_creation/delete_links_and_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def delete_links_and_nodes(model_place, project: Project):

del_links = list(links[~links.link_id.isin(inner_gdf.link_id)][["link_id"]].itertuples(index=False, name=None))

remove_triggers(project.conn, project.logger)
remove_triggers(project.conn, project.logger, "network")

project.conn.executemany("DELETE FROM links WHERE link_id=?", del_links)
project.conn.commit()
Expand All @@ -111,4 +111,4 @@ def delete_links_and_nodes(model_place, project: Project):
project.conn.execute(nodes_query)
project.conn.commit()

add_triggers(project.conn, project.logger)
add_triggers(project.conn, project.logger, "network")

0 comments on commit 1572e44

Please sign in to comment.