Skip to content

Update GIS example models for Cell API changes #326

@EwoutH

Description

@EwoutH

Problem

Three GIS example models in Mesa-examples are failing due to breaking changes introduced in mesa/mesa-geo#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: <CustomCell>.__init__() got an unexpected keyword argument 'rowcol'

Root cause

The updated Cell.__init__() in mesa-geo now accepts keyword-only arguments rowcol and xy:

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions