Skip to main content

Discrete Spatial Modeling framework for raster and vector simulations

Project description

DisSModel ๐ŸŒ

License: MIT Python 3.10+ PyPI version 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
โ€” coastal-dynamics Coastal domain models built on dissmodel
TerraLib geopandas / rasterio Geographic data handling

๐ŸŒŸ Key Features

  • Dual substrate โ€” same model logic runs on vector (GeoDataFrame) and raster (RasterBackend/NumPy).
  • Discrete Event Simulation โ€” built on Salabim; time advances to the next relevant event, not millisecond by millisecond.
  • 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.
  • Cloud-ready โ€” deploy via Docker, FastAPI, and Redis without changing model code.

๐Ÿ— Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Science Layer  (Model / Salabim)                        โ”‚
โ”‚  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, 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, SpatialModel

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

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

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, record: ExperimentRecord):
        from dissmodel.core import Environment
        gdf = self.load(record)
        env = Environment(end_time=record.parameters.get("end_time", 50))
        ForestFireModel(gdf=gdf, **record.parameters)
        env.run()
        return gdf

    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.4.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"
}

Reproduce any past experiment exactly:

curl -X POST http://localhost:8000/experiments/abc123/reproduce \
  -H "X-API-Key: chave-sergio"

๐Ÿ“Š 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 LambdaGeo ecosystem.

๐Ÿ”ฌ Specialized Model Libraries

Repository Description Install
DisSModel-CA Classic Cellular Automata (Game of Life, Forest Fire, Growth) pip install dissmodel-ca
DisSModel-SysDyn System Dynamics (SIR, Predator-Prey, Lorenz) pip install dissmodel-sysdyn
coastal-dynamics Coastal flooding and mangrove succession models pip install coastal-dynamics
DisSLUCC Land Use and Cover Change models (CLUE-inspired) pip install disslucc

๐Ÿ›  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.

๐Ÿ“š 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 Discussions
  • ๐Ÿ“ Improve docs โ†’ Fork, edit, and submit a PR

๐ŸŽ“ Citation

@software{dissmodel2026,
  author = {Costa, Sรฉrgio and Santos Junior, Nerval},
  title = {DisSModel: A Discrete Spatial Modeling Framework for Python},
  year = {2026},
  publisher = {LambdaGeo, Federal University of Maranhรฃo (UFMA)},
  url = {https://github.com/DisSModel/dissmodel},
  version = {0.4.0}
}

โš–๏ธ License

MIT ยฉ LambdaGeo โ€” 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.4.1.tar.gz (59.4 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.4.1-py3-none-any.whl (71.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for dissmodel-0.4.1.tar.gz
Algorithm Hash digest
SHA256 e455db3a4d312ba5295c0b4a22f224400429bec85178d57e6d758ac3ac3f758f
MD5 939fcaefcf404d602008a4b34344dd5e
BLAKE2b-256 90a1e84368712bd0aa847e0b0de7669b5a18021560c78b5c3ab50fc28103a455

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dissmodel-0.4.1-py3-none-any.whl
  • Upload date:
  • Size: 71.7 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.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a9da3c42911f4fb9d4e447455795656b252e54f7ce38887018a339a3c9af8e1b
MD5 caccc86a308f946e518c07d6334f173c
BLAKE2b-256 277b484827ba3486196030819178173609c55834ae6652d82651b8bccfd3613f

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