Add new GIS example: Solar Adoption model#381
Open
ShreyasN707 wants to merge 7 commits intomesa:mainfrom
Open
Conversation
for more information, see https://pre-commit.ci
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new Solar Adoption example to the gis/ directory to demonstrate how raster data and vector agents can be used together with mesa-geo.
The model simulates how households decide to adopt solar panels based on two geographic factors:
Economic viability (raster data): Each household is linked to a solar radiation value from a
RasterLayer. Locationswith higher radiation make adoption more likely.Social influence (vector neighbors): Households are influenced by nearby households. Agents use
GeoSpace.get_neighbors_within_distance()to calculate local adoption and model peer effects.What this example demonstrates
Using
GeoSpaceto manage spatial relationships between agentsLoading environmental data with
RasterLayer.from_file()Creating agents from GeoJSON using
AgentCreatorVisualizing the simulation with a Solara dashboard using
make_geospace_component, where households change color as they adopt solarImplementation notes
A
data/generate_data.pyscript generates synthetichouseholds.geojsonandsolar_radiation.tiffiles so the example can run without external datasets.The code follows the standard Mesa example structure and uses the built-in random generator.
The example runs successfully with the existing
test_gis_examples.pytest suite.