Update GIS example models for Cell API changes
- Dominant language
- Python
- Stars
- 252
- Forks
- 279
- Avg merge
- 8d 9h
- Merged PRs (30d)
- 2
Description
### Problem
Three GIS example models in Mesa-examples are failing due to breaking changes introduced in https://github.com/mesa/mesa-geo/pull/299, which added new keyword arguments (`rowcol`, `xy`) to the `Cell.__init__()` method.
**Failing models:**
- `gis/urban_growth` - `UrbanCell`
- `gis/rainfall` - `LakeCell`
- `gis/population` - `UgandaCell`
**Error:**
```
TypeError: .__init__() got an unexpected keyword argument 'rowcol'
```
### Root cause
The updated `Cell.__init__()` in mesa-geo now accepts keyword-only arguments `rowcol` and `xy`:
```python
def __init__(self, model, pos=None, indices=None, *, rowcol=None, xy=None):
```
Custom `Cell` subclasses in the example models don't accept these arguments, causing instantiation to fail when `RasterLayer._initialize_cells()` tries to create cells.
### Additional considerations
While fixing the signatures, we might update the models to use the new `cell.rowcol` property instead of the deprecated `cell.indices` where applicable.
Contributor guide
Research direction
Start with the GIS example entry points in gis/urban_growth, gis/rainfall, and gis/population, locating UrbanCell, LakeCell, and UgandaCell. Read how RasterLayer._initialize_cells() constructs these cells and compare the subclasses with the updated Cell.__init__() signature. Done means all three models instantiate successfully and applicable uses of deprecated cell.indices have been reviewed for cell.rowcol.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100