lsapy 0.1.1__tar.gz → 0.2.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.
- {lsapy-0.1.1 → lsapy-0.2.0}/CHANGELOG.rst +55 -1
- {lsapy-0.1.1 → lsapy-0.2.0}/CODE_OF_CONDUCT.md +15 -15
- {lsapy-0.1.1 → lsapy-0.2.0}/CONTRIBUTING.rst +29 -4
- {lsapy-0.1.1 → lsapy-0.2.0}/PKG-INFO +56 -23
- {lsapy-0.1.1 → lsapy-0.2.0}/README.rst +32 -15
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/lsapy/branding.md +6 -6
- lsapy-0.2.0/docs/notebooks/criteria.ipynb +125 -0
- lsapy-0.2.0/docs/notebooks/functions.ipynb +153 -0
- lsapy-0.2.0/docs/notebooks/lsa.ipynb +191 -0
- lsapy-0.2.0/docs/references.bib +78 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/environment.yml +13 -2
- lsapy-0.2.0/noxfile.py +71 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/pyproject.toml +93 -13
- {lsapy-0.1.1 → lsapy-0.2.0}/src/lsapy/__init__.py +1 -1
- lsapy-0.2.0/src/lsapy/core/aggregation.py +138 -0
- lsapy-0.2.0/src/lsapy/core/formatting.py +147 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/src/lsapy/core/functions.py +19 -10
- lsapy-0.2.0/src/lsapy/core/options.py +12 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/src/lsapy/criteria.py +78 -77
- lsapy-0.2.0/src/lsapy/data/registry.txt +3 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/src/lsapy/functions/_discrete.py +1 -1
- {lsapy-0.1.1 → lsapy-0.2.0}/src/lsapy/functions/_suitability.py +11 -44
- {lsapy-0.1.1 → lsapy-0.2.0}/src/lsapy/functions/membership.py +59 -36
- {lsapy-0.1.1 → lsapy-0.2.0}/src/lsapy/lsa.py +100 -268
- {lsapy-0.1.1 → lsapy-0.2.0}/src/lsapy/statistics.py +8 -8
- lsapy-0.2.0/src/lsapy/utils/__init__.py +3 -0
- lsapy-0.2.0/src/lsapy/utils/_utils.py +132 -0
- lsapy-0.2.0/tests/conftest.py +140 -0
- lsapy-0.2.0/tests/test_aggregate.py +240 -0
- lsapy-0.2.0/tests/test_criteria.py +135 -0
- lsapy-0.2.0/tests/test_formatting.py +46 -0
- lsapy-0.2.0/tests/test_functions.py +273 -0
- lsapy-0.2.0/tests/test_lsa.py +221 -0
- lsapy-0.2.0/tests/test_membership_fitting.py +111 -0
- lsapy-0.2.0/tests/test_utils.py +59 -0
- lsapy-0.1.1/ci/requirements_ci.in +0 -3
- lsapy-0.1.1/ci/requirements_ci.txt +0 -357
- lsapy-0.1.1/docs/_static/style.css +0 -7
- lsapy-0.1.1/docs/notebooks/criteria.ipynb +0 -154
- lsapy-0.1.1/docs/notebooks/functions.ipynb +0 -298
- lsapy-0.1.1/docs/notebooks/lsa.ipynb +0 -1969
- lsapy-0.1.1/docs/references.bib +0 -35
- lsapy-0.1.1/src/lsapy/data/climate_sample.nc +0 -0
- lsapy-0.1.1/src/lsapy/data/soil_sample.nc +0 -0
- lsapy-0.1.1/src/lsapy/utils.py +0 -56
- {lsapy-0.1.1 → lsapy-0.2.0}/LICENSE +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/Makefile +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/api/index.rst +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/changelog.rst +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/community/code_of_conduct.rst +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/community/contributing.rst +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/community/index.rst +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/conf.py +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/getting_started/index.rst +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/index.rst +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/FT2050-full_colour.png +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/UCBlack.png +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/UCWhite.png +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/lsapy/LSAPy_Icon.png +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/lsapy/LSAPy_Icon.svg +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/lsapy/LSAPy_Logo_Dark.png +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/lsapy/LSAPy_Logo_FullColour.png +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/lsapy/LSAPy_Logo_FullColour.svg +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/lsapy/LSAPy_Logo_FullDark.png +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/lsapy/LSAPy_Logo_FullLight.png +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/logos/lsapy/LSAPy_Logo_Light.png +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/make.bat +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/notebooks/index.rst +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/readme.rst +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/docs/references.rst +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/src/lsapy/core/__init__.py +0 -0
- {lsapy-0.1.1 → lsapy-0.2.0}/src/lsapy/functions/__init__.py +0 -0
|
@@ -2,6 +2,60 @@
|
|
|
2
2
|
Changelog
|
|
3
3
|
=========
|
|
4
4
|
|
|
5
|
+
v0.2.0 (2025-08-20)
|
|
6
|
+
-------------------
|
|
7
|
+
Contributor to this version: Baptiste Hamon (@baptistehamon).
|
|
8
|
+
|
|
9
|
+
New features
|
|
10
|
+
^^^^^^^^^^^^
|
|
11
|
+
* Functions' alternative names can now be used in ``SuitabilityFunction`` (PR `#43 <https://github.com/baptistehamon/lsapy/pull/43>`_).
|
|
12
|
+
* The documentation of membership functions has been improved (PR `#43 <https://github.com/baptistehamon/lsapy/pull/43>`_).
|
|
13
|
+
* `LSAPy` officially supports Python>=3.10 and is OS independent (PR `#46 <https://github.com/baptistehamon/lsapy/pull/46>`_).
|
|
14
|
+
* ``repr`` methods of ``SuitabilityFunction``, ``SuitabilityCriteria`` and ``LandSuitabilityAnalysis`` have been modified to provide more user-friendly information (issue `#55 <https://github.com/baptistehamon/lsapy/issues/55>`_, PR `#59 <https://github.com/baptistehamon/lsapy/pull/59>`_).
|
|
15
|
+
* A setter has been added to the ``attrs`` method of ``SuitabilityCriteria`` and ``LandSuitabilityAnalysis`` (issue `#55 <https://github.com/baptistehamon/lsapy/issues/55>`_, PR `#59 <https://github.com/baptistehamon/lsapy/pull/59>`_).
|
|
16
|
+
* The ``open_data`` function has been added to the ``lsapy.utils`` module to load data from the LSAPy data repository (issue `#60 <https://github.com/baptistehamon/lsapy/issues/60>`_, PR `#62 <https://github.com/baptistehamon/lsapy/pull/62>`_).
|
|
17
|
+
* A ``median`` aggregation method has been added (PR `#63 <https://github.com/baptistehamon/lsapy/pull/63>`_).
|
|
18
|
+
|
|
19
|
+
Breaking changes
|
|
20
|
+
^^^^^^^^^^^^^^^^
|
|
21
|
+
* The deprecated ``SuitabilityFunction.map`` method has been removed (PR `#44 <https://github.com/baptistehamon/lsapy/pull/44>`_).
|
|
22
|
+
* ``short_name``, ``long_name``, ``description`` and ``comment`` attributes of ``SuitabilityCriteria`` and ``LandSuitabilityAnalysis`` have been removed and are now stored in the ``attrs`` attribute (issue `#55 <https://github.com/baptistehamon/lsapy/issues/55>`_, PR `#59 <https://github.com/baptistehamon/lsapy/pull/59>`_).
|
|
23
|
+
* ``load_climate_data`` and ``load_soil_data`` functions have been removed (issue `#60 <https://github.com/baptistehamon/lsapy/issues/60>`_, PR `#62 <https://github.com/baptistehamon/lsapy/pull/62>`_).
|
|
24
|
+
* Some names of aggregation methods have been changed (PR `#63 <https://github.com/baptistehamon/lsapy/pull/63>`_):
|
|
25
|
+
* ``weighted_mean`` is now ``wmean``
|
|
26
|
+
* ``geomean`` is now ``gmean``
|
|
27
|
+
* ``weighted_geomean`` is now ``wgmean``
|
|
28
|
+
* ``limiting_factor`` is now ``limfactor``
|
|
29
|
+
* The ``vars_weighted_mean``, ``vars_mean``, ``vars_geomean``, ``vars_weighted_geomean`` and ``limiting_factor`` aggregation methods have been removed (PR `#63 <https://github.com/baptistehamon/lsapy/pull/63>`_).
|
|
30
|
+
|
|
31
|
+
Internal changes
|
|
32
|
+
^^^^^^^^^^^^^^^^
|
|
33
|
+
* Tests have been added for currently implemented `LSAPy` functionalities (issue `#7 <https://github.com/baptistehamon/lsapy/issues/7>`_, PR `#46 <https://github.com/baptistehamon/lsapy/pull/46>`_).
|
|
34
|
+
* ``pytest`` is used as the testing framework to run all unit tests, doctests and test notebooks.
|
|
35
|
+
* ``nox`` has been set up and is used to run tests in CI workflows.
|
|
36
|
+
* A CI GitHub Actions workflow has been added (issue `#8 <https://github.com/baptistehamon/lsapy/issues/8>`_, PR `#46 <https://github.com/baptistehamon/lsapy/pull/46>`_)
|
|
37
|
+
* The CI runs tests on Python 3.10 to 3.13, on Ubuntu, macOS and Windows.
|
|
38
|
+
* The coverage, doctests and notebook tests are run on Ubuntu under Python 3.12.
|
|
39
|
+
* New pre-commit hooks have been added and the package pyproject has been updated (PR `#58 <https://github.com/baptistehamon/lsapy/pull/58>`_)
|
|
40
|
+
* New hooks: ``yamllint``, ``vulture``, ``nbstripout``, ``pygrep-hooks``, ``mdformat``, ``blackdoc``, ``formatbibtex``, ``gitleaks`` and ``meta``.
|
|
41
|
+
* Update dependencies: remove unused ``Shapely`` and add dependencies for new hooks.
|
|
42
|
+
* Add deptry config to track dependencies.
|
|
43
|
+
* Update package metadata: keywords, classifiers (python versions) and project URLs.
|
|
44
|
+
* Update package sdist files.
|
|
45
|
+
* The ``lsapy.core.formatting`` module has been added and contains ``repr`` formatting functions (issue `#55 <https://github.com/baptistehamon/lsapy/issues/55>`_, PR `#59 <https://github.com/baptistehamon/lsapy/pull/59>`_).
|
|
46
|
+
* `LSAPy` sample data management has been improved (issue `#60 <https://github.com/baptistehamon/lsapy/issues/60>`_, PR `#62 <https://github.com/baptistehamon/lsapy/pull/62>`_):
|
|
47
|
+
* `LSAPy` now uses `pooch` to fetch sample data.
|
|
48
|
+
* Old data files have been removed from the data folder, and the new climate data file has been added.
|
|
49
|
+
* A registry file has been added to store sample data file names, hashes and URLs.
|
|
50
|
+
* Aggregation functions have been moved to the `lsapy.core.aggregation` module (PR `#63 <https://github.com/baptistehamon/lsapy/pull/63>`_).
|
|
51
|
+
* A relaxed configuration of `mypy` has been added to the project (PR `#66 <https://github.com/baptistehamon/lsapy/pull/66>`_).
|
|
52
|
+
|
|
53
|
+
Bug fixes
|
|
54
|
+
^^^^^^^^^
|
|
55
|
+
* Fix issues with representations of ``SuitabilityFunction`` when no parameters are provided (issue `#61 <https://github.com/baptistehamon/lsapy/issues/61>`_, PR `#65 <https://github.com/baptistehamon/lsapy/pull/65>`_).
|
|
56
|
+
* Add `**kwargs` to `SuitabilityCriteria.compute` and `LandSuitabilityAnalysis.run` to allow handling Dask arrays (issue `#64 <https://github.com/baptistehamon/lsapy/issues/64>`_, PR `#65 <https://github.com/baptistehamon/lsapy/pull/65>`_).
|
|
57
|
+
* The codebase has been modified to improve typing and fix mypy errors (issue `#35 <https://github.com/baptistehamon/lsapy/issues/35>`_, PR `#66 <https://github.com/baptistehamon/lsapy/pull/66>`_).
|
|
58
|
+
|
|
5
59
|
v0.1.1 (2025-07-26)
|
|
6
60
|
-------------------
|
|
7
61
|
Contributor to this version: Baptiste Hamon (@baptistehamon).
|
|
@@ -32,7 +86,7 @@ Breaking changes
|
|
|
32
86
|
Internal changes
|
|
33
87
|
^^^^^^^^^^^^^^^^
|
|
34
88
|
* Templates for requesting new features, asking question and submitting PR have been added (issue `#11 <https://github.com/baptistehamon/lsapy/issues/11>`_, PR `#12 <https://github.com/baptistehamon/lsapy/pull/12>`_).
|
|
35
|
-
* The README has been updated to make links permanent and to add a docs badge (PR `#13 <https://github.com/baptistehamon/lsapy/pull/13>`_, PR `#15 <https://github.com/baptistehamon/lsapy/pull/15>`).
|
|
89
|
+
* The README has been updated to make links permanent and to add a docs badge (PR `#13 <https://github.com/baptistehamon/lsapy/pull/13>`_, PR `#15 <https://github.com/baptistehamon/lsapy/pull/15>`_).
|
|
36
90
|
* A configuration file for Zenodo integration has been added to the repository (PR `#14 <https://github.com/baptistehamon/lsapy/pull/14>`_).
|
|
37
91
|
* `Pre-commit` has been setup and `ruff`, `codespell` and `numpydoc` hooks have been added (issue `#8 <https://github.com/baptistehamon/lsapy/issues/8>`_, PR `#18 <https://github.com/baptistehamon/lsapy/pull/18>`_/PR `#19 <https://github.com/baptistehamon/lsapy/pull/19>`_).
|
|
38
92
|
* The autoupdate schedule of `pre-commit` has been set to weekly (PR `#21 <https://github.com/baptistehamon/lsapy/pull/21>`_)
|
|
@@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
|
|
|
17
17
|
Examples of behavior that contributes to a positive environment for our
|
|
18
18
|
community include:
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
- Demonstrating empathy and kindness toward other people
|
|
21
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
- Giving and gracefully accepting constructive feedback
|
|
23
|
+
- Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
24
|
and learning from the experience
|
|
25
|
-
|
|
25
|
+
- Focusing on what is best not just for us as individuals, but for the overall
|
|
26
26
|
community
|
|
27
27
|
|
|
28
28
|
Examples of unacceptable behavior include:
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
- The use of sexualized language or imagery, and sexual attention or advances of
|
|
31
31
|
any kind
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
33
|
+
- Public or private harassment
|
|
34
|
+
- Publishing others' private information, such as a physical or email address,
|
|
35
35
|
without their explicit permission
|
|
36
|
-
|
|
36
|
+
- Other conduct which could reasonably be considered inappropriate in a
|
|
37
37
|
professional setting
|
|
38
38
|
|
|
39
39
|
## Enforcement Responsibilities
|
|
@@ -118,14 +118,14 @@ version 2.1, available at
|
|
|
118
118
|
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
|
119
119
|
|
|
120
120
|
Community Impact Guidelines were inspired by
|
|
121
|
-
[Mozilla's code of conduct enforcement ladder][
|
|
121
|
+
[Mozilla's code of conduct enforcement ladder][mozilla coc].
|
|
122
122
|
|
|
123
123
|
For answers to common questions about this code of conduct, see the FAQ at
|
|
124
|
-
[https://www.contributor-covenant.org/faq][
|
|
124
|
+
[https://www.contributor-covenant.org/faq][faq]. Translations are available at
|
|
125
125
|
[https://www.contributor-covenant.org/translations][translations].
|
|
126
126
|
|
|
127
|
+
[faq]: https://www.contributor-covenant.org/faq
|
|
127
128
|
[homepage]: https://www.contributor-covenant.org
|
|
128
|
-
[
|
|
129
|
-
[Mozilla CoC]: https://github.com/mozilla/diversity
|
|
130
|
-
[FAQ]: https://www.contributor-covenant.org/faq
|
|
129
|
+
[mozilla coc]: https://github.com/mozilla/diversity
|
|
131
130
|
[translations]: https://www.contributor-covenant.org/translations
|
|
131
|
+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
|
@@ -50,20 +50,45 @@ Below is the steps to follow for contributing to the project.
|
|
|
50
50
|
# To run pre-commit hooks manually:
|
|
51
51
|
pre-commit run --all-files
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
This will automatically format your code and fix any linting issues.
|
|
54
|
+
Instead of ``pre-commit``, you can check your changes using `nox`:
|
|
55
|
+
|
|
56
|
+
.. code-block:: shell
|
|
57
|
+
|
|
58
|
+
nox -s lint # to run all linters and formatters
|
|
59
|
+
|
|
60
|
+
Or check individual hooks manually:
|
|
54
61
|
|
|
55
62
|
.. code-block:: shell
|
|
56
63
|
|
|
57
64
|
ruff check --fix --show-fixes src/lsapy/
|
|
58
65
|
ruff format src/lsapy/
|
|
66
|
+
codespell src/lsapy/ tests/ docs/
|
|
67
|
+
numpydoc src/lsapy/**/*.py
|
|
59
68
|
|
|
60
|
-
|
|
69
|
+
#. The next step is to ensure your changes do not introduce any breaking issues using ``pytest``:
|
|
70
|
+
|
|
71
|
+
.. code-block:: shell
|
|
72
|
+
|
|
73
|
+
pytest --nbval docs/notebooks/ # for only notebooks
|
|
74
|
+
pytest --doctest-modules src/lsapy/ # for only doctests
|
|
75
|
+
pytest # for all unit tests, excluding doctests and notebooks.
|
|
76
|
+
|
|
77
|
+
Alternatively, you can run all tests using `nox`:
|
|
78
|
+
|
|
79
|
+
.. code-block:: shell
|
|
80
|
+
|
|
81
|
+
nox -s tests # for all unit tests, excluding doctests and notebooks
|
|
82
|
+
nox -s notebooks doctests # for notebooks and doctests
|
|
83
|
+
nox # to run all unit tests, doctests, and notebooks
|
|
61
84
|
|
|
62
|
-
#.
|
|
85
|
+
#. Finally, you need to make sure that the documentation will build correctly on ReadTheDocs. You can do this as follows:
|
|
63
86
|
|
|
64
87
|
.. code-block:: shell
|
|
65
88
|
|
|
66
|
-
|
|
89
|
+
make -C docs html
|
|
90
|
+
# or
|
|
91
|
+
nox -s docs
|
|
67
92
|
|
|
68
93
|
#. Commit your changes and push your branch.
|
|
69
94
|
|
|
@@ -1,40 +1,54 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: lsapy
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: A Python package for Land Suitability Analysis.
|
|
5
|
-
Keywords: LSAPy,Land Suitability Analysis,
|
|
5
|
+
Keywords: LSAPy,Land Suitability Analysis,Geospatial Analysis,GIS,Geography
|
|
6
6
|
Author-email: Baptiste Hamon <baptiste.hamon@pg.canterbury.ac.nz>
|
|
7
7
|
Maintainer-email: Baptiste Hamon <baptiste.hamon@pg.canterbury.ac.nz>
|
|
8
8
|
Requires-Python: >=3.10
|
|
9
9
|
Description-Content-Type: text/x-rst
|
|
10
|
-
Classifier: Development Status ::
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
11
|
Classifier: Intended Audience :: Developers
|
|
12
12
|
Classifier: Intended Audience :: Science/Research
|
|
13
13
|
Classifier: Natural Language :: English
|
|
14
|
-
Classifier: Programming Language :: Python :: 3
|
|
15
14
|
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
20
|
Classifier: Topic :: Scientific/Engineering :: GIS
|
|
17
21
|
License-File: LICENSE
|
|
18
22
|
Requires-Dist: geopandas >=0.14.0
|
|
19
23
|
Requires-Dist: numpy >=1.26.0
|
|
20
24
|
Requires-Dist: pandas >=2.2.0
|
|
25
|
+
Requires-Dist: pooch >=1.8.2
|
|
21
26
|
Requires-Dist: regionmask >=0.13.0
|
|
22
27
|
Requires-Dist: scipy >=1.15.0
|
|
23
|
-
Requires-Dist: Shapely >=2.0.0
|
|
24
28
|
Requires-Dist: xarray >=2024.10.0
|
|
25
29
|
Requires-Dist: lsapy[dev] ; extra == "all"
|
|
26
30
|
Requires-Dist: lsapy[docs] ; extra == "all"
|
|
31
|
+
Requires-Dist: blackdoc >=0.3.9 ; extra == "dev"
|
|
27
32
|
Requires-Dist: bump-my-version >=1.1.4 ; extra == "dev"
|
|
28
33
|
Requires-Dist: codespell >=2.4.1 ; extra == "dev"
|
|
34
|
+
Requires-Dist: coverage[toml] >=7.7.0 ; extra == "dev"
|
|
29
35
|
Requires-Dist: flit >=3.11 ; extra == "dev"
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist: ipython >=
|
|
36
|
+
Requires-Dist: h5netcdf >=1.4.0 ; extra == "dev"
|
|
37
|
+
Requires-Dist: ipython >=8.20.0 ; extra == "dev"
|
|
32
38
|
Requires-Dist: matplotlib >=3.9.0 ; extra == "dev"
|
|
39
|
+
Requires-Dist: mypy >=1.17.1 ; extra == "dev"
|
|
40
|
+
Requires-Dist: nbval >=0.11.0 ; extra == "dev"
|
|
41
|
+
Requires-Dist: nox >=2024.10.09 ; extra == "dev"
|
|
33
42
|
Requires-Dist: numpydoc >=1.8.0 ; extra == "dev"
|
|
34
43
|
Requires-Dist: pre-commit >=4.0.0 ; extra == "dev"
|
|
35
44
|
Requires-Dist: pytest >=8.3.0 ; extra == "dev"
|
|
45
|
+
Requires-Dist: pytest-cov >=6.0.0 ; extra == "dev"
|
|
36
46
|
Requires-Dist: ruff >=0.10.0 ; extra == "dev"
|
|
47
|
+
Requires-Dist: vulture >=2.14 ; extra == "dev"
|
|
37
48
|
Requires-Dist: xclim >=0.54.0 ; extra == "dev"
|
|
49
|
+
Requires-Dist: yamllint >=1.37.1 ; extra == "dev"
|
|
50
|
+
Requires-Dist: ipykernel ; extra == "docs"
|
|
51
|
+
Requires-Dist: matplotlib >=3.9.0 ; extra == "docs"
|
|
38
52
|
Requires-Dist: nbsphinx >=0.9.5 ; extra == "docs"
|
|
39
53
|
Requires-Dist: pybtex >=0.24.0 ; extra == "docs"
|
|
40
54
|
Requires-Dist: pydata-sphinx-theme >=0.16.0 ; extra == "docs"
|
|
@@ -43,8 +57,10 @@ Requires-Dist: sphinx-autodoc-typehints >=3.2.0 ; extra == "docs"
|
|
|
43
57
|
Requires-Dist: sphinx-copybutton ; extra == "docs"
|
|
44
58
|
Requires-Dist: sphinx-mdinclude ; extra == "docs"
|
|
45
59
|
Requires-Dist: sphinxcontrib-bibtex >=2.6.0 ; extra == "docs"
|
|
46
|
-
Project-URL: Homepage, https://
|
|
60
|
+
Project-URL: Homepage, https://lsapy.readthedocs.io/en/stable/
|
|
47
61
|
Project-URL: Issues, https://github.com/baptistehamon/lsapy/issues
|
|
62
|
+
Project-URL: Source, https://github.com/baptistehamon/lsapy
|
|
63
|
+
Project-URL: Zenodo, https://doi.org/10.5281/zenodo.15015110
|
|
48
64
|
Provides-Extra: all
|
|
49
65
|
Provides-Extra: dev
|
|
50
66
|
Provides-Extra: docs
|
|
@@ -58,7 +74,7 @@ Provides-Extra: docs
|
|
|
58
74
|
|
|
59
75
|
LSAPy: Land Suitability Analysis in Python
|
|
60
76
|
===========================================
|
|
61
|
-
|pypi| |status| |ruff| |pre-commit| |docs| |question| |zenodo|
|
|
77
|
+
|pypi| |python-versions| |status| |testing| |coverage| |ruff| |pre-commit| |docs| |question| |zenodo|
|
|
62
78
|
|
|
63
79
|
`LSAPy` stands for Land Suitability Analysis (LSA) in Python. Its objective is to make conducting
|
|
64
80
|
LSA in Python easier and more accessible to users. It provides a set of objects built around
|
|
@@ -84,23 +100,28 @@ You can now perform your LSA:
|
|
|
84
100
|
|
|
85
101
|
# define your criteria
|
|
86
102
|
criteria = {
|
|
87
|
-
|
|
88
|
-
name=
|
|
89
|
-
indicator=
|
|
90
|
-
func=SuitabilityFunction(
|
|
103
|
+
"crit1": SuitabilityCriteria(
|
|
104
|
+
name="criteria1",
|
|
105
|
+
indicator=indicator1, # xarray object
|
|
106
|
+
func=SuitabilityFunction(
|
|
107
|
+
name="function_name", params={"param1": value1, "param2": value2}
|
|
108
|
+
),
|
|
109
|
+
),
|
|
110
|
+
"crit2": SuitabilityCriteria(
|
|
111
|
+
name="criteria2",
|
|
112
|
+
indicator=indicator2, # xarray object
|
|
113
|
+
func=SuitabilityFunction(
|
|
114
|
+
name="another_function_name",
|
|
115
|
+
params={"param1": value1, "param2": value2},
|
|
116
|
+
),
|
|
91
117
|
),
|
|
92
|
-
'crit2': SuitabilityCriteria(
|
|
93
|
-
name='criteria2',
|
|
94
|
-
indicator= indicator2, # xarray object
|
|
95
|
-
func= SuitabilityFunction(name="another_function_name", params={'param1': value1, 'param2': value2})
|
|
96
|
-
)
|
|
97
118
|
# add all necessary criteria
|
|
98
119
|
}
|
|
99
120
|
|
|
100
121
|
# define your land suitability
|
|
101
122
|
lsa = LandSuitabilityAnalysis(
|
|
102
|
-
land_use=
|
|
103
|
-
criteria=
|
|
123
|
+
land_use="land_use_name",
|
|
124
|
+
criteria=criteria,
|
|
104
125
|
)
|
|
105
126
|
|
|
106
127
|
# run your analysis
|
|
@@ -161,9 +182,9 @@ The Python package has been created following the `pyOpenSci Guidebook`_.
|
|
|
161
182
|
:target: https://pypi.python.org/pypi/lsapy
|
|
162
183
|
:alt: Python Package Index Build
|
|
163
184
|
|
|
164
|
-
.. |status| image:: https://www.repostatus.org/badges/latest/
|
|
165
|
-
:target: https://www.repostatus.org/#
|
|
166
|
-
:alt: Project Status:
|
|
185
|
+
.. |status| image:: https://www.repostatus.org/badges/latest/active.svg
|
|
186
|
+
:target: https://www.repostatus.org/#active
|
|
187
|
+
:alt: Project Status: Active - The project has reached a stable, usable state and is being actively developed.
|
|
167
188
|
|
|
168
189
|
.. |zenodo| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.15015111.svg
|
|
169
190
|
:target: https://doi.org/10.5281/zenodo.15015111
|
|
@@ -185,3 +206,15 @@ The Python package has been created following the `pyOpenSci Guidebook`_.
|
|
|
185
206
|
:target: https://results.pre-commit.ci/latest/github/baptistehamon/lsapy/main
|
|
186
207
|
:alt: pre-commit.ci status
|
|
187
208
|
|
|
209
|
+
.. |testing| image:: https://github.com/baptistehamon/lsapy/actions/workflows/testing.yml/badge.svg
|
|
210
|
+
:target: https://github.com/baptistehamon/lsapy/actions/workflows/testing.yml
|
|
211
|
+
:alt: Testing Status
|
|
212
|
+
|
|
213
|
+
.. |coverage| image:: https://coveralls.io/repos/github/baptistehamon/lsapy/badge.svg
|
|
214
|
+
:target: https://coveralls.io/github/baptistehamon/lsapy
|
|
215
|
+
:alt: Coverage Status (Coveralls)
|
|
216
|
+
|
|
217
|
+
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/lsapy
|
|
218
|
+
:target: https://pypi.python.org/pypi/lsapy
|
|
219
|
+
:alt: Supported Python Versions
|
|
220
|
+
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
|
|
8
8
|
LSAPy: Land Suitability Analysis in Python
|
|
9
9
|
===========================================
|
|
10
|
-
|pypi| |status| |ruff| |pre-commit| |docs| |question| |zenodo|
|
|
10
|
+
|pypi| |python-versions| |status| |testing| |coverage| |ruff| |pre-commit| |docs| |question| |zenodo|
|
|
11
11
|
|
|
12
12
|
`LSAPy` stands for Land Suitability Analysis (LSA) in Python. Its objective is to make conducting
|
|
13
13
|
LSA in Python easier and more accessible to users. It provides a set of objects built around
|
|
@@ -33,23 +33,28 @@ You can now perform your LSA:
|
|
|
33
33
|
|
|
34
34
|
# define your criteria
|
|
35
35
|
criteria = {
|
|
36
|
-
|
|
37
|
-
name=
|
|
38
|
-
indicator=
|
|
39
|
-
func=SuitabilityFunction(
|
|
36
|
+
"crit1": SuitabilityCriteria(
|
|
37
|
+
name="criteria1",
|
|
38
|
+
indicator=indicator1, # xarray object
|
|
39
|
+
func=SuitabilityFunction(
|
|
40
|
+
name="function_name", params={"param1": value1, "param2": value2}
|
|
41
|
+
),
|
|
42
|
+
),
|
|
43
|
+
"crit2": SuitabilityCriteria(
|
|
44
|
+
name="criteria2",
|
|
45
|
+
indicator=indicator2, # xarray object
|
|
46
|
+
func=SuitabilityFunction(
|
|
47
|
+
name="another_function_name",
|
|
48
|
+
params={"param1": value1, "param2": value2},
|
|
49
|
+
),
|
|
40
50
|
),
|
|
41
|
-
'crit2': SuitabilityCriteria(
|
|
42
|
-
name='criteria2',
|
|
43
|
-
indicator= indicator2, # xarray object
|
|
44
|
-
func= SuitabilityFunction(name="another_function_name", params={'param1': value1, 'param2': value2})
|
|
45
|
-
)
|
|
46
51
|
# add all necessary criteria
|
|
47
52
|
}
|
|
48
53
|
|
|
49
54
|
# define your land suitability
|
|
50
55
|
lsa = LandSuitabilityAnalysis(
|
|
51
|
-
land_use=
|
|
52
|
-
criteria=
|
|
56
|
+
land_use="land_use_name",
|
|
57
|
+
criteria=criteria,
|
|
53
58
|
)
|
|
54
59
|
|
|
55
60
|
# run your analysis
|
|
@@ -110,9 +115,9 @@ The Python package has been created following the `pyOpenSci Guidebook`_.
|
|
|
110
115
|
:target: https://pypi.python.org/pypi/lsapy
|
|
111
116
|
:alt: Python Package Index Build
|
|
112
117
|
|
|
113
|
-
.. |status| image:: https://www.repostatus.org/badges/latest/
|
|
114
|
-
:target: https://www.repostatus.org/#
|
|
115
|
-
:alt: Project Status:
|
|
118
|
+
.. |status| image:: https://www.repostatus.org/badges/latest/active.svg
|
|
119
|
+
:target: https://www.repostatus.org/#active
|
|
120
|
+
:alt: Project Status: Active - The project has reached a stable, usable state and is being actively developed.
|
|
116
121
|
|
|
117
122
|
.. |zenodo| image:: https://zenodo.org/badge/DOI/10.5281/zenodo.15015111.svg
|
|
118
123
|
:target: https://doi.org/10.5281/zenodo.15015111
|
|
@@ -133,3 +138,15 @@ The Python package has been created following the `pyOpenSci Guidebook`_.
|
|
|
133
138
|
.. |pre-commit| image:: https://results.pre-commit.ci/badge/github/baptistehamon/lsapy/main.svg
|
|
134
139
|
:target: https://results.pre-commit.ci/latest/github/baptistehamon/lsapy/main
|
|
135
140
|
:alt: pre-commit.ci status
|
|
141
|
+
|
|
142
|
+
.. |testing| image:: https://github.com/baptistehamon/lsapy/actions/workflows/testing.yml/badge.svg
|
|
143
|
+
:target: https://github.com/baptistehamon/lsapy/actions/workflows/testing.yml
|
|
144
|
+
:alt: Testing Status
|
|
145
|
+
|
|
146
|
+
.. |coverage| image:: https://coveralls.io/repos/github/baptistehamon/lsapy/badge.svg
|
|
147
|
+
:target: https://coveralls.io/github/baptistehamon/lsapy
|
|
148
|
+
:alt: Coverage Status (Coveralls)
|
|
149
|
+
|
|
150
|
+
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/lsapy
|
|
151
|
+
:target: https://pypi.python.org/pypi/lsapy
|
|
152
|
+
:alt: Supported Python Versions
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
Hexadecimal code of colors used in *LSAPy* logos.
|
|
6
6
|
|
|
7
|
-
| Color
|
|
8
|
-
| ------ | :--------:
|
|
9
|
-
| Green
|
|
7
|
+
| Color | Light | Dark |
|
|
8
|
+
| ------ | :--------: | :---------: |
|
|
9
|
+
| Green | #91a646ff | #6f8036ff |
|
|
10
10
|
| Yellow | #f2c12eff | #cca327ff |
|
|
11
11
|
| Orange | #e58004ff | #bf6b03ff |
|
|
12
|
-
| Blue
|
|
13
|
-
| Red
|
|
14
|
-
| Sand
|
|
12
|
+
| Blue | #7aadccff | #638da6ff |
|
|
13
|
+
| Red | #d91818ff | #b21414ff |
|
|
14
|
+
| Sand | #f2e6cdff | #ccc2adff |
|
|
15
15
|
| *Text* | #ffffffff | #364d5aff |
|
|
16
16
|
|
|
17
17
|
## Typeface
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
{
|
|
2
|
+
"cells": [
|
|
3
|
+
{
|
|
4
|
+
"cell_type": "markdown",
|
|
5
|
+
"metadata": {},
|
|
6
|
+
"source": [
|
|
7
|
+
"# Suitability Criteria\n",
|
|
8
|
+
"\n",
|
|
9
|
+
"> **NOTE:** If you are not familiar with the different suitability functions and how to use them, we recommend you start with the Suitability Functions [tutorial](functions.ipynb), which provides an overview of the available functions and their usage.\n",
|
|
10
|
+
"\n",
|
|
11
|
+
"`SuitabilityCriteria` is used to defined a criteria, set its associated indicator, and described how its suitability is computed. It has the following attributes:\n",
|
|
12
|
+
"- name: criteria name\n",
|
|
13
|
+
"- indicator: input data to compute suitability\n",
|
|
14
|
+
"- func (`SuitabilityFunction`): suitability function to use\n",
|
|
15
|
+
"- weight (default=1): criteria weight used when computing land suitability\n",
|
|
16
|
+
"- category (optional): criteria category allowing to compute land suitability for different category (e.g., climate, soil...)\n",
|
|
17
|
+
"- long_name: criteria long name\n",
|
|
18
|
+
"- description: description of the criteria\n",
|
|
19
|
+
"- comment: additional information\n",
|
|
20
|
+
"- is_computed (bool, default=False): specify if the indicator data already corresponds to it's suitability.\n",
|
|
21
|
+
"\n",
|
|
22
|
+
"Below is an example using *LSAPy* `open_data` utility function to download and open sample data:"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"cell_type": "code",
|
|
27
|
+
"execution_count": null,
|
|
28
|
+
"metadata": {},
|
|
29
|
+
"outputs": [],
|
|
30
|
+
"source": [
|
|
31
|
+
"from lsapy import SuitabilityCriteria, SuitabilityFunction\n",
|
|
32
|
+
"from lsapy.utils import open_data\n",
|
|
33
|
+
"\n",
|
|
34
|
+
"potential_rooting_depth = open_data(\"land\", variables=\"potential_rooting_depth\")\n",
|
|
35
|
+
"\n",
|
|
36
|
+
"sc = SuitabilityCriteria(\n",
|
|
37
|
+
" name=\"potential_root_depth\",\n",
|
|
38
|
+
" long_name=\"Potential Rooting Depth Suitability\",\n",
|
|
39
|
+
" indicator=potential_rooting_depth,\n",
|
|
40
|
+
" func=SuitabilityFunction(name=\"vetharaniam2022_eq5\", params={\"a\": -11.98, \"b\": 0.459}),\n",
|
|
41
|
+
")"
|
|
42
|
+
]
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
"cell_type": "markdown",
|
|
46
|
+
"metadata": {},
|
|
47
|
+
"source": [
|
|
48
|
+
"We can now compute the suitability of the criteria and plot the result."
|
|
49
|
+
]
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
"cell_type": "code",
|
|
53
|
+
"execution_count": null,
|
|
54
|
+
"metadata": {},
|
|
55
|
+
"outputs": [],
|
|
56
|
+
"source": [
|
|
57
|
+
"import matplotlib.pyplot as plt\n",
|
|
58
|
+
"\n",
|
|
59
|
+
"prd = sc.compute()\n",
|
|
60
|
+
"\n",
|
|
61
|
+
"fig, ax = plt.subplots(1, 2, figsize=(12, 4))\n",
|
|
62
|
+
"potential_rooting_depth.plot(ax=ax[0])\n",
|
|
63
|
+
"prd.plot(ax=ax[1], vmin=0, vmax=1)\n",
|
|
64
|
+
"plt.show()"
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"cell_type": "markdown",
|
|
69
|
+
"metadata": {},
|
|
70
|
+
"source": [
|
|
71
|
+
"Let's see another example with climate data. We use `xclim` package to calculate the total annual precipition and use this latter as criteria indicator."
|
|
72
|
+
]
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"cell_type": "code",
|
|
76
|
+
"execution_count": null,
|
|
77
|
+
"metadata": {},
|
|
78
|
+
"outputs": [],
|
|
79
|
+
"source": [
|
|
80
|
+
"from xclim.indicators.atmos import precip_accumulation\n",
|
|
81
|
+
"\n",
|
|
82
|
+
"precip = open_data(\"climate\", variables=\"pr\")\n",
|
|
83
|
+
"\n",
|
|
84
|
+
"prtot = precip_accumulation(precip, freq=\"YS\") # YS: Year Start frequency\n",
|
|
85
|
+
"\n",
|
|
86
|
+
"sc = SuitabilityCriteria(\n",
|
|
87
|
+
" name=\"water_requirements\",\n",
|
|
88
|
+
" long_name=\"Annual Rainfall Requirement Suitability\",\n",
|
|
89
|
+
" indicator=prtot,\n",
|
|
90
|
+
" func=SuitabilityFunction(name=\"vetharaniam2022_eq5\", params={\"a\": 0.876, \"b\": 1248}),\n",
|
|
91
|
+
")"
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"cell_type": "code",
|
|
96
|
+
"execution_count": null,
|
|
97
|
+
"metadata": {},
|
|
98
|
+
"outputs": [],
|
|
99
|
+
"source": [
|
|
100
|
+
"water_req = sc.compute()\n",
|
|
101
|
+
"\n",
|
|
102
|
+
"fig, ax = plt.subplots(1, 2, figsize=(12, 4))\n",
|
|
103
|
+
"prtot.isel(time=0).plot(ax=ax[0]) # use first year of data as example\n",
|
|
104
|
+
"water_req.isel(time=0).plot(ax=ax[1], vmin=0, vmax=1)\n",
|
|
105
|
+
"plt.show()"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
],
|
|
109
|
+
"metadata": {
|
|
110
|
+
"language_info": {
|
|
111
|
+
"codemirror_mode": {
|
|
112
|
+
"name": "ipython",
|
|
113
|
+
"version": 3
|
|
114
|
+
},
|
|
115
|
+
"file_extension": ".py",
|
|
116
|
+
"mimetype": "text/x-python",
|
|
117
|
+
"name": "python",
|
|
118
|
+
"nbconvert_exporter": "python",
|
|
119
|
+
"pygments_lexer": "ipython3",
|
|
120
|
+
"version": "3.12.7"
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
"nbformat": 4,
|
|
124
|
+
"nbformat_minor": 2
|
|
125
|
+
}
|