From 4737d8dd79ae996ff35ff115683749787cabb413 Mon Sep 17 00:00:00 2001 From: Ewout ter Hoeven Date: Wed, 25 Sep 2024 13:33:38 +0200 Subject: [PATCH] gis: Remove more unique_ids --- gis/agents_and_networks/src/model/model.py | 2 -- gis/geo_schelling/model.py | 2 +- gis/geo_schelling_points/geo_schelling_points/model.py | 2 +- gis/geo_sir/model.py | 4 +--- gis/rainfall/rainfall/model.py | 2 -- 5 files changed, 3 insertions(+), 9 deletions(-) diff --git a/gis/agents_and_networks/src/model/model.py b/gis/agents_and_networks/src/model/model.py index 4fad3fe0..4aab4219 100644 --- a/gis/agents_and_networks/src/model/model.py +++ b/gis/agents_and_networks/src/model/model.py @@ -1,4 +1,3 @@ -import uuid from functools import partial from pathlib import Path @@ -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, diff --git a/gis/geo_schelling/model.py b/gis/geo_schelling/model.py index ea23e765..159e7317 100644 --- a/gis/geo_schelling/model.py +++ b/gis/geo_schelling/model.py @@ -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 diff --git a/gis/geo_schelling_points/geo_schelling_points/model.py b/gis/geo_schelling_points/geo_schelling_points/model.py index 826a6e8a..6716b17b 100644 --- a/gis/geo_schelling_points/geo_schelling_points/model.py +++ b/gis/geo_schelling_points/geo_schelling_points/model.py @@ -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: diff --git a/gis/geo_sir/model.py b/gis/geo_sir/model.py index 093cd236..8e8f0996 100644 --- a/gis/geo_sir/model.py +++ b/gis/geo_sir/model.py @@ -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 diff --git a/gis/rainfall/rainfall/model.py b/gis/rainfall/rainfall/model.py index cb825c5f..21931c49 100644 --- a/gis/rainfall/rainfall/model.py +++ b/gis/rainfall/rainfall/model.py @@ -1,4 +1,3 @@ -import uuid from pathlib import Path import mesa @@ -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), )