Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix data paths and model passing in GIS examples #177

Merged
merged 11 commits into from
Aug 26, 2024

Conversation

EwoutH
Copy link
Member

@EwoutH EwoutH commented Aug 25, 2024

This PR addresses several of the remaining issues across the GIS examples:

  • Corrects data file paths in the population, rainfall, and urban growth models to use relative paths from the script directory.
  • Fixes the urban growth model by passing the model object to City and UrbanCell classes, as required by mesa-geo 0.8.0.
  • Updates the population model to pass the model object when creating agents, ensuring they can access Model variables and properties.
  • Corrects the use of /vsigzip/ paths for GDAL compatibility.

The /vsigzip/ situation is super weird. It isn't part of the file path, but it's a "marker" a GDAL convention. See projectmesa/mesa-geo#235 for more details.

Part of #172.

EwoutH added 5 commits August 25, 2024 21:07
City uses a RasterLayer, which needs a model as input as of mesa-geo 0.8.0.
UrbanCell uses a Cell, which needs a model as input as of mesa-geo 0.8.0.
Agents always need a Model object to be able to use Model variables and properties, including the AgentSet.
@EwoutH EwoutH requested a review from wang-boyu August 25, 2024 20:37
@EwoutH EwoutH requested a review from rht August 25, 2024 20:37
@EwoutH
Copy link
Member Author

EwoutH commented Aug 25, 2024

This PR brings the score for the 7 gis examples from 2 fully passed and 1 passed with warnings, to 3 fully passed and 3 passes with warnings.

@EwoutH EwoutH mentioned this pull request Aug 25, 2024
31 tasks
EwoutH added 2 commits August 25, 2024 23:00
Fix the model by passing the model object correctly
Fix the model by passing the model object correctly
@EwoutH
Copy link
Member Author

EwoutH commented Aug 25, 2024

Another two models pass. 5 pass, one warning, one fail.

Those will be separate PRs. This one is ready for review.

EwoutH added 2 commits August 26, 2024 11:36
pathlib.Path improves over the older os.path methods by providing a more modern, object-oriented interface for working with filesystem paths.

As can be seen, it reduces the code complexity a bit.
@EwoutH
Copy link
Member Author

EwoutH commented Aug 26, 2024

I noticed one other issue:

But that isn't fixable from the examples alone, so something for @wang-boyu or @tpike3 to look into.

I updated the tracking issues #172. Going to merge this PR.

@EwoutH EwoutH merged commit 269ff1a into projectmesa:main Aug 26, 2024
1 of 3 checks passed
EwoutH added a commit to EwoutH/mesa-examples that referenced this pull request Sep 3, 2024
This commit addresses several of the remaining issues across the GIS examples:

- Corrects data file paths in the population, rainfall, and urban growth models to use relative paths from the script directory.
- Fixes the urban growth model by passing the model object to City and UrbanCell classes, as required by mesa-geo 0.8.0.
- Updates the population model to pass the model object when creating agents, ensuring they can access Model variables and properties.
- Corrects the use of `/vsigzip/` paths for GDAL compatibility.

The `/vsigzip/` situation is super weird. It isn't part of the file path, but it's a "marker" a GDAL convention. See the PR message, mesa-geo#235 and https://gdal.org/user/virtual_file_systems.html#vsigzip-gzipped-file for more details.
EwoutH added a commit to EwoutH/mesa-examples that referenced this pull request Sep 20, 2024
This commit addresses several of the remaining issues across the GIS examples:

- Corrects data file paths in the population, rainfall, and urban growth models to use relative paths from the script directory.
- Fixes the urban growth model by passing the model object to City and UrbanCell classes, as required by mesa-geo 0.8.0.
- Updates the population model to pass the model object when creating agents, ensuring they can access Model variables and properties.
- Corrects the use of `/vsigzip/` paths for GDAL compatibility.

The `/vsigzip/` situation is super weird. It isn't part of the file path, but it's a "marker" a GDAL convention. See the PR message, mesa-geo#235 and https://gdal.org/user/virtual_file_systems.html#vsigzip-gzipped-file for more details.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants