dissmodel 0.6.2__tar.gz → 0.6.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. {dissmodel-0.6.2/dissmodel.egg-info → dissmodel-0.6.4}/PKG-INFO +4 -5
  2. {dissmodel-0.6.2 → dissmodel-0.6.4}/README.md +3 -4
  3. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/executor/cli.py +45 -11
  4. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/raster/backend.py +2 -2
  5. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/io/raster.py +1 -1
  6. {dissmodel-0.6.2 → dissmodel-0.6.4/dissmodel.egg-info}/PKG-INFO +4 -5
  7. {dissmodel-0.6.2 → dissmodel-0.6.4}/pyproject.toml +2 -2
  8. {dissmodel-0.6.2 → dissmodel-0.6.4}/LICENSE +0 -0
  9. {dissmodel-0.6.2 → dissmodel-0.6.4}/MANIFEST.in +0 -0
  10. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/__init__.py +0 -0
  11. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/core/__init__.py +0 -0
  12. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/core/environment.py +0 -0
  13. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/core/model.py +0 -0
  14. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/executor/__init__.py +0 -0
  15. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/executor/config.py +0 -0
  16. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/executor/model_executor.py +0 -0
  17. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/executor/registry.py +0 -0
  18. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/executor/runner.py +0 -0
  19. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/executor/schemas.py +0 -0
  20. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/executor/testing.py +0 -0
  21. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/executor/utils.py +0 -0
  22. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/__init__.py +0 -0
  23. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/raster/__init__.py +0 -0
  24. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/raster/band_spec.py +0 -0
  25. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/raster/cellular_automaton.py +0 -0
  26. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/raster/raster_grid.py +0 -0
  27. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/raster/raster_model.py +0 -0
  28. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/raster/sync_model.py +0 -0
  29. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/vector/__init__.py +0 -0
  30. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/vector/cellular_automaton.py +0 -0
  31. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/vector/fill.py +0 -0
  32. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/vector/neighborhood.py +0 -0
  33. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/vector/spatial_model.py +0 -0
  34. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/vector/sync_model.py +0 -0
  35. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/geo/vector/vector_grid.py +0 -0
  36. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/io/__init__.py +0 -0
  37. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/io/_dispatch.py +0 -0
  38. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/io/_storage.py +0 -0
  39. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/io/_utils.py +0 -0
  40. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/io/_xarray.py +0 -0
  41. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/io/convert.py +0 -0
  42. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/io/vector.py +0 -0
  43. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/visualization/__init__.py +0 -0
  44. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/visualization/_utils.py +0 -0
  45. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/visualization/chart.py +0 -0
  46. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/visualization/map.py +0 -0
  47. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/visualization/raster_map.py +0 -0
  48. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel/visualization/widgets.py +0 -0
  49. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel.egg-info/SOURCES.txt +0 -0
  50. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel.egg-info/dependency_links.txt +0 -0
  51. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel.egg-info/requires.txt +0 -0
  52. {dissmodel-0.6.2 → dissmodel-0.6.4}/dissmodel.egg-info/top_level.txt +0 -0
  53. {dissmodel-0.6.2 → dissmodel-0.6.4}/setup.cfg +0 -0
  54. {dissmodel-0.6.2 → dissmodel-0.6.4}/setup.py +0 -0
  55. {dissmodel-0.6.2 → dissmodel-0.6.4}/tests/test_public_api.py +0 -0
  56. {dissmodel-0.6.2 → dissmodel-0.6.4}/tests/test_scheduler.py +0 -0
  57. {dissmodel-0.6.2 → dissmodel-0.6.4}/tests/test_viz_fallback.py +0 -0
  58. {dissmodel-0.6.2 → dissmodel-0.6.4}/tests/test_widgets.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissmodel
3
- Version: 0.6.2
3
+ Version: 0.6.4
4
4
  Summary: Discrete Spatial Modeling framework for raster and vector simulations
5
5
  Author: Sérgio Costa, Nerval Santos Junior
6
6
  Maintainer: Sérgio Costa
@@ -66,8 +66,8 @@ Dynamic: license-file
66
66
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
67
67
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
68
68
  [![PyPI version](https://badge.fury.io/py/dissmodel.svg)](https://pypi.org/project/dissmodel/)
69
- [![Coverage](https://img.shields.io/badge/coverage-55%25-orange.svg)](https://github.com/DisSModel/dissmodel/actions)
70
- [![LambdaGeo](https://img.shields.io/badge/LambdaGeo-Research-green.svg)](https://github.com/DisSModel)
69
+ [![Coverage](https://img.shields.io/badge/coverage-79%25-orange.svg)](https://github.com/DisSModel/dissmodel/actions)
70
+ [![DisSModel](https://img.shields.io/badge/LambdaGeo-Research-green.svg)](https://github.com/DisSModel)
71
71
  [![JOSS Status](https://joss.theoj.org/papers/46522bc30d2dbec6b509d2dc487170ec/status.svg)](https://joss.theoj.org/papers/46522bc30d2dbec6b509d2dc487170ec)
72
72
 
73
73
  > *"Science should not need to be rewritten to go into production."*
@@ -283,8 +283,7 @@ DisSModel is a core framework. To maintain a clean and specialized environment,
283
283
  | [`dissmodel-ca`](https://github.com/DisSModel/dissmodel-ca) | Classic Cellular Automata (Game of Life, Forest Fire, Growth) | `pip install "git+https://github.com/DisSModel/dissmodel-ca.git"` |
284
284
  | [`dissmodel-sysdyn`](https://github.com/DisSModel/dissmodel-sysdyn) | System Dynamics (SIR, Predator-Prey, Lorenz) | `pip install "git+https://github.com/DisSModel/dissmodel-sysdyn.git"` |
285
285
  | [`brmangue-dissmodel`](https://github.com/DisSModel/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"` |
286
- | [`disslucc-continuous`](https://github.com/DisSModel/disslucc-continuous) | Land Use and Cover Change models, continuous allocation (CLUE-inspired) | `pip install "git+https://github.com/DisSModel/disslucc-continuous.git"` |
287
- | [`disslucc-discrete`](https://github.com/DisSModel/disslucc-discrete) | Land Use and Cover Change models, discrete allocation (CLUE-inspired) | `pip install "git+https://github.com/DisSModel/disslucc-discrete.git"` |
286
+ | [`disslucc`](https://github.com/LambdaGeo/disslucc) | Land Use and Cover Change models, continuous and discrete allocation (CLUE-inspired), raster-only | `pip install "git+https://github.com/LambdaGeo/disslucc.git"` |
288
287
 
289
288
  ### 🛠 Implementation Templates
290
289
 
@@ -4,8 +4,8 @@
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
6
6
  [![PyPI version](https://badge.fury.io/py/dissmodel.svg)](https://pypi.org/project/dissmodel/)
7
- [![Coverage](https://img.shields.io/badge/coverage-55%25-orange.svg)](https://github.com/DisSModel/dissmodel/actions)
8
- [![LambdaGeo](https://img.shields.io/badge/LambdaGeo-Research-green.svg)](https://github.com/DisSModel)
7
+ [![Coverage](https://img.shields.io/badge/coverage-79%25-orange.svg)](https://github.com/DisSModel/dissmodel/actions)
8
+ [![DisSModel](https://img.shields.io/badge/LambdaGeo-Research-green.svg)](https://github.com/DisSModel)
9
9
  [![JOSS Status](https://joss.theoj.org/papers/46522bc30d2dbec6b509d2dc487170ec/status.svg)](https://joss.theoj.org/papers/46522bc30d2dbec6b509d2dc487170ec)
10
10
 
11
11
  > *"Science should not need to be rewritten to go into production."*
@@ -221,8 +221,7 @@ DisSModel is a core framework. To maintain a clean and specialized environment,
221
221
  | [`dissmodel-ca`](https://github.com/DisSModel/dissmodel-ca) | Classic Cellular Automata (Game of Life, Forest Fire, Growth) | `pip install "git+https://github.com/DisSModel/dissmodel-ca.git"` |
222
222
  | [`dissmodel-sysdyn`](https://github.com/DisSModel/dissmodel-sysdyn) | System Dynamics (SIR, Predator-Prey, Lorenz) | `pip install "git+https://github.com/DisSModel/dissmodel-sysdyn.git"` |
223
223
  | [`brmangue-dissmodel`](https://github.com/DisSModel/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"` |
224
- | [`disslucc-continuous`](https://github.com/DisSModel/disslucc-continuous) | Land Use and Cover Change models, continuous allocation (CLUE-inspired) | `pip install "git+https://github.com/DisSModel/disslucc-continuous.git"` |
225
- | [`disslucc-discrete`](https://github.com/DisSModel/disslucc-discrete) | Land Use and Cover Change models, discrete allocation (CLUE-inspired) | `pip install "git+https://github.com/DisSModel/disslucc-discrete.git"` |
224
+ | [`disslucc`](https://github.com/LambdaGeo/disslucc) | Land Use and Cover Change models, continuous and discrete allocation (CLUE-inspired), raster-only | `pip install "git+https://github.com/LambdaGeo/disslucc.git"` |
226
225
 
227
226
  ### 🛠 Implementation Templates
228
227
 
@@ -12,6 +12,16 @@ else:
12
12
 
13
13
  # ── Parameter helpers ─────────────────────────────────────────────────────────
14
14
 
15
+ # [model] keys that are registration metadata for dissmodel-configs, not
16
+ # simulation input -- never merged into record.parameters. Matches the
17
+ # convention documented in docs/api/executor/cli.md ("class", "package")
18
+ # and used by dissmodel-configs entries in the wild (executor_module, name,
19
+ # description, the dissmodel version constraint).
20
+ _SPEC_METADATA_KEYS = frozenset({
21
+ "executor_module", "name", "class", "description", "package", "dissmodel",
22
+ })
23
+
24
+
15
25
  def _parse_params(param_list: list[str] | None) -> dict:
16
26
  """Parse KEY=VALUE strings into a typed dict."""
17
27
  params: dict[str, int | float | bool | str] = {}
@@ -32,11 +42,41 @@ def _parse_params(param_list: list[str] | None) -> dict:
32
42
 
33
43
 
34
44
  def _load_toml(path: str) -> tuple[dict, dict]:
35
- """Load parameters and full spec from a TOML file."""
45
+ """
46
+ Load parameters and full spec from a TOML file.
47
+
48
+ `params` merges two layers of the [model] table, in increasing
49
+ precedence: (1) every key that isn't registration metadata
50
+ (_SPEC_METADATA_KEYS) or [model.parameters] itself -- e.g.
51
+ land_use_types, [[model.potential]], [model.static] -- the same
52
+ values the platform stores in ExperimentRecord.resolved_spec and
53
+ merges into ExperimentRecord.parameters before calling run() (see
54
+ ModelExecutor.run()'s docstring: "Receives record with
55
+ resolved_spec and parameters already merged"); then (2)
56
+ [model.parameters] itself, which wins on overlap. Before this,
57
+ local --toml runs skipped layer (1) entirely, so a model.toml
58
+ following the dissmodel-configs registration convention (spec
59
+ fields at the [model] level, only truly run-specific values under
60
+ [model.parameters] -- see any models/*.toml in dissmodel-configs)
61
+ silently produced an incomplete record.parameters and any executor
62
+ reading those keys from record.parameters would fail validate()
63
+ even though the values were right there in the file. --param CLI
64
+ overrides are applied by the caller on top of this, unchanged.
65
+ """
36
66
  with open(path, "rb") as f:
37
67
  config = tomllib.load(f)
38
- model = config.get("model", {})
39
- params = model.get("parameters", {})
68
+ model = config.get("model", {})
69
+
70
+ # land_use_types may be declared as a dict-table
71
+ # ([model.land_use_types] types = [...]) instead of a plain list --
72
+ # normalize before merging into params, same as _build_record did
73
+ # for `spec` alone before this function grew that merge.
74
+ land_use_types = model.get("land_use_types")
75
+ if isinstance(land_use_types, dict):
76
+ model["land_use_types"] = land_use_types.get("types", [])
77
+
78
+ spec_extra = {k: v for k, v in model.items() if k not in _SPEC_METADATA_KEYS and k != "parameters"}
79
+ params = {**spec_extra, **model.get("parameters", {})}
40
80
  return params, model
41
81
 
42
82
 
@@ -64,14 +104,8 @@ def _build_record(args):
64
104
  from dissmodel.executor.schemas import DataSource, ExperimentRecord
65
105
 
66
106
  toml_path = getattr(args, "toml", None)
67
- params, spec = _load_local_params(toml_path)
68
- params = {**params, **_parse_params(args.param)} # CLI overrides TOML
69
-
70
- # land_use_types lives under spec, not parameters
71
- if "land_use_types" in spec:
72
- lu = spec["land_use_types"]
73
- if isinstance(lu, dict):
74
- spec["land_use_types"] = lu.get("types", [])
107
+ params, spec = _load_local_params(toml_path) # params already carries the merged [model] spec (see _load_toml)
108
+ params = {**params, **_parse_params(args.param)} # CLI overrides TOML+spec
75
109
 
76
110
  record = ExperimentRecord(
77
111
  model_name = "local",
@@ -607,8 +607,8 @@ class RasterBackend:
607
607
  -------
608
608
  np.ndarray int
609
609
  """
610
- result = np.zeros(self.shape, dtype=int)
611
- m = mask.astype(np.int8)
610
+ result: np.ndarray = np.zeros(self.shape, dtype=int)
611
+ m: np.ndarray = mask.astype(np.int8)
612
612
  for dr, dc in neighborhood:
613
613
  result += self.shift2d(m, dr, dc)
614
614
  return result
@@ -203,7 +203,7 @@ def _write_geotiff(
203
203
  rows, cols = backend.shape
204
204
 
205
205
  if band_spec:
206
- arrays = []
206
+ arrays: list[np.ndarray] = []
207
207
  for name, dtype, nodata in band_spec:
208
208
  arr = backend.arrays.get(
209
209
  name,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dissmodel
3
- Version: 0.6.2
3
+ Version: 0.6.4
4
4
  Summary: Discrete Spatial Modeling framework for raster and vector simulations
5
5
  Author: Sérgio Costa, Nerval Santos Junior
6
6
  Maintainer: Sérgio Costa
@@ -66,8 +66,8 @@ Dynamic: license-file
66
66
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
67
67
  [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/)
68
68
  [![PyPI version](https://badge.fury.io/py/dissmodel.svg)](https://pypi.org/project/dissmodel/)
69
- [![Coverage](https://img.shields.io/badge/coverage-55%25-orange.svg)](https://github.com/DisSModel/dissmodel/actions)
70
- [![LambdaGeo](https://img.shields.io/badge/LambdaGeo-Research-green.svg)](https://github.com/DisSModel)
69
+ [![Coverage](https://img.shields.io/badge/coverage-79%25-orange.svg)](https://github.com/DisSModel/dissmodel/actions)
70
+ [![DisSModel](https://img.shields.io/badge/LambdaGeo-Research-green.svg)](https://github.com/DisSModel)
71
71
  [![JOSS Status](https://joss.theoj.org/papers/46522bc30d2dbec6b509d2dc487170ec/status.svg)](https://joss.theoj.org/papers/46522bc30d2dbec6b509d2dc487170ec)
72
72
 
73
73
  > *"Science should not need to be rewritten to go into production."*
@@ -283,8 +283,7 @@ DisSModel is a core framework. To maintain a clean and specialized environment,
283
283
  | [`dissmodel-ca`](https://github.com/DisSModel/dissmodel-ca) | Classic Cellular Automata (Game of Life, Forest Fire, Growth) | `pip install "git+https://github.com/DisSModel/dissmodel-ca.git"` |
284
284
  | [`dissmodel-sysdyn`](https://github.com/DisSModel/dissmodel-sysdyn) | System Dynamics (SIR, Predator-Prey, Lorenz) | `pip install "git+https://github.com/DisSModel/dissmodel-sysdyn.git"` |
285
285
  | [`brmangue-dissmodel`](https://github.com/DisSModel/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"` |
286
- | [`disslucc-continuous`](https://github.com/DisSModel/disslucc-continuous) | Land Use and Cover Change models, continuous allocation (CLUE-inspired) | `pip install "git+https://github.com/DisSModel/disslucc-continuous.git"` |
287
- | [`disslucc-discrete`](https://github.com/DisSModel/disslucc-discrete) | Land Use and Cover Change models, discrete allocation (CLUE-inspired) | `pip install "git+https://github.com/DisSModel/disslucc-discrete.git"` |
286
+ | [`disslucc`](https://github.com/LambdaGeo/disslucc) | Land Use and Cover Change models, continuous and discrete allocation (CLUE-inspired), raster-only | `pip install "git+https://github.com/LambdaGeo/disslucc.git"` |
288
287
 
289
288
  ### 🛠 Implementation Templates
290
289
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dissmodel"
7
- version = "0.6.2"
7
+ version = "0.6.4"
8
8
  description = "Discrete Spatial Modeling framework for raster and vector simulations"
9
9
  readme = { file = "README.md", content-type = "text/markdown" }
10
10
  requires-python = ">=3.10"
@@ -121,7 +121,7 @@ exclude = ["docs", "site", "build"]
121
121
  pythonpath = ["."]
122
122
 
123
123
  [tool.mypy]
124
- python_version = "3.10"
124
+ python_version = "3.12"
125
125
  ignore_missing_imports = true
126
126
  exclude = ["tests/", "docs/", "examples/"]
127
127
 
File without changes
File without changes
File without changes
File without changes