Skip to content

Commit

Permalink
gis: Remove more unique_ids
Browse files Browse the repository at this point in the history
  • Loading branch information
EwoutH committed Sep 25, 2024
1 parent a3f20ae commit 4737d8d
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 9 deletions.
2 changes: 0 additions & 2 deletions gis/agents_and_networks/src/model/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import uuid
from functools import partial
from pathlib import Path

Expand Down Expand Up @@ -137,7 +136,6 @@ def _create_commuters(self) -> None:
random_home = self.space.get_random_home()
random_work = self.space.get_random_work()
commuter = Commuter(
unique_id=uuid.uuid4().int,
model=self,
geometry=Point(random_home.centroid),
crs=self.space.crs,
Expand Down
2 changes: 1 addition & 1 deletion gis/geo_schelling/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def __init__(self, density=0.6, minority_pc=0.2, export_data=False):
data_path = script_directory / "data/nuts_rg_60M_2013_lvl_2.geojson"
agents_gdf = gpd.read_file(data_path)
agents_gdf = get_largest_connected_components(agents_gdf)
agents = ac.from_GeoDataFrame(agents_gdf, unique_id="index")
agents = ac.from_GeoDataFrame(agents_gdf)
self.space.add_agents(agents)

# Set up agents
Expand Down
2 changes: 1 addition & 1 deletion gis/geo_schelling_points/geo_schelling_points/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, red_percentage=0.5, similarity_threshold=0.5):
# Set up the grid with patches for every NUTS region
ac = mg.AgentCreator(RegionAgent, model=self)
data_path = script_directory / "../data/nuts_rg_60M_2013_lvl_2.geojson"
regions = ac.from_file(data_path, unique_id="NUTS_ID")
regions = ac.from_file(data_path)
self.space.add_regions(regions)

for region in regions:
Expand Down
4 changes: 1 addition & 3 deletions gis/geo_sir/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ def __init__(
# Set up the Neighbourhood patches for every region in file
# (add to schedule later)
ac = mg.AgentCreator(NeighbourhoodAgent, model=self)
neighbourhood_agents = ac.from_file(
self.geojson_regions, unique_id=self.unique_id
)
neighbourhood_agents = ac.from_file(self.geojson_regions)
self.space.add_agents(neighbourhood_agents)

# Generate PersonAgent population
Expand Down
2 changes: 0 additions & 2 deletions gis/rainfall/rainfall/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import uuid
from pathlib import Path

import mesa
Expand Down Expand Up @@ -98,7 +97,6 @@ def step(self):
random_x = np.random.randint(0, self.space.raster_layer.width)
random_y = np.random.randint(0, self.space.raster_layer.height)
raindrop = RaindropAgent(
unique_id=uuid.uuid4().int,
model=self,
pos=(random_x, random_y),
)
Expand Down

0 comments on commit 4737d8d

Please sign in to comment.