Skip to main content

Discrete Spatial Modeling framework for raster and vector simulations

Project description

DisSModel ๐ŸŒ

License: MIT Python 3.10+ PyPI version Coverage LambdaGeo JOSS Status

"Science should not need to be rewritten to go into production."
(A ciรชncia nรฃo deve ser reescrita para ir para a produรงรฃo.)


๐Ÿ“– Research Trajectory

DisSModel did not emerge from a blank slate. It is the current expression of a research agenda that began in 2001 with an undergraduate thesis on geographic data interoperability using XML and open standards โ€” a time when the central question was already forming:

How can geospatial models be built so that others can understand, reuse, and trust them?

Period Project Contribution to the Agenda
2001โ€“2002 Terra Translator (XML, ontologies) Foundation: geographic data needs semantics and open standards
2005 TerraHS (Haskell + GIS) Vision: scientific models as verifiable, executable artifacts
2007โ€“2010 TerraME / LuccME (INPE) Maturity: spatially explicit dynamic models as scientific objects
2015โ€“2024 DbCells, Linked Data, QGIS plugins Infrastructure: reproducibility demands rich metadata and federated access
2024โ€“2026 DisSModel (Python, FAIR, cloud-native) Synthesis: same code runs from Jupyter to distributed cluster

Three principles unite this trajectory:

  1. ๐Ÿ”“ Openness as method โ€” open source and open data as conditions for scientific validation.
  2. ๐Ÿงฉ Interoperability as architecture โ€” systems designed to communicate, avoiding silos.
  3. โ™ป๏ธ Reproducibility as requirement โ€” publishing conditions for re-execution, not just results.

DisSModel is the synthesis: a Python-native, FAIR-aligned, cloud-ready simulation framework where the same scientific code runs unchanged from a Jupyter notebook to a distributed production cluster.


๐ŸŽฏ About

DisSModel is a modular Python framework for spatially explicit dynamic simulation models. Developed by the LambdaGeo group at the Federal University of Maranhรฃo (UFMA), it provides the simulation layer that connects domain models (LUCC, coastal dynamics) to a reproducible execution environment.

INPE / TerraME Ecosystem LambdaGeo Ecosystem Role
TerraME dissmodel Generic framework for dynamic spatial modeling
LUCCME DisSLUCC LUCC domain models built on dissmodel
โ€” brmangue-dissmodel Coastal domain models (BR-MANGUE) built on dissmodel
TerraLib geopandas / rasterio Geographic data handling

๐ŸŒŸ Key Features

  • Dual substrate โ€” same model logic runs on vector (GeoDataFrame) and raster (RasterBackend/NumPy).
  • Lightweight scheduler โ€” pure-Python time-stepped engine; models auto-register at instantiation and receive clock ticks via setup / pre_execute / execute / post_execute lifecycle hooks.
  • Executor pattern โ€” strict separation between science (models) and infrastructure (I/O, CLI, reproducible execution).
  • Experiment tracking โ€” every run generates an immutable ExperimentRecord with SHA-256 checksums, TOML snapshot, and full provenance.
  • Storage-agnostic I/O โ€” dissmodel.io handles local paths and s3:// URIs transparently.
  • Platform-ready contract โ€” the ModelExecutor interface is designed so the same model code can later run on the DisSModel Platform, a separate project under development.

๐Ÿ— Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Science Layer  (Model)                                  โ”‚
โ”‚  FloodModel, AllocationClueLike, MangroveModel, ...      โ”‚
โ”‚  โ†’ only knows math, geometry and time                    โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Infrastructure Layer  (ModelExecutor)                   โ”‚
โ”‚  CoastalRasterExecutor, LUCCVectorExecutor, ...          โ”‚
โ”‚  โ†’ only knows URIs, local/S3, column_map, parameters     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚  Core modules                                            โ”‚
โ”‚  dissmodel.core      โ€” Environment, Model, SpatialModel  โ”‚
โ”‚  dissmodel.geo       โ€” RasterBackend, neighborhoods      โ”‚
โ”‚  dissmodel.executor  โ€” ModelExecutor ABC, ExperimentRecordโ”‚
โ”‚  dissmodel.io        โ€” load_dataset / save_dataset       โ”‚
โ”‚  dissmodel.visualization โ€” Map, RasterMap, Chart         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿš€ Quick Start

1. Install

pip install dissmodel

# Or latest development version
pip install "git+https://github.com/DisSModel/dissmodel.git@main"

2. Write a Model

# forest_fire_model.py
from dissmodel.core import Environment
from dissmodel.geo import SpatialModel, vector_grid

# 10x10 grid where every cell starts as forest
gdf = vector_grid(dimension=(10, 10), resolution=1.0, attrs={"state": "forest"})

class ForestFireModel(SpatialModel):
    def setup(self, prob_spread=0.3):
        self.prob_spread = prob_spread

    def execute(self):
        # Called every step โ€” only math here, no I/O
        burning = self.gdf["state"] == "burning"
        # ... apply spread logic ...

env = Environment(end_time=50)
ForestFireModel(gdf=gdf, prob_spread=0.4)
env.run()

3. Wrap an Executor (for CLI + Provenance)

# my_executor.py
from dissmodel.executor import ExperimentRecord, ModelExecutor
from dissmodel.executor.cli import run_cli
from dissmodel.io import load_dataset, save_dataset

class ForestFireExecutor(ModelExecutor):
    name = "forest_fire"

    def load(self, record: ExperimentRecord):
        gdf, checksum = load_dataset(record.source.uri)
        record.source.checksum = checksum
        return gdf

    def run(self, data, record: ExperimentRecord):
        from dissmodel.core import Environment
        env = Environment(end_time=record.parameters.get("end_time", 50))
        ForestFireModel(gdf=data, **record.parameters)
        env.run()
        return data

    def save(self, result, record: ExperimentRecord) -> ExperimentRecord:
        uri = record.output_path or "output.gpkg"
        checksum = save_dataset(result, uri)
        record.output_path = uri
        record.output_sha256 = checksum
        record.status = "completed"
        return record

if __name__ == "__main__":
    run_cli(ForestFireExecutor)

4. Run via CLI

# Execute a simulation
python my_executor.py run \
  --input data/forest.gpkg \
  --output data/result.gpkg \
  --param end_time=50 \
  --toml model.toml

# Validate data contract without running
python my_executor.py validate --input data/forest.gpkg

# Show resolved parameters
python my_executor.py show --toml model.toml

๐Ÿ“ฆ ExperimentRecord: Reproducibility by Design

Every run produces an immutable provenance record:

{
  "experiment_id": "abc123",
  "model_commit": "a3f9c12",
  "code_version": "0.5.0",
  "resolved_spec": { "...TOML snapshot..." },
  "source": { "uri": "s3://...", "checksum": "e3b0c44..." },
  "artifacts": { "output": "sha256...", "profiling": "sha256..." },
  "metrics": { "time_run_sec": 2.15, "time_total_sec": 2.34 },
  "status": "completed"
}

The record.json written next to every output contains everything needed to re-run the experiment: the input URI and its SHA-256 checksum, the resolved parameters (TOML + CLI overrides), per-phase timings, and the output checksum.


๐Ÿ“Š Performance Telemetry

Every run via the executor lifecycle generates a profiling_{id}.md alongside the output:

Phase Time (s) % Total Memory Peak (MB) I/O Ops
Validate 0.000 0.0% 142 0
Load 0.306 14.7% 387 12 (read)
Run 1.025 49.4% 521 0
Save 0.746 35.9% 498 8 (write)
Total 2.077 100% 521 20

๐Ÿงฉ Ecosystem: Models & Examples

DisSModel is a core framework. To maintain a clean and specialized environment, all simulation models and implementation examples are hosted in separate repositories within the DisSModel ecosystem.

๐Ÿ”ฌ Specialized Model Libraries

Repository Description Install
dissmodel-ca Classic Cellular Automata (Game of Life, Forest Fire, Growth) pip install "git+https://github.com/DisSModel/dissmodel-ca.git"
dissmodel-sysdyn System Dynamics (SIR, Predator-Prey, Lorenz) pip install "git+https://github.com/DisSModel/dissmodel-sysdyn.git"
brmangue-dissmodel BR-MANGUE coastal flooding and mangrove succession model (raster + vector, validated against TerraME) pip install "git+https://github.com/DisSModel/brmangue-dissmodel.git"
disslucc-continuous Land Use and Cover Change models, continuous allocation (CLUE-inspired) pip install "git+https://github.com/DisSModel/disslucc-continuous.git"
disslucc-discrete Land Use and Cover Change models, discrete allocation (CLUE-inspired) pip install "git+https://github.com/DisSModel/disslucc-discrete.git"

๐Ÿ›  Implementation Templates

Each repository demonstrates how to:

  1. Define a Model: Using SpatialModel and Environment.
  2. Wrap an Executor: Using ModelExecutor for I/O and provenance.
  3. Deploy: Running via CLI or API.

๐Ÿ”ญ Roadmap: DisSModel Platform

The DisSModel Platform is a distributed execution environment (FastAPI, Redis, Docker, MinIO/S3) currently under development as a separate project. It consumes the same ModelExecutor contract documented above โ€” executors run through its job queue without any change to their scientific code, including remote experiment reproduction from a stored ExperimentRecord.

The platform is not part of this package. Everything described in this README works locally with pip install dissmodel alone.


๐Ÿ“š Documentation


๐Ÿค Contributing

Contributions are welcome! Please read our Contributing Guidelines and Code of Conduct before submitting a pull request.

  • ๐Ÿ› Report bugs โ†’ GitHub Issues
  • ๐Ÿ’ก Request features โ†’ GitHub Issues
  • ๐Ÿ“ Improve docs โ†’ Fork, edit, and submit a PR

๐ŸŽ“ Citation

@software{dissmodel2026,
  author = {Costa, Sรฉrgio Souza and Santos Junior, Nerval de Jesus and Sousa, Felipe Martins and Alves, Josรฉ Magno Pinheiro and Bezerra, Denilson da Silva},
  title = {DisSModel: A Python Framework for Spatially Explicit Dynamic Modeling},
  year = {2026},
  publisher = {LambdaGeo, Federal University of Maranhรฃo (UFMA)},
  url = {https://github.com/DisSModel/dissmodel},
  version = {0.6.0}
}

โš–๏ธ License

MIT ยฉ DisSModel โ€” UFMA
See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dissmodel-0.6.2.tar.gz (69.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dissmodel-0.6.2-py3-none-any.whl (77.5 kB view details)

Uploaded Python 3

File details

Details for the file dissmodel-0.6.2.tar.gz.

File metadata

  • Download URL: dissmodel-0.6.2.tar.gz
  • Upload date:
  • Size: 69.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dissmodel-0.6.2.tar.gz
Algorithm Hash digest
SHA256 9132770d11c52e50ca48106eba3b9db5a77259bafb749661c599b110acfdbd26
MD5 e994e18a0cb57978ac59b74c1e3e4f70
BLAKE2b-256 a1b32de36ba0d113957d78172baa81383e774a4ae781bb06c89431ab7ed38454

See more details on using hashes here.

File details

Details for the file dissmodel-0.6.2-py3-none-any.whl.

File metadata

  • Download URL: dissmodel-0.6.2-py3-none-any.whl
  • Upload date:
  • Size: 77.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for dissmodel-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 dca9594cbdb5ce97793cacf86c4955ccac8aed77cd736646a55ea7490d61f061
MD5 f7b03fe1b725e72be2ddb567c9efc5ec
BLAKE2b-256 da5500a84a7af4091cda51b716eb850e9c7b006447a3181a66b8eff4f8142c94

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page