disslucc 0.5.0__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.
- disslucc-0.5.0/LICENSE +21 -0
- disslucc-0.5.0/PKG-INFO +182 -0
- disslucc-0.5.0/README.md +159 -0
- disslucc-0.5.0/pyproject.toml +59 -0
- disslucc-0.5.0/setup.cfg +4 -0
- disslucc-0.5.0/src/disslucc/__init__.py +54 -0
- disslucc-0.5.0/src/disslucc/components/__init__.py +0 -0
- disslucc-0.5.0/src/disslucc/components/allocation/__init__.py +5 -0
- disslucc-0.5.0/src/disslucc/components/allocation/clue.py +293 -0
- disslucc-0.5.0/src/disslucc/components/allocation/clue_s.py +145 -0
- disslucc-0.5.0/src/disslucc/components/allocation/saturation.py +417 -0
- disslucc-0.5.0/src/disslucc/components/demand/__init__.py +18 -0
- disslucc-0.5.0/src/disslucc/components/demand/dates.py +202 -0
- disslucc-0.5.0/src/disslucc/components/demand/inline.py +22 -0
- disslucc-0.5.0/src/disslucc/components/demand/precomputed.py +94 -0
- disslucc-0.5.0/src/disslucc/components/potential/__init__.py +5 -0
- disslucc-0.5.0/src/disslucc/components/potential/linear.py +114 -0
- disslucc-0.5.0/src/disslucc/components/potential/logistic.py +85 -0
- disslucc-0.5.0/src/disslucc/components/potential/spatial_lag.py +203 -0
- disslucc-0.5.0/src/disslucc/executors/__init__.py +42 -0
- disslucc-0.5.0/src/disslucc/executors/base.py +151 -0
- disslucc-0.5.0/src/disslucc/executors/continuous.py +125 -0
- disslucc-0.5.0/src/disslucc/executors/discrete.py +98 -0
- disslucc-0.5.0/src/disslucc/executors/saturation.py +186 -0
- disslucc-0.5.0/src/disslucc/protocols.py +39 -0
- disslucc-0.5.0/src/disslucc/schemas.py +106 -0
- disslucc-0.5.0/src/disslucc/validation/__init__.py +9 -0
- disslucc-0.5.0/src/disslucc/validation/naive_baseline.py +88 -0
- disslucc-0.5.0/src/disslucc/validation/pontius.py +132 -0
- disslucc-0.5.0/src/disslucc.egg-info/PKG-INFO +182 -0
- disslucc-0.5.0/src/disslucc.egg-info/SOURCES.txt +35 -0
- disslucc-0.5.0/src/disslucc.egg-info/dependency_links.txt +1 -0
- disslucc-0.5.0/src/disslucc.egg-info/requires.txt +10 -0
- disslucc-0.5.0/src/disslucc.egg-info/top_level.txt +1 -0
- disslucc-0.5.0/tests/test_demand.py +44 -0
- disslucc-0.5.0/tests/test_demand_dates.py +203 -0
- disslucc-0.5.0/tests/test_executor_toml.py +121 -0
disslucc-0.5.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LambdaGeo research group, UFMA
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
disslucc-0.5.0/PKG-INFO
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: disslucc
|
|
3
|
+
Version: 0.5.0
|
|
4
|
+
Summary: Land Use and Cover Change (LUCC) modeling — continuous and discrete allocation — on top of dissmodel.
|
|
5
|
+
Author: Sérgio Souza Costa
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/DisSModel/disslucc
|
|
8
|
+
Project-URL: Repository, https://github.com/DisSModel/disslucc
|
|
9
|
+
Project-URL: Documentation, https://dissmodel.github.io/disslucc/
|
|
10
|
+
Project-URL: Issues, https://github.com/DisSModel/disslucc/issues
|
|
11
|
+
Requires-Python: >=3.11
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Requires-Dist: dissmodel<0.7.0,>=0.6.4
|
|
15
|
+
Requires-Dist: scipy
|
|
16
|
+
Provides-Extra: examples
|
|
17
|
+
Requires-Dist: matplotlib; extra == "examples"
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
20
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
21
|
+
Requires-Dist: ruff<0.17,>=0.16; extra == "dev"
|
|
22
|
+
Dynamic: license-file
|
|
23
|
+
|
|
24
|
+
# disslucc
|
|
25
|
+
|
|
26
|
+
[](https://github.com/DisSModel/disslucc/actions/workflows/tests.yml)
|
|
27
|
+
|
|
28
|
+
Land use and land cover change (LUCC) modeling, raster-only,
|
|
29
|
+
script-first, on top of [`dissmodel`](https://github.com/DisSModel/dissmodel).
|
|
30
|
+
LuccME's components -- demand, potential, allocation -- in Python:
|
|
31
|
+
continuous (CLUE-like), discrete (CLUE-S-like), spatial-lag potential,
|
|
32
|
+
saturation, and demand computed from land-use layers. It is an alternative
|
|
33
|
+
that you can run next to TerraME/LuccME, not a replacement for them.
|
|
34
|
+
|
|
35
|
+
**Agreement with TerraME/LuccME** (iteration counts, per-year error, timings,
|
|
36
|
+
10 of the 21 LuccME labs so far) is checked in
|
|
37
|
+
[LambdaGeo/disslucc-benchmark](https://github.com/LambdaGeo/disslucc-benchmark),
|
|
38
|
+
which pins the release of disslucc it ran against. This repository is the
|
|
39
|
+
package and the examples to learn it with.
|
|
40
|
+
|
|
41
|
+
## Migration status: becoming the single successor repository
|
|
42
|
+
|
|
43
|
+
`disslucc` is migrating from two separately maintained repositories
|
|
44
|
+
(`disslucc-continuous`, `disslucc-discrete`) into **one single
|
|
45
|
+
repository**, mirroring how the original
|
|
46
|
+
[`terrame/luccme`](https://github.com/terrame/luccme) is itself one
|
|
47
|
+
repository with continuous and discrete components side by side,
|
|
48
|
+
instead of split by paradigm. Two reasons:
|
|
49
|
+
|
|
50
|
+
1. **Efficiency.** As more Demand/Potential/Allocation strategies are
|
|
51
|
+
developed, maintaining two parallel implementations (vector +
|
|
52
|
+
raster, continuous repo + discrete repo, each with its own
|
|
53
|
+
Demand/validation code duplicated) doesn't scale and gets confusing
|
|
54
|
+
fast. Consolidating into one raster-only package, with Demand and
|
|
55
|
+
Pontius & Millones validation shared across both paradigms, removes
|
|
56
|
+
that duplication.
|
|
57
|
+
2. **One clear reference.** A single repository is a much stronger
|
|
58
|
+
"LuccME in Python" story than pointing people at two packages that
|
|
59
|
+
together replicate it.
|
|
60
|
+
|
|
61
|
+
This repository is moving from `github.com/LambdaGeo/disslucc` to
|
|
62
|
+
`github.com/DisSModel/disslucc`, alongside `dissmodel`,
|
|
63
|
+
`disslucc-continuous`, and `disslucc-discrete`. The two source
|
|
64
|
+
repositories will be released, tagged, archived, and kept citable once
|
|
65
|
+
this migration completes — see
|
|
66
|
+
[`docs/decisions.md`](docs/decisions.md) for the full reasoning,
|
|
67
|
+
status, and what's still pending (this does not happen before
|
|
68
|
+
`dissmodel`'s JOSS review concludes, so existing citations aren't
|
|
69
|
+
disrupted mid-review).
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
pip install -e ".[examples]"
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
from dissmodel.core import Environment
|
|
77
|
+
from disslucc import DemandInline, PotentialLinearRegression, AllocationClueLike
|
|
78
|
+
from disslucc.schemas import RegressionSpec, AllocationSpec
|
|
79
|
+
|
|
80
|
+
demand = DemandInline(values=[...], land_use_types=["forest", "urban"])
|
|
81
|
+
potential = PotentialLinearRegression(backend=backend, demand=demand, ...)
|
|
82
|
+
allocation = AllocationClueLike(backend=backend, demand=demand, potential=potential, ...)
|
|
83
|
+
|
|
84
|
+
Environment(end_time=7).run()
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
No `ModelExecutor`, no TOML, no CLI — the script is the complete
|
|
88
|
+
experiment, reproducible with `git clone && pip install -e . && python3 script.py`.
|
|
89
|
+
When automatic provenance matters more than simplicity (production,
|
|
90
|
+
CI), `disslucc.executors` brings `ModelExecutor`/`ExperimentRecord`
|
|
91
|
+
back as a second entry point — same math, identical result, see
|
|
92
|
+
[`api.md`](docs/api.md#executors-dissluccexecutors). This is also
|
|
93
|
+
the entry point registered in
|
|
94
|
+
[`dissmodel-configs`](https://github.com/DisSModel/dissmodel-configs)
|
|
95
|
+
to run on `dissmodel-platform`, and it comes with a CLI, via
|
|
96
|
+
`dissmodel.executor.cli.run_cli`:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
python -m disslucc.executors.continuous run \
|
|
100
|
+
--toml examples/dissmodel-configs/lucc_continuous.toml \
|
|
101
|
+
--input data/input/csAC.zip \
|
|
102
|
+
--param demand_csv=data/input/examples_demand_lab1.csv \
|
|
103
|
+
--output outputs/result.tif # local path or s3://bucket/key (MinIO)
|
|
104
|
+
|
|
105
|
+
python -m disslucc.executors.discrete run \
|
|
106
|
+
--toml examples/dissmodel-configs/lucc_discrete.toml \
|
|
107
|
+
--input data/input/cs_moju.zip \
|
|
108
|
+
--param demand_csv=data/input/demand_moju.csv \
|
|
109
|
+
--output outputs/result.tif
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`--output` writes a GeoTIFF with one band per land-use class (+ `mask`),
|
|
113
|
+
georeferenced from the input's CRS/extent -- open it directly in QGIS,
|
|
114
|
+
locally or straight from MinIO.
|
|
115
|
+
|
|
116
|
+
Both commands above run end-to-end as written -- `pyproject.toml` pins
|
|
117
|
+
`dissmodel>=0.6.4`, which merges `[model]`-level spec into
|
|
118
|
+
`record.parameters` for local `--toml` runs (this used to require an
|
|
119
|
+
unreleased fix; see `docs/decisions.md` for that history if you're
|
|
120
|
+
curious).
|
|
121
|
+
|
|
122
|
+
`examples/dissmodel-configs/` has a TOML config per executor
|
|
123
|
+
([continuous](examples/dissmodel-configs/lucc_continuous.toml),
|
|
124
|
+
[discrete](examples/dissmodel-configs/lucc_discrete.toml)), each
|
|
125
|
+
encoding the same coefficients as its `examples/run_*_executor.py`
|
|
126
|
+
counterpart — see [`api.md`](docs/api.md#registering-with-dissmodel-configs-toml)
|
|
127
|
+
for the full explanation.
|
|
128
|
+
|
|
129
|
+
## Documentation
|
|
130
|
+
|
|
131
|
+
- **[quickstart.md](docs/quickstart.md)** — installing, the first model, ready-made examples
|
|
132
|
+
- **[api.md](docs/api.md)** — reference for every class and parameter
|
|
133
|
+
- **[architecture.md](docs/architecture.md)** — what's faithful to the
|
|
134
|
+
original repositories, what was simplified, what's new
|
|
135
|
+
- **[validation.md](docs/validation.md)** — where the comparison with
|
|
136
|
+
TerraME lives: [disslucc-benchmark](https://github.com/LambdaGeo/disslucc-benchmark)
|
|
137
|
+
- **[decisions.md](docs/decisions.md)** — full history of decisions and
|
|
138
|
+
tests throughout development
|
|
139
|
+
|
|
140
|
+
Wider ecosystem context: chapter 26 (*Land Use and Cover Change
|
|
141
|
+
Modeling*) of the *Geospatial Modeling with Python* book (LambdaGeo) --
|
|
142
|
+
still a draft, but where "DisSLUCC" as a family name is documented for
|
|
143
|
+
the first time.
|
|
144
|
+
|
|
145
|
+
## Development
|
|
146
|
+
|
|
147
|
+
```bash
|
|
148
|
+
pip install -e ".[dev]"
|
|
149
|
+
mypy src/disslucc
|
|
150
|
+
pytest tests/ -v
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
CI (`.github/workflows/tests.yml`) runs ruff, mypy and the tests on every push
|
|
154
|
+
and pull request. `tests/` covers the demand components and checks that each
|
|
155
|
+
example TOML, run through the CLI, produces the same output file as the
|
|
156
|
+
equivalent hand-built experiment. **Agreement with TerraME/LuccME is not tested
|
|
157
|
+
here**: it is the job of
|
|
158
|
+
[disslucc-benchmark](https://github.com/LambdaGeo/disslucc-benchmark), which pins
|
|
159
|
+
the disslucc release it ran against.
|
|
160
|
+
|
|
161
|
+
## Citing
|
|
162
|
+
|
|
163
|
+
Use the DOI of the release you used (Zenodo, badge above once published) and
|
|
164
|
+
`CITATION.cff`.
|
|
165
|
+
|
|
166
|
+
## Structure
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
disslucc/
|
|
170
|
+
├── src/disslucc/
|
|
171
|
+
│ ├── protocols.py, schemas.py
|
|
172
|
+
│ ├── components/ # same convention as the original repositories
|
|
173
|
+
│ │ ├── demand/ # shared continuous + discrete
|
|
174
|
+
│ │ ├── potential/ # linear.py (continuous) + logistic.py (discrete)
|
|
175
|
+
│ │ └── allocation/ # clue.py (continuous) + clue_s.py (discrete)
|
|
176
|
+
│ ├── validation/ # Pontius & Millones metrics, naive baseline (outside components/, see architecture.md)
|
|
177
|
+
│ └── executors/ # ModelExecutor -- automatic provenance, second entry point
|
|
178
|
+
├── examples/ # ready-made scripts: synthetic, real data, executor, TOML configs
|
|
179
|
+
├── data/input/ # vendored example inputs (csAC, cs_moju) and demand CSVs
|
|
180
|
+
├── tests/ # pytest suite: demand components, TOML == executor
|
|
181
|
+
└── docs/
|
|
182
|
+
```
|
disslucc-0.5.0/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# disslucc
|
|
2
|
+
|
|
3
|
+
[](https://github.com/DisSModel/disslucc/actions/workflows/tests.yml)
|
|
4
|
+
|
|
5
|
+
Land use and land cover change (LUCC) modeling, raster-only,
|
|
6
|
+
script-first, on top of [`dissmodel`](https://github.com/DisSModel/dissmodel).
|
|
7
|
+
LuccME's components -- demand, potential, allocation -- in Python:
|
|
8
|
+
continuous (CLUE-like), discrete (CLUE-S-like), spatial-lag potential,
|
|
9
|
+
saturation, and demand computed from land-use layers. It is an alternative
|
|
10
|
+
that you can run next to TerraME/LuccME, not a replacement for them.
|
|
11
|
+
|
|
12
|
+
**Agreement with TerraME/LuccME** (iteration counts, per-year error, timings,
|
|
13
|
+
10 of the 21 LuccME labs so far) is checked in
|
|
14
|
+
[LambdaGeo/disslucc-benchmark](https://github.com/LambdaGeo/disslucc-benchmark),
|
|
15
|
+
which pins the release of disslucc it ran against. This repository is the
|
|
16
|
+
package and the examples to learn it with.
|
|
17
|
+
|
|
18
|
+
## Migration status: becoming the single successor repository
|
|
19
|
+
|
|
20
|
+
`disslucc` is migrating from two separately maintained repositories
|
|
21
|
+
(`disslucc-continuous`, `disslucc-discrete`) into **one single
|
|
22
|
+
repository**, mirroring how the original
|
|
23
|
+
[`terrame/luccme`](https://github.com/terrame/luccme) is itself one
|
|
24
|
+
repository with continuous and discrete components side by side,
|
|
25
|
+
instead of split by paradigm. Two reasons:
|
|
26
|
+
|
|
27
|
+
1. **Efficiency.** As more Demand/Potential/Allocation strategies are
|
|
28
|
+
developed, maintaining two parallel implementations (vector +
|
|
29
|
+
raster, continuous repo + discrete repo, each with its own
|
|
30
|
+
Demand/validation code duplicated) doesn't scale and gets confusing
|
|
31
|
+
fast. Consolidating into one raster-only package, with Demand and
|
|
32
|
+
Pontius & Millones validation shared across both paradigms, removes
|
|
33
|
+
that duplication.
|
|
34
|
+
2. **One clear reference.** A single repository is a much stronger
|
|
35
|
+
"LuccME in Python" story than pointing people at two packages that
|
|
36
|
+
together replicate it.
|
|
37
|
+
|
|
38
|
+
This repository is moving from `github.com/LambdaGeo/disslucc` to
|
|
39
|
+
`github.com/DisSModel/disslucc`, alongside `dissmodel`,
|
|
40
|
+
`disslucc-continuous`, and `disslucc-discrete`. The two source
|
|
41
|
+
repositories will be released, tagged, archived, and kept citable once
|
|
42
|
+
this migration completes — see
|
|
43
|
+
[`docs/decisions.md`](docs/decisions.md) for the full reasoning,
|
|
44
|
+
status, and what's still pending (this does not happen before
|
|
45
|
+
`dissmodel`'s JOSS review concludes, so existing citations aren't
|
|
46
|
+
disrupted mid-review).
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install -e ".[examples]"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from dissmodel.core import Environment
|
|
54
|
+
from disslucc import DemandInline, PotentialLinearRegression, AllocationClueLike
|
|
55
|
+
from disslucc.schemas import RegressionSpec, AllocationSpec
|
|
56
|
+
|
|
57
|
+
demand = DemandInline(values=[...], land_use_types=["forest", "urban"])
|
|
58
|
+
potential = PotentialLinearRegression(backend=backend, demand=demand, ...)
|
|
59
|
+
allocation = AllocationClueLike(backend=backend, demand=demand, potential=potential, ...)
|
|
60
|
+
|
|
61
|
+
Environment(end_time=7).run()
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
No `ModelExecutor`, no TOML, no CLI — the script is the complete
|
|
65
|
+
experiment, reproducible with `git clone && pip install -e . && python3 script.py`.
|
|
66
|
+
When automatic provenance matters more than simplicity (production,
|
|
67
|
+
CI), `disslucc.executors` brings `ModelExecutor`/`ExperimentRecord`
|
|
68
|
+
back as a second entry point — same math, identical result, see
|
|
69
|
+
[`api.md`](docs/api.md#executors-dissluccexecutors). This is also
|
|
70
|
+
the entry point registered in
|
|
71
|
+
[`dissmodel-configs`](https://github.com/DisSModel/dissmodel-configs)
|
|
72
|
+
to run on `dissmodel-platform`, and it comes with a CLI, via
|
|
73
|
+
`dissmodel.executor.cli.run_cli`:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
python -m disslucc.executors.continuous run \
|
|
77
|
+
--toml examples/dissmodel-configs/lucc_continuous.toml \
|
|
78
|
+
--input data/input/csAC.zip \
|
|
79
|
+
--param demand_csv=data/input/examples_demand_lab1.csv \
|
|
80
|
+
--output outputs/result.tif # local path or s3://bucket/key (MinIO)
|
|
81
|
+
|
|
82
|
+
python -m disslucc.executors.discrete run \
|
|
83
|
+
--toml examples/dissmodel-configs/lucc_discrete.toml \
|
|
84
|
+
--input data/input/cs_moju.zip \
|
|
85
|
+
--param demand_csv=data/input/demand_moju.csv \
|
|
86
|
+
--output outputs/result.tif
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
`--output` writes a GeoTIFF with one band per land-use class (+ `mask`),
|
|
90
|
+
georeferenced from the input's CRS/extent -- open it directly in QGIS,
|
|
91
|
+
locally or straight from MinIO.
|
|
92
|
+
|
|
93
|
+
Both commands above run end-to-end as written -- `pyproject.toml` pins
|
|
94
|
+
`dissmodel>=0.6.4`, which merges `[model]`-level spec into
|
|
95
|
+
`record.parameters` for local `--toml` runs (this used to require an
|
|
96
|
+
unreleased fix; see `docs/decisions.md` for that history if you're
|
|
97
|
+
curious).
|
|
98
|
+
|
|
99
|
+
`examples/dissmodel-configs/` has a TOML config per executor
|
|
100
|
+
([continuous](examples/dissmodel-configs/lucc_continuous.toml),
|
|
101
|
+
[discrete](examples/dissmodel-configs/lucc_discrete.toml)), each
|
|
102
|
+
encoding the same coefficients as its `examples/run_*_executor.py`
|
|
103
|
+
counterpart — see [`api.md`](docs/api.md#registering-with-dissmodel-configs-toml)
|
|
104
|
+
for the full explanation.
|
|
105
|
+
|
|
106
|
+
## Documentation
|
|
107
|
+
|
|
108
|
+
- **[quickstart.md](docs/quickstart.md)** — installing, the first model, ready-made examples
|
|
109
|
+
- **[api.md](docs/api.md)** — reference for every class and parameter
|
|
110
|
+
- **[architecture.md](docs/architecture.md)** — what's faithful to the
|
|
111
|
+
original repositories, what was simplified, what's new
|
|
112
|
+
- **[validation.md](docs/validation.md)** — where the comparison with
|
|
113
|
+
TerraME lives: [disslucc-benchmark](https://github.com/LambdaGeo/disslucc-benchmark)
|
|
114
|
+
- **[decisions.md](docs/decisions.md)** — full history of decisions and
|
|
115
|
+
tests throughout development
|
|
116
|
+
|
|
117
|
+
Wider ecosystem context: chapter 26 (*Land Use and Cover Change
|
|
118
|
+
Modeling*) of the *Geospatial Modeling with Python* book (LambdaGeo) --
|
|
119
|
+
still a draft, but where "DisSLUCC" as a family name is documented for
|
|
120
|
+
the first time.
|
|
121
|
+
|
|
122
|
+
## Development
|
|
123
|
+
|
|
124
|
+
```bash
|
|
125
|
+
pip install -e ".[dev]"
|
|
126
|
+
mypy src/disslucc
|
|
127
|
+
pytest tests/ -v
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
CI (`.github/workflows/tests.yml`) runs ruff, mypy and the tests on every push
|
|
131
|
+
and pull request. `tests/` covers the demand components and checks that each
|
|
132
|
+
example TOML, run through the CLI, produces the same output file as the
|
|
133
|
+
equivalent hand-built experiment. **Agreement with TerraME/LuccME is not tested
|
|
134
|
+
here**: it is the job of
|
|
135
|
+
[disslucc-benchmark](https://github.com/LambdaGeo/disslucc-benchmark), which pins
|
|
136
|
+
the disslucc release it ran against.
|
|
137
|
+
|
|
138
|
+
## Citing
|
|
139
|
+
|
|
140
|
+
Use the DOI of the release you used (Zenodo, badge above once published) and
|
|
141
|
+
`CITATION.cff`.
|
|
142
|
+
|
|
143
|
+
## Structure
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
disslucc/
|
|
147
|
+
├── src/disslucc/
|
|
148
|
+
│ ├── protocols.py, schemas.py
|
|
149
|
+
│ ├── components/ # same convention as the original repositories
|
|
150
|
+
│ │ ├── demand/ # shared continuous + discrete
|
|
151
|
+
│ │ ├── potential/ # linear.py (continuous) + logistic.py (discrete)
|
|
152
|
+
│ │ └── allocation/ # clue.py (continuous) + clue_s.py (discrete)
|
|
153
|
+
│ ├── validation/ # Pontius & Millones metrics, naive baseline (outside components/, see architecture.md)
|
|
154
|
+
│ └── executors/ # ModelExecutor -- automatic provenance, second entry point
|
|
155
|
+
├── examples/ # ready-made scripts: synthetic, real data, executor, TOML configs
|
|
156
|
+
├── data/input/ # vendored example inputs (csAC, cs_moju) and demand CSVs
|
|
157
|
+
├── tests/ # pytest suite: demand components, TOML == executor
|
|
158
|
+
└── docs/
|
|
159
|
+
```
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "disslucc"
|
|
3
|
+
version = "0.5.0"
|
|
4
|
+
description = "Land Use and Cover Change (LUCC) modeling — continuous and discrete allocation — on top of dissmodel."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [{ name = "Sérgio Souza Costa" }]
|
|
7
|
+
license = { text = "MIT" }
|
|
8
|
+
requires-python = ">=3.11"
|
|
9
|
+
dependencies = [
|
|
10
|
+
"dissmodel>=0.6.4,<0.7.0",
|
|
11
|
+
# scipy.special.expit (potential/logistic.py) -- was already pulled
|
|
12
|
+
# in transitively by dissmodel's own deps, but disslucc now imports
|
|
13
|
+
# it directly, so it needs to be a declared dependency, not an
|
|
14
|
+
# accident of what dissmodel happens to require today.
|
|
15
|
+
"scipy",
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
[project.urls]
|
|
19
|
+
Homepage = "https://github.com/DisSModel/disslucc"
|
|
20
|
+
Repository = "https://github.com/DisSModel/disslucc"
|
|
21
|
+
Documentation = "https://dissmodel.github.io/disslucc/"
|
|
22
|
+
Issues = "https://github.com/DisSModel/disslucc/issues"
|
|
23
|
+
|
|
24
|
+
[project.optional-dependencies]
|
|
25
|
+
examples = ["matplotlib"]
|
|
26
|
+
dev = ["mypy>=1.10", "pytest>=7", "ruff>=0.16,<0.17"]
|
|
27
|
+
|
|
28
|
+
[tool.mypy]
|
|
29
|
+
# 3.12, not 3.11 (the floor in requires-python): numpy 2.5's stub uses
|
|
30
|
+
# PEP 695 `type` statement syntax, which mypy can only parse when
|
|
31
|
+
# targeting 3.12+. python_version pins the syntax mypy parses, not a
|
|
32
|
+
# ceiling on what it will pass on this project's own code, so pointing
|
|
33
|
+
# it at the newer of the two supported versions costs nothing here and
|
|
34
|
+
# avoids `mypy` breaking outright on whichever numpy resolves for a
|
|
35
|
+
# student running it locally under Python 3.12 (same class of problem
|
|
36
|
+
# as the zarr/PEP-695 override in dissmodel core's [tool.mypy]).
|
|
37
|
+
python_version = "3.12"
|
|
38
|
+
files = ["src/disslucc"]
|
|
39
|
+
warn_return_any = true
|
|
40
|
+
warn_unused_ignores = true
|
|
41
|
+
disallow_untyped_defs = false
|
|
42
|
+
ignore_missing_imports = true
|
|
43
|
+
|
|
44
|
+
[tool.ruff]
|
|
45
|
+
# No explicit `select`: lints with ruff's own default rule set (isort,
|
|
46
|
+
# pyupgrade, pyflakes/pycodestyle, and the ruff-specific/flake8-derived
|
|
47
|
+
# checks that are on by default too, as of the 0.16.x line pinned above
|
|
48
|
+
# in `dev`). Pinned for the same reason as dissmodel core: that default
|
|
49
|
+
# set grows across ruff versions, and an unpinned `ruff` would silently
|
|
50
|
+
# start failing CI on a routine upgrade with no code change on our side.
|
|
51
|
+
line-length = 120
|
|
52
|
+
target-version = "py311"
|
|
53
|
+
|
|
54
|
+
[build-system]
|
|
55
|
+
requires = ["setuptools>=68"]
|
|
56
|
+
build-backend = "setuptools.build_meta"
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.packages.find]
|
|
59
|
+
where = ["src"]
|
disslucc-0.5.0/setup.cfg
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""
|
|
2
|
+
disslucc -- raster-only, "script-first" port of disslucc-continuous
|
|
3
|
+
(main branch). See README for what was simplified and what wasn't
|
|
4
|
+
(the CLUE algorithm itself is faithful to the original).
|
|
5
|
+
"""
|
|
6
|
+
from .components.allocation import AllocationClueLike, AllocationClueLikeSaturation, AllocationDClueSLike
|
|
7
|
+
from .components.demand import (
|
|
8
|
+
DemandComputeThreeDates,
|
|
9
|
+
DemandComputeTwoDates,
|
|
10
|
+
DemandInline,
|
|
11
|
+
DemandPreComputedValues,
|
|
12
|
+
load_demand_csv,
|
|
13
|
+
)
|
|
14
|
+
from .components.potential import (
|
|
15
|
+
PotentialDLogisticRegression,
|
|
16
|
+
PotentialLinearRegression,
|
|
17
|
+
PotentialSpatialLagRegression,
|
|
18
|
+
)
|
|
19
|
+
from .protocols import DemandProtocol, PotentialProtocol, RegionalPotentialProtocol
|
|
20
|
+
from .schemas import (
|
|
21
|
+
AllocationSpec,
|
|
22
|
+
LogisticRegressionSpec,
|
|
23
|
+
RegressionSpec,
|
|
24
|
+
SaturationAllocationSpec,
|
|
25
|
+
SpatialLagRegressionSpec,
|
|
26
|
+
)
|
|
27
|
+
from .validation import confusion_metrics, pontius_millones
|
|
28
|
+
|
|
29
|
+
# Explicit public API: these are re-exports (nothing here is used within
|
|
30
|
+
# this module itself), so without __all__ ruff's default rule set flags
|
|
31
|
+
# every one of them as an unused import.
|
|
32
|
+
__all__ = [
|
|
33
|
+
"AllocationClueLike",
|
|
34
|
+
"AllocationClueLikeSaturation",
|
|
35
|
+
"AllocationDClueSLike",
|
|
36
|
+
"AllocationSpec",
|
|
37
|
+
"DemandComputeThreeDates",
|
|
38
|
+
"DemandComputeTwoDates",
|
|
39
|
+
"DemandInline",
|
|
40
|
+
"DemandPreComputedValues",
|
|
41
|
+
"DemandProtocol",
|
|
42
|
+
"LogisticRegressionSpec",
|
|
43
|
+
"PotentialDLogisticRegression",
|
|
44
|
+
"PotentialLinearRegression",
|
|
45
|
+
"PotentialProtocol",
|
|
46
|
+
"PotentialSpatialLagRegression",
|
|
47
|
+
"RegionalPotentialProtocol",
|
|
48
|
+
"RegressionSpec",
|
|
49
|
+
"SaturationAllocationSpec",
|
|
50
|
+
"SpatialLagRegressionSpec",
|
|
51
|
+
"confusion_metrics",
|
|
52
|
+
"load_demand_csv",
|
|
53
|
+
"pontius_millones",
|
|
54
|
+
]
|
|
File without changes
|