lulc-validation


Namelulc-validation JSON
Version 0.0.4 PyPI version JSON
download
home_page
SummaryLULC accuracy assessment with reference data generated via stratified sampling
upload_time2023-09-15 06:13:43
maintainer
docs_urlNone
authorJohn Duncan
requires_python>=3.9
license
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # lulc-validation

A package to estimate overall accuracy, user's accuracy, and producer's accuracy for a land use / land cover (LULC) map when i) the reference data is generated via a stratified sampling approach, and ii) the strata do not match the map classes. 

This package is based on [Stehman, S.V. (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207), Estimating area and map accuracy for stratified random sampling when the strata are different from the map classes. *International Journal of Remote Sensing*, 35, 13.

## Install

Clone this repo, then pip install locally. 

```
pip install .
```

or from PyPi.

```
pip install lulc-validation
```

## Use

A sample dataset is provided in this repo at `data/samples.csv`. This is based on Table. 2 in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).

Initialise a `StratVal` object:

```
import pandas as pd
import os
from lulc_validation.lulc_val import StratVal

df = pd.read_csv(os.path.join("data", "samples.csv"))

strat_val = StratVal(
    strata_list=[1, 2, 3, 4], # List of labels for strata.
    class_list=[1, 2, 3, 4], # List of labels for LULC map classes.
    n_strata=[40000, 30000, 20000, 10000], # List of the total number of pixels in each strata.
    samples_df=df, # pandas DataFrame of reference data
    strata_col="stratum", # Column label for strata in `samples_df`
    ref_class="ref_class", # Column label for reference classes in `samples_df`
    map_class="map_class" # Column label for map classes in `samples_df`
)
```

A `StratVal` object has the following methods:

* `accuracy()`: returns a float type number representing the overall accuracy of the LULC map accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).
* `users_accuracy()`: returns a dict object where keys indicate the map class and values represent user's accuracy for the corresponding class accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).
* `producers_accuracy()`: returns a dict object where keys indicate the map class and values represent producer's accuracy for the corresponding class accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).
* `accuracy_se()`: returns the standard error of the estimate of the overall accuracy of the LULC map accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).
* `users_accuracy_se()`: returns a dict object where keys indicate the map class and values represent standard errors of the estimates of the user's accuracy for the corresponding class accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).
* `producers_accuracy_se()`: returns a dict object where keys indicate the map class and values represent standard errors of the estimates of the producer's accuracy for the corresponding class accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).

```
print(f"accuracy: {strat_val.accuracy()}")
print(f"user's accuracy: {strat_val.users_accuracy()}")
print(f"producer's accuracy: {strat_val.producers_accuracy()}")
print(f"accuracy se: {strat_val.accuracy_se()}")
print(f"user's accuracy se: {strat_val.users_accuracy_se()}")
print(f"producers's accuracy se: {strat_val.producers_accuracy_se()}")
```

## Development

pytest is used for testing and tests are based on replicating calculations in the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).

To run the tests:

```
pytest
``` 

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "lulc-validation",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": "",
    "keywords": "",
    "author": "John Duncan",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/56/93/fec1231d178271504220bb08c840e5d6cebefedbb58dda795ea9afc7d354/lulc-validation-0.0.4.tar.gz",
    "platform": null,
    "description": "# lulc-validation\n\nA package to estimate overall accuracy, user's accuracy, and producer's accuracy for a land use / land cover (LULC) map when i) the reference data is generated via a stratified sampling approach, and ii) the strata do not match the map classes. \n\nThis package is based on [Stehman, S.V. (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207), Estimating area and map accuracy for stratified random sampling when the strata are different from the map classes. *International Journal of Remote Sensing*, 35, 13.\n\n## Install\n\nClone this repo, then pip install locally. \n\n```\npip install .\n```\n\nor from PyPi.\n\n```\npip install lulc-validation\n```\n\n## Use\n\nA sample dataset is provided in this repo at `data/samples.csv`. This is based on Table. 2 in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).\n\nInitialise a `StratVal` object:\n\n```\nimport pandas as pd\nimport os\nfrom lulc_validation.lulc_val import StratVal\n\ndf = pd.read_csv(os.path.join(\"data\", \"samples.csv\"))\n\nstrat_val = StratVal(\n    strata_list=[1, 2, 3, 4], # List of labels for strata.\n    class_list=[1, 2, 3, 4], # List of labels for LULC map classes.\n    n_strata=[40000, 30000, 20000, 10000], # List of the total number of pixels in each strata.\n    samples_df=df, # pandas DataFrame of reference data\n    strata_col=\"stratum\", # Column label for strata in `samples_df`\n    ref_class=\"ref_class\", # Column label for reference classes in `samples_df`\n    map_class=\"map_class\" # Column label for map classes in `samples_df`\n)\n```\n\nA `StratVal` object has the following methods:\n\n* `accuracy()`: returns a float type number representing the overall accuracy of the LULC map accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).\n* `users_accuracy()`: returns a dict object where keys indicate the map class and values represent user's accuracy for the corresponding class accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).\n* `producers_accuracy()`: returns a dict object where keys indicate the map class and values represent producer's accuracy for the corresponding class accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).\n* `accuracy_se()`: returns the standard error of the estimate of the overall accuracy of the LULC map accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).\n* `users_accuracy_se()`: returns a dict object where keys indicate the map class and values represent standard errors of the estimates of the user's accuracy for the corresponding class accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).\n* `producers_accuracy_se()`: returns a dict object where keys indicate the map class and values represent standard errors of the estimates of the producer's accuracy for the corresponding class accounting for the stratified sampling design of the reference data. This implementation is based on the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).\n\n```\nprint(f\"accuracy: {strat_val.accuracy()}\")\nprint(f\"user's accuracy: {strat_val.users_accuracy()}\")\nprint(f\"producer's accuracy: {strat_val.producers_accuracy()}\")\nprint(f\"accuracy se: {strat_val.accuracy_se()}\")\nprint(f\"user's accuracy se: {strat_val.users_accuracy_se()}\")\nprint(f\"producers's accuracy se: {strat_val.producers_accuracy_se()}\")\n```\n\n## Development\n\npytest is used for testing and tests are based on replicating calculations in the worked example of *3. Numerical examples* in [Stehman (2014)](https://www.tandfonline.com/doi/abs/10.1080/01431161.2014.930207).\n\nTo run the tests:\n\n```\npytest\n``` \n",
    "bugtrack_url": null,
    "license": "",
    "summary": "LULC accuracy assessment with reference data generated via stratified sampling",
    "version": "0.0.4",
    "project_urls": null,
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "451b6ce400ccff57791adeda6811b2080903b2e73f10eed7374be8cf76f4ccfd",
                "md5": "e4612773025380295bb82539a7560c32",
                "sha256": "30fc75c6c894aa30ce75b1bf40900b075bbc229875e1530da83487ce5c523943"
            },
            "downloads": -1,
            "filename": "lulc_validation-0.0.4-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e4612773025380295bb82539a7560c32",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 5251,
            "upload_time": "2023-09-15T06:13:41",
            "upload_time_iso_8601": "2023-09-15T06:13:41.751626Z",
            "url": "https://files.pythonhosted.org/packages/45/1b/6ce400ccff57791adeda6811b2080903b2e73f10eed7374be8cf76f4ccfd/lulc_validation-0.0.4-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5693fec1231d178271504220bb08c840e5d6cebefedbb58dda795ea9afc7d354",
                "md5": "d692e927b32f611f21e2f120d699bdde",
                "sha256": "b0e040a7c52e790bd2637436c727d589c28b30f828b34ca9407836733db0a137"
            },
            "downloads": -1,
            "filename": "lulc-validation-0.0.4.tar.gz",
            "has_sig": false,
            "md5_digest": "d692e927b32f611f21e2f120d699bdde",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 5406,
            "upload_time": "2023-09-15T06:13:43",
            "upload_time_iso_8601": "2023-09-15T06:13:43.492044Z",
            "url": "https://files.pythonhosted.org/packages/56/93/fec1231d178271504220bb08c840e5d6cebefedbb58dda795ea9afc7d354/lulc-validation-0.0.4.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-15 06:13:43",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "lulc-validation"
}
        
Elapsed time: 0.16457s