PTS-WFM4Cities 3.0.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.
- pts_wfm4cities-3.0.0/AUTHORS.md +14 -0
- pts_wfm4cities-3.0.0/CHANGELOG.md +47 -0
- pts_wfm4cities-3.0.0/CITATION.cff +22 -0
- pts_wfm4cities-3.0.0/CODE_OF_CONDUCT.md +13 -0
- pts_wfm4cities-3.0.0/CONTRIBUTING.md +41 -0
- pts_wfm4cities-3.0.0/LICENSE +21 -0
- pts_wfm4cities-3.0.0/MANIFEST.in +18 -0
- pts_wfm4cities-3.0.0/MIGRATION.md +39 -0
- pts_wfm4cities-3.0.0/PKG-INFO +277 -0
- pts_wfm4cities-3.0.0/README.md +231 -0
- pts_wfm4cities-3.0.0/README_zh-CN.md +184 -0
- pts_wfm4cities-3.0.0/SECURITY.md +24 -0
- pts_wfm4cities-3.0.0/THIRD_PARTY_NOTICES.md +25 -0
- pts_wfm4cities-3.0.0/WFM4Cities.py +10 -0
- pts_wfm4cities-3.0.0/docs/API.md +48 -0
- pts_wfm4cities-3.0.0/docs/ARCHITECTURE.md +36 -0
- pts_wfm4cities-3.0.0/docs/GITHUB_UPLOAD_GUIDE_zh-CN.md +97 -0
- pts_wfm4cities-3.0.0/docs/METHOD.md +79 -0
- pts_wfm4cities-3.0.0/docs/RELEASE.md +71 -0
- pts_wfm4cities-3.0.0/docs/REPOSITORY_AUDIT_zh-CN.md +30 -0
- pts_wfm4cities-3.0.0/environment.yml +9 -0
- pts_wfm4cities-3.0.0/examples/README.md +9 -0
- pts_wfm4cities-3.0.0/examples/basic_pts.py +21 -0
- pts_wfm4cities-3.0.0/examples/data/sample_points.csv +31 -0
- pts_wfm4cities-3.0.0/examples/from_points_csv.py +45 -0
- pts_wfm4cities-3.0.0/pyproject.toml +102 -0
- pts_wfm4cities-3.0.0/requirements-dev.txt +1 -0
- pts_wfm4cities-3.0.0/requirements-spatial.txt +5 -0
- pts_wfm4cities-3.0.0/requirements-tested.txt +5 -0
- pts_wfm4cities-3.0.0/requirements.txt +4 -0
- pts_wfm4cities-3.0.0/setup.cfg +4 -0
- pts_wfm4cities-3.0.0/src/PTS_WFM4Cities.egg-info/PKG-INFO +277 -0
- pts_wfm4cities-3.0.0/src/PTS_WFM4Cities.egg-info/SOURCES.txt +50 -0
- pts_wfm4cities-3.0.0/src/PTS_WFM4Cities.egg-info/dependency_links.txt +1 -0
- pts_wfm4cities-3.0.0/src/PTS_WFM4Cities.egg-info/entry_points.txt +3 -0
- pts_wfm4cities-3.0.0/src/PTS_WFM4Cities.egg-info/requires.txt +17 -0
- pts_wfm4cities-3.0.0/src/PTS_WFM4Cities.egg-info/top_level.txt +1 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/Water_flooding_Model.py +11 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/__init__.py +25 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/__main__.py +6 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/_version.py +3 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/cli.py +244 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/core.py +347 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/gui.py +342 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/io.py +139 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/plotting.py +181 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/pts.py +234 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/py.typed +1 -0
- pts_wfm4cities-3.0.0/src/wfm4cities/spatial.py +67 -0
- pts_wfm4cities-3.0.0/tests/test_core.py +73 -0
- pts_wfm4cities-3.0.0/tests/test_io_cli.py +81 -0
- pts_wfm4cities-3.0.0/tests/test_pts.py +56 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Authors and maintainers
|
|
2
|
+
|
|
3
|
+
WFM4Cities was developed by:
|
|
4
|
+
|
|
5
|
+
- Zuo Zhang (张祚), Central China Normal University;
|
|
6
|
+
- Yukun Jiang (江驭鲲);
|
|
7
|
+
- Zhe Wang (王哲).
|
|
8
|
+
|
|
9
|
+
The public contact retained from the existing PyPI release is
|
|
10
|
+
`jiangyukunccnu@163.com`.
|
|
11
|
+
|
|
12
|
+
Contributors should be acknowledged through the Git history and release notes.
|
|
13
|
+
Please do not add an affiliation, email address, ORCID, or contributor role
|
|
14
|
+
without confirmation from the person concerned.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes follow the principles of
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/) and semantic versioning.
|
|
5
|
+
|
|
6
|
+
## [3.0.0] - 2026-08-08
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- import-safe lowercase `wfm4cities` package;
|
|
11
|
+
- validated point-pattern and point-to-surface API;
|
|
12
|
+
- cubic interpolation with nearest-neighbor boundary filling;
|
|
13
|
+
- explicit 51-level PTS implementation for A(h), V(h), N(h), and L(h);
|
|
14
|
+
- fixed ten-feature extraction used by the associated study;
|
|
15
|
+
- headless `demo`, `points`, and `scan` commands;
|
|
16
|
+
- single-window bilingual Tk interface with threshold animation;
|
|
17
|
+
- CSV/JSON exports and reproducible overview figures;
|
|
18
|
+
- optional GeoPandas/PySAL Moran diagnostic;
|
|
19
|
+
- tests, CI, trusted-publishing workflow, citation metadata, and release guide;
|
|
20
|
+
- compatibility namespace and command for 2.x users;
|
|
21
|
+
- unmodified 2.6 single-file script in `legacy/` for provenance.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- internal code is separated into numerical, PTS, I/O, plotting, optional
|
|
26
|
+
spatial, CLI, and GUI modules;
|
|
27
|
+
- supported Python is now 3.10--3.13;
|
|
28
|
+
- runtime dependencies use compatible ranges rather than exact historical pins;
|
|
29
|
+
- the canonical version is consistently 3.0.0;
|
|
30
|
+
- the PyPI distribution is published as `PTS-WFM4Cities`; the historical 2.6
|
|
31
|
+
release stays under the shorter name `WFM4Cities`.
|
|
32
|
+
|
|
33
|
+
### Fixed
|
|
34
|
+
|
|
35
|
+
- importing the package no longer creates Tk roots or starts a main loop;
|
|
36
|
+
- Matplotlib's backend and system font are no longer changed at import time;
|
|
37
|
+
- the PyPI homepage points to the real GitHub repository;
|
|
38
|
+
- CLI routing no longer depends on GUI global variables;
|
|
39
|
+
- impossible cluster-center settings fail with an actionable error;
|
|
40
|
+
- distribution metadata now includes the license, README, source distribution,
|
|
41
|
+
wheel, and citation information.
|
|
42
|
+
|
|
43
|
+
## [2.6] - 2025-01-22
|
|
44
|
+
|
|
45
|
+
- historical PyPI release containing the original desktop script.
|
|
46
|
+
|
|
47
|
+
[3.0.0]: https://github.com/zhangzuocughustccnu/WFM4Cities/releases/tag/v3.0.0
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
cff-version: 1.2.0
|
|
2
|
+
message: "If you use WFM4Cities, please cite this software and the associated article when available."
|
|
3
|
+
title: "WFM4Cities: DEM-inspired urban scalar surfaces and progressive threshold scanning"
|
|
4
|
+
type: software
|
|
5
|
+
version: 3.0.0
|
|
6
|
+
date-released: 2026-08-08
|
|
7
|
+
license: MIT
|
|
8
|
+
repository-code: "https://github.com/zhangzuocughustccnu/WFM4Cities"
|
|
9
|
+
url: "https://github.com/zhangzuocughustccnu/WFM4Cities"
|
|
10
|
+
keywords:
|
|
11
|
+
- urban morphology
|
|
12
|
+
- progressive threshold scanning
|
|
13
|
+
- scalar surface
|
|
14
|
+
- spatial analysis
|
|
15
|
+
authors:
|
|
16
|
+
- family-names: Zhang
|
|
17
|
+
given-names: Zuo
|
|
18
|
+
affiliation: Central China Normal University
|
|
19
|
+
- family-names: Jiang
|
|
20
|
+
given-names: Yukun
|
|
21
|
+
- family-names: Wang
|
|
22
|
+
given-names: Zhe
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Community conduct
|
|
2
|
+
|
|
3
|
+
Project participation should be professional, respectful, and focused on
|
|
4
|
+
scientific and software quality.
|
|
5
|
+
|
|
6
|
+
Acceptable participation includes constructive review, clear attribution,
|
|
7
|
+
reproducible evidence, and good-faith disagreement. Harassment, discrimination,
|
|
8
|
+
personal attacks, deliberate misrepresentation, plagiarism, and disclosure of
|
|
9
|
+
private information are not acceptable.
|
|
10
|
+
|
|
11
|
+
Maintainers may edit or remove material that violates these expectations and
|
|
12
|
+
may restrict repeated disruptive participation. Concerns should be reported
|
|
13
|
+
privately through the contact route in SECURITY.md.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
Thank you for helping improve WFM4Cities.
|
|
4
|
+
|
|
5
|
+
## Before opening a change
|
|
6
|
+
|
|
7
|
+
1. Search existing issues.
|
|
8
|
+
2. For method changes, state the mathematical convention being changed and why.
|
|
9
|
+
3. Do not silently change threshold inequalities, connectivity, normalization,
|
|
10
|
+
interpolation, random seeds, or output field names.
|
|
11
|
+
4. Add or update tests for every behavior change.
|
|
12
|
+
|
|
13
|
+
## Development setup
|
|
14
|
+
|
|
15
|
+
python -m venv .venv
|
|
16
|
+
source .venv/bin/activate
|
|
17
|
+
python -m pip install -e ".[dev]"
|
|
18
|
+
|
|
19
|
+
Use `.venv\Scripts\Activate.ps1` on Windows PowerShell.
|
|
20
|
+
|
|
21
|
+
Run:
|
|
22
|
+
|
|
23
|
+
ruff check .
|
|
24
|
+
pytest
|
|
25
|
+
python -m build
|
|
26
|
+
python -m twine check dist/*
|
|
27
|
+
|
|
28
|
+
## Pull requests
|
|
29
|
+
|
|
30
|
+
- keep each pull request focused;
|
|
31
|
+
- explain scientific and software consequences;
|
|
32
|
+
- update CHANGELOG.md for user-visible changes;
|
|
33
|
+
- preserve backwards compatibility where practical;
|
|
34
|
+
- do not commit generated environments, caches, credentials, or large
|
|
35
|
+
unpublished research data;
|
|
36
|
+
- confirm that you have the right to contribute all included code and data.
|
|
37
|
+
|
|
38
|
+
## Reproducible bug reports
|
|
39
|
+
|
|
40
|
+
Include operating system, Python version, WFM4Cities version, installation
|
|
41
|
+
command, minimal input or script, full error message, and expected behavior.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Zuo Zhang, Yukun Jiang, and Zhe Wang
|
|
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.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
include LICENSE
|
|
2
|
+
include README.md
|
|
3
|
+
include README_zh-CN.md
|
|
4
|
+
include CHANGELOG.md
|
|
5
|
+
include CITATION.cff
|
|
6
|
+
include AUTHORS.md
|
|
7
|
+
include WFM4Cities.py
|
|
8
|
+
include CODE_OF_CONDUCT.md
|
|
9
|
+
include CONTRIBUTING.md
|
|
10
|
+
include MIGRATION.md
|
|
11
|
+
include SECURITY.md
|
|
12
|
+
include THIRD_PARTY_NOTICES.md
|
|
13
|
+
include environment.yml
|
|
14
|
+
include requirements*.txt
|
|
15
|
+
recursive-include docs *.md
|
|
16
|
+
recursive-include examples *.py *.csv *.md
|
|
17
|
+
recursive-include src *.py py.typed
|
|
18
|
+
prune legacy
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Migrating from WFM4Cities 2.6 to 3.0
|
|
2
|
+
|
|
3
|
+
## What remains compatible
|
|
4
|
+
|
|
5
|
+
- distribution name: `WFM4Cities`;
|
|
6
|
+
- historical command: `WFM4Cities`;
|
|
7
|
+
- historical module path: `WFM4Cities.Water_flooding_Model`;
|
|
8
|
+
- top-level launcher: `python WFM4Cities.py`.
|
|
9
|
+
|
|
10
|
+
Each now forwards to maintained code.
|
|
11
|
+
|
|
12
|
+
## Recommended new usage
|
|
13
|
+
|
|
14
|
+
Use lowercase imports:
|
|
15
|
+
|
|
16
|
+
import wfm4cities
|
|
17
|
+
|
|
18
|
+
Launch the interface with:
|
|
19
|
+
|
|
20
|
+
wfm4cities gui
|
|
21
|
+
|
|
22
|
+
Run reproducible analyses without a display:
|
|
23
|
+
|
|
24
|
+
wfm4cities demo
|
|
25
|
+
wfm4cities points observations.csv
|
|
26
|
+
wfm4cities scan surface.csv
|
|
27
|
+
|
|
28
|
+
## Intentional changes
|
|
29
|
+
|
|
30
|
+
- No window opens during import.
|
|
31
|
+
- No Matplotlib backend is forced during import.
|
|
32
|
+
- Random generation uses a local `numpy.random.Generator` with an explicit
|
|
33
|
+
seed.
|
|
34
|
+
- Cubic interpolation boundaries are filled by nearest-neighbor values.
|
|
35
|
+
- PTS metrics and threshold rules are explicit and independently callable.
|
|
36
|
+
- Heavy GeoPandas/PySAL dependencies are optional.
|
|
37
|
+
|
|
38
|
+
The historical script is in `legacy/WFM4Cities_2.6_original.py`. It is not
|
|
39
|
+
imported, tested, or installed.
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: PTS-WFM4Cities
|
|
3
|
+
Version: 3.0.0
|
|
4
|
+
Summary: DEM-inspired urban scalar surfaces and progressive threshold scanning
|
|
5
|
+
Author: Zuo Zhang, Zhe Wang
|
|
6
|
+
Author-email: Yukun Jiang <jiangyukunccnu@163.com>
|
|
7
|
+
License-Expression: MIT
|
|
8
|
+
Project-URL: Homepage, https://github.com/zhangzuocughustccnu/WFM4Cities
|
|
9
|
+
Project-URL: Repository, https://github.com/zhangzuocughustccnu/WFM4Cities.git
|
|
10
|
+
Project-URL: Issues, https://github.com/zhangzuocughustccnu/WFM4Cities/issues
|
|
11
|
+
Project-URL: Changelog, https://github.com/zhangzuocughustccnu/WFM4Cities/blob/main/CHANGELOG.md
|
|
12
|
+
Keywords: urban morphology,progressive threshold scanning,scalar surface,spatial analysis,DEM-inspired
|
|
13
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Natural Language :: English
|
|
16
|
+
Classifier: Natural Language :: Chinese (Simplified)
|
|
17
|
+
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
19
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
20
|
+
Classifier: Programming Language :: Python :: 3
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
25
|
+
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
27
|
+
Requires-Python: >=3.10
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
License-File: LICENSE
|
|
30
|
+
Requires-Dist: numpy<3,>=1.24
|
|
31
|
+
Requires-Dist: scipy<2,>=1.10
|
|
32
|
+
Requires-Dist: matplotlib<4,>=3.7
|
|
33
|
+
Requires-Dist: scikit-learn<2,>=1.3
|
|
34
|
+
Provides-Extra: spatial
|
|
35
|
+
Requires-Dist: geopandas<2,>=0.13; extra == "spatial"
|
|
36
|
+
Requires-Dist: shapely<3,>=2; extra == "spatial"
|
|
37
|
+
Requires-Dist: libpysal<5,>=4.9; extra == "spatial"
|
|
38
|
+
Requires-Dist: esda<3,>=2.5; extra == "spatial"
|
|
39
|
+
Provides-Extra: dev
|
|
40
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
41
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
42
|
+
Requires-Dist: pytest-cov>=5; extra == "dev"
|
|
43
|
+
Requires-Dist: ruff>=0.8; extra == "dev"
|
|
44
|
+
Requires-Dist: twine>=5; extra == "dev"
|
|
45
|
+
Dynamic: license-file
|
|
46
|
+
|
|
47
|
+
# WFM4Cities
|
|
48
|
+
|
|
49
|
+
[](https://github.com/zhangzuocughustccnu/WFM4Cities/actions/workflows/ci.yml)
|
|
50
|
+
[](https://pypi.org/project/PTS-WFM4Cities/)
|
|
51
|
+
[](https://pypi.org/project/PTS-WFM4Cities/)
|
|
52
|
+
[](LICENSE)
|
|
53
|
+
|
|
54
|
+
WFM4Cities is a research-oriented Python package for constructing DEM-inspired
|
|
55
|
+
urban scalar surfaces and analyzing them with Progressive Threshold Scanning
|
|
56
|
+
(PTS). It supports a transparent point-to-surface workflow, a headless API and
|
|
57
|
+
command-line interface, and an optional bilingual desktop interface.
|
|
58
|
+
|
|
59
|
+
[简体中文说明](README_zh-CN.md)
|
|
60
|
+
|
|
61
|
+
## What the package does
|
|
62
|
+
|
|
63
|
+
- checks and visualizes point patterns;
|
|
64
|
+
- interpolates scattered observations with
|
|
65
|
+
`scipy.interpolate.griddata(method="cubic")`;
|
|
66
|
+
- fills cells outside the cubic interpolation hull with nearest-neighbor values;
|
|
67
|
+
- min--max normalizes an analytical surface to \([0,1]\);
|
|
68
|
+
- scans an ordered threshold sequence;
|
|
69
|
+
- calculates projected area \(A(h)\), normalized excess volume \(V(h)\),
|
|
70
|
+
connected-component count \(N(h)\), and largest-component ratio \(L(h)\);
|
|
71
|
+
- exports regular grids, full response trajectories, fixed summary features,
|
|
72
|
+
and overview figures;
|
|
73
|
+
- provides optional GeoPandas/PySAL spatial diagnostics.
|
|
74
|
+
|
|
75
|
+
WFM4Cities treats the vertical coordinate as the value of a specified urban
|
|
76
|
+
attribute (for example, density, activity intensity, or building volume). It
|
|
77
|
+
does **not** infer the meaning of that variable.
|
|
78
|
+
|
|
79
|
+
## Scientific scope
|
|
80
|
+
|
|
81
|
+
The water-flooding metaphor is an explanatory analogy for moving a horizontal
|
|
82
|
+
threshold through a scalar surface. WFM4Cities is **not** a hydrodynamic flood
|
|
83
|
+
model, a general DEM-production system, or an operational planning platform.
|
|
84
|
+
Threshold order is not time. Hydrological applications require additional
|
|
85
|
+
terrain, rainfall, drainage, flow-path, water-depth, and exposure information.
|
|
86
|
+
|
|
87
|
+
## Installation
|
|
88
|
+
|
|
89
|
+
Python 3.10--3.13 is supported. Python 3.11 is the recommended reference
|
|
90
|
+
environment.
|
|
91
|
+
|
|
92
|
+
### Install from the repository
|
|
93
|
+
|
|
94
|
+
git clone https://github.com/zhangzuocughustccnu/WFM4Cities.git
|
|
95
|
+
cd WFM4Cities
|
|
96
|
+
python -m venv .venv
|
|
97
|
+
|
|
98
|
+
Activate the environment:
|
|
99
|
+
|
|
100
|
+
# Windows PowerShell
|
|
101
|
+
.venv\Scripts\Activate.ps1
|
|
102
|
+
|
|
103
|
+
# macOS/Linux
|
|
104
|
+
source .venv/bin/activate
|
|
105
|
+
|
|
106
|
+
Then install:
|
|
107
|
+
|
|
108
|
+
python -m pip install --upgrade pip
|
|
109
|
+
python -m pip install -e .
|
|
110
|
+
|
|
111
|
+
### Install the released package
|
|
112
|
+
|
|
113
|
+
python -m pip install PTS-WFM4Cities
|
|
114
|
+
|
|
115
|
+
The PyPI distribution is named `PTS-WFM4Cities`. The historical 2.6 release is
|
|
116
|
+
still published under the shorter name `WFM4Cities`, which belongs to a
|
|
117
|
+
different PyPI account, so `pip install WFM4Cities` installs that older
|
|
118
|
+
release. Always install `PTS-WFM4Cities` to get version 3.0.
|
|
119
|
+
|
|
120
|
+
### Optional spatial diagnostics
|
|
121
|
+
|
|
122
|
+
python -m pip install "PTS-WFM4Cities[spatial]"
|
|
123
|
+
|
|
124
|
+
### Conda environment
|
|
125
|
+
|
|
126
|
+
conda env create -f environment.yml
|
|
127
|
+
conda activate wfm4cities-3.0
|
|
128
|
+
|
|
129
|
+
Tkinter is included with standard Python on Windows and macOS. On some Linux
|
|
130
|
+
distributions it is a separate operating-system package (for example,
|
|
131
|
+
`sudo apt install python3-tk` on Debian/Ubuntu).
|
|
132
|
+
|
|
133
|
+
## Quick start
|
|
134
|
+
|
|
135
|
+
### Desktop interface
|
|
136
|
+
|
|
137
|
+
wfm4cities gui
|
|
138
|
+
|
|
139
|
+
Running `wfm4cities` with no subcommand also opens the interface. The
|
|
140
|
+
historical `WFM4Cities` command remains available after installation; the
|
|
141
|
+
`python WFM4Cities.py` launcher also remains available in a source checkout.
|
|
142
|
+
|
|
143
|
+
### Deterministic headless demonstration
|
|
144
|
+
|
|
145
|
+
wfm4cities demo --output-dir demo_results --seed 42
|
|
146
|
+
|
|
147
|
+
This writes:
|
|
148
|
+
|
|
149
|
+
- `source_points.csv`;
|
|
150
|
+
- `surface_normalized.csv`;
|
|
151
|
+
- `pts_response.csv`;
|
|
152
|
+
- `pts_features.json`;
|
|
153
|
+
- `wfm4cities_overview.png`.
|
|
154
|
+
|
|
155
|
+
### Analyze an existing grid
|
|
156
|
+
|
|
157
|
+
The input must be a headerless numeric CSV matrix:
|
|
158
|
+
|
|
159
|
+
wfm4cities scan my_surface.csv --output-dir scan_results
|
|
160
|
+
|
|
161
|
+
Use strict thresholding to exclude zero background cells at \(h=0\):
|
|
162
|
+
|
|
163
|
+
wfm4cities scan my_surface.csv --rule strict --output-dir scan_results
|
|
164
|
+
|
|
165
|
+
### Construct a surface from points
|
|
166
|
+
|
|
167
|
+
The CSV must contain `x` and `y` columns. An optional column named
|
|
168
|
+
`value`, `density`, or `z` supplies the vertical value. If it is absent,
|
|
169
|
+
WFM4Cities calculates a local neighbor count.
|
|
170
|
+
|
|
171
|
+
wfm4cities points observations.csv --grid-size 100 --method cubic
|
|
172
|
+
|
|
173
|
+
## Python API
|
|
174
|
+
|
|
175
|
+
from wfm4cities import (
|
|
176
|
+
SimulationConfig,
|
|
177
|
+
build_surface,
|
|
178
|
+
extract_features,
|
|
179
|
+
progressive_threshold_scan,
|
|
180
|
+
)
|
|
181
|
+
|
|
182
|
+
config = SimulationConfig(
|
|
183
|
+
num_points=150,
|
|
184
|
+
noise_ratio=0.30,
|
|
185
|
+
num_clusters=4,
|
|
186
|
+
grid_size=100,
|
|
187
|
+
seed=2026,
|
|
188
|
+
)
|
|
189
|
+
model = build_surface(config)
|
|
190
|
+
result = progressive_threshold_scan(
|
|
191
|
+
model.grid_z,
|
|
192
|
+
threshold_count=51,
|
|
193
|
+
threshold_min=0.0,
|
|
194
|
+
threshold_max=0.95,
|
|
195
|
+
rule="inclusive",
|
|
196
|
+
connectivity=8,
|
|
197
|
+
)
|
|
198
|
+
features = extract_features(result)
|
|
199
|
+
print(features)
|
|
200
|
+
|
|
201
|
+
The main response arrays are available as `result.A`, `result.V`,
|
|
202
|
+
`result.N`, and `result.L`.
|
|
203
|
+
|
|
204
|
+
## Threshold conventions
|
|
205
|
+
|
|
206
|
+
Two explicit rules are available:
|
|
207
|
+
|
|
208
|
+
- `inclusive`: retain cells satisfying \(z \ge h\). This is the default and
|
|
209
|
+
matches the controlled archetype analysis.
|
|
210
|
+
- `strict`: retain cells satisfying \(z > h\). This excludes zero-valued
|
|
211
|
+
background cells when \(h=0\).
|
|
212
|
+
|
|
213
|
+
The denominator of \(A(h)\) is the fixed analysis domain, not the number of
|
|
214
|
+
currently positive cells. Components use eight-neighbor connectivity by
|
|
215
|
+
default; four-neighbor connectivity is also available. \(V(h)\) is normalized
|
|
216
|
+
by total intensity at \(h=0\).
|
|
217
|
+
|
|
218
|
+
See [Method conventions](docs/METHOD.md) for the exact definitions.
|
|
219
|
+
|
|
220
|
+
## Project structure
|
|
221
|
+
|
|
222
|
+
WFM4Cities/
|
|
223
|
+
├── src/wfm4cities/ # maintained implementation
|
|
224
|
+
├── src/WFM4Cities/ # compatibility namespace for 2.x users
|
|
225
|
+
├── tests/ # automated regression tests
|
|
226
|
+
├── examples/ # executable examples and sample data
|
|
227
|
+
├── docs/ # method, API, architecture, and release notes
|
|
228
|
+
├── legacy/ # unmodified historical single-file script
|
|
229
|
+
├── pyproject.toml # package metadata and dependencies
|
|
230
|
+
├── environment.yml # recommended Conda environment
|
|
231
|
+
├── CITATION.cff # machine-readable software citation
|
|
232
|
+
└── LICENSE # MIT license
|
|
233
|
+
|
|
234
|
+
The maintained package does not create Tk windows or force a Matplotlib backend
|
|
235
|
+
when imported. GUI code is loaded only when requested.
|
|
236
|
+
|
|
237
|
+
## Reproducibility and testing
|
|
238
|
+
|
|
239
|
+
Create a development environment and run:
|
|
240
|
+
|
|
241
|
+
python -m pip install -e ".[dev]"
|
|
242
|
+
ruff check .
|
|
243
|
+
pytest
|
|
244
|
+
python -m build
|
|
245
|
+
python -m twine check dist/*
|
|
246
|
+
|
|
247
|
+
`requirements-tested.txt` records the exact numerical library versions used
|
|
248
|
+
for the 3.0.0 release-candidate verification. `pyproject.toml` remains the
|
|
249
|
+
authoritative dependency specification.
|
|
250
|
+
|
|
251
|
+
## Method demonstration
|
|
252
|
+
|
|
253
|
+
The physical immersion demonstration used to explain the threshold analogy is
|
|
254
|
+
available at [YouTube](https://youtu.be/tMdRVbR-JpQ). It is explanatory only
|
|
255
|
+
and does not define the numerical algorithm.
|
|
256
|
+
|
|
257
|
+
## Authors
|
|
258
|
+
|
|
259
|
+
WFM4Cities was developed by **Zuo Zhang, Yukun Jiang, and Zhe Wang**.
|
|
260
|
+
See [AUTHORS.md](AUTHORS.md) for details.
|
|
261
|
+
|
|
262
|
+
## Citation
|
|
263
|
+
|
|
264
|
+
Use GitHub's “Cite this repository” control or the metadata in
|
|
265
|
+
[CITATION.cff](CITATION.cff). Add the article DOI to the citation metadata after
|
|
266
|
+
the associated paper is published; no DOI is invented in this repository.
|
|
267
|
+
|
|
268
|
+
## Contributing and support
|
|
269
|
+
|
|
270
|
+
Please read [CONTRIBUTING.md](CONTRIBUTING.md) before submitting a pull request.
|
|
271
|
+
Reproducible bug reports can be filed through the repository's issue templates.
|
|
272
|
+
Security-sensitive reports should follow [SECURITY.md](SECURITY.md).
|
|
273
|
+
|
|
274
|
+
## License
|
|
275
|
+
|
|
276
|
+
WFM4Cities is distributed under the [MIT License](LICENSE). The historical
|
|
277
|
+
script is retained for provenance and is covered by the same repository license.
|