openforis-whisp 3.0.0a6__tar.gz → 3.0.0a8__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/PKG-INFO +37 -120
  2. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/README.md +35 -119
  3. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/pyproject.toml +2 -1
  4. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/__init__.py +3 -1
  5. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/advanced_stats.py +213 -338
  6. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/data_checks.py +191 -144
  7. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/datasets.py +4 -5
  8. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/reformat.py +8 -6
  9. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/risk.py +113 -29
  10. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/stats.py +0 -9
  11. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/LICENSE +0 -0
  12. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/data_conversion.py +0 -0
  13. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/logger.py +0 -0
  14. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/parameters/__init__.py +0 -0
  15. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/parameters/config_runtime.py +0 -0
  16. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/parameters/lookup_context_and_metadata.csv +0 -0
  17. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/parameters/lookup_gaul1_admin.py +0 -0
  18. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/parameters/lookup_gee_datasets.csv +0 -0
  19. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/pd_schemas.py +0 -0
  20. {openforis_whisp-3.0.0a6 → openforis_whisp-3.0.0a8}/src/openforis_whisp/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: openforis-whisp
3
- Version: 3.0.0a6
3
+ Version: 3.0.0a8
4
4
  Summary: Whisp (What is in that plot) is an open-source solution which helps to produce relevant forest monitoring information and support compliance with deforestation-related regulations.
5
5
  License: MIT
6
6
  Keywords: whisp,geospatial,data-processing
@@ -29,6 +29,7 @@ Requires-Dist: pydantic-core (>=2.14.0,<3.0.0)
29
29
  Requires-Dist: python-dotenv (>=1.0.1,<2.0.0)
30
30
  Requires-Dist: rsa (>=4.2,<5.0.0)
31
31
  Requires-Dist: shapely (>=2.0.2,<3.0.0)
32
+ Project-URL: Changelog, https://github.com/forestdatapartnership/whisp/releases
32
33
  Project-URL: Documentation, https://github.com/forestdatapartnership/whisp#readme
33
34
  Project-URL: Development Branch, https://github.com/forestdatapartnership/whisp/tree/main
34
35
  Project-URL: Issues, https://github.com/forestdatapartnership/whisp/issues
@@ -62,6 +63,7 @@ Description-Content-Type: text/markdown
62
63
  - [Add data layers](#whisp_add_data)
63
64
  - [Contribute to the code](#whisp_contribute)
64
65
  - [Code of conduct](#whisp_conduct)
66
+ - [Feedback](#whisp_feedback)
65
67
 
66
68
  <br>
67
69
 
@@ -69,11 +71,11 @@ Description-Content-Type: text/markdown
69
71
  ***Whisp*** can currently be used directly or implemented in your own code through three different pathways:
70
72
 
71
73
 
72
- 1. The Whisp App with its simple interface can be used [right here](https://whisp.openforis.org/) or called from other software by [API](https://whisp.openforis.org/documentation/api-guide). The Whisp App currently supports the processing of up to 1000 geometries per job. The original JS & Python code behind the Whisp App and API can be found [here](https://github.com/forestdatapartnership/whisp-app).
74
+ 1. The Whisp App with its simple interface can be accessed [here](https://whisp.openforis.org/) or called from other software by [API](https://whisp.openforis.org/documentation/api-guide). The Whisp App currently supports the processing of up to 3,000 geometries per job. The original JS & Python code behind the Whisp App and API can be found [here](https://github.com/forestdatapartnership/whisp-app).
73
75
 
74
76
  2. [Whisp in Earthmap](https://whisp.earthmap.org/?aoi=WHISP&boundary=plot1&layers=%7B%22CocoaETH%22%3A%7B%22opacity%22%3A1%7D%2C%22JRCForestMask%22%3A%7B%22opacity%22%3A1%7D%2C%22planet_rgb%22%3A%7B%22opacity%22%3A1%2C%22date%22%3A%222020-12%22%7D%7D&map=%7B%22center%22%3A%7B%22lat%22%3A7%2C%22lng%22%3A4%7D%2C%22zoom%22%3A3%2C%22mapType%22%3A%22satellite%22%7D&statisticsOpen=true) supports the visualization of geometries on actual maps with the possibility to toggle different relevant map products around tree cover, commodities and deforestation. It is practical for demonstration purposes and spot checks of single geometries but not recommended for larger datasets.
75
77
 
76
- 3. Datasets of any size, especially when holding more than 1000 geometries, can be analyzed with Whisp through the [python package on pip](https://pypi.org/project/openforis-whisp/). See example [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/Colab_whisp_geojson_to_csv.ipynb) for implementation with a geojson input. For the detailed procedure please go to the section [Whisp notebooks](#whisp_notebooks).
78
+ 3. Datasets of any size, especially when holding more than 3,000 geometries, can be analyzed with Whisp through the [python package on pip](https://pypi.org/project/openforis-whisp/). See example [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/Colab_whisp_geojson_to_csv.ipynb) for implementation with a geojson input. For further notebooks processing options see [Whisp notebooks](#whisp_notebooks).
77
79
 
78
80
 
79
81
  ## Whisp datasets <a name="whisp_datasets"></a>
@@ -96,7 +98,7 @@ Additional categories are specific for the timber commodity, considering a harve
96
98
 
97
99
  There are multiple datasets for each category. Find the full current [list of datasets used in Whisp here](https://github.com/forestdatapartnership/whisp/blob/main/layers_description.md).
98
100
 
99
- ### Whisp risk assessment <a name="whisp_risk"></a>
101
+ ### Whisp risk assessment <a name="whisp_risk"></a>
100
102
 
101
103
  Whisp checks the plots provided by the user by running zonal statistics on them to answer the following questions:
102
104
 
@@ -153,24 +155,24 @@ The **relevant risk assessment column depends on the commodity** in question:
153
155
 
154
156
  *The Whisp algorithm for **Perennial Crops** visualized:*
155
157
  ![CoE_Graphic 5](https://github.com/user-attachments/assets/007b5f50-3939-4707-95fa-98be4d56745f)
156
-
158
+
157
159
  If no treecover dataset indicates any tree cover for a plot by the end of 2020, **Whisp will categorize the deforestation risk as low.**
158
160
 
159
161
  If one or more treecover datasets indicate tree cover on a plot by the end of 2020, but a commodity dataset indicates agricultural use by the end of 2020, **Whisp will categorize the deforestation risk as low.**
160
162
 
161
- If treecover datasets indicate tree cover on a plot by late 2020, no commodity datasets indicate agricultural use, but a disturbance dataset indicates disturbances before the end of 2020, **Whisp will categorize the deforestation risk as <u>low</u>.** Such deforestation has happened before 2020, which aligns with the cutoff date for legislation such as EUDR, and is therefore not considered high risk.
163
+ If treecover datasets indicate tree cover on a plot by late 2020, no commodity datasets indicate agricultural use, but a disturbance dataset indicates disturbances before the end of 2020, **Whisp will categorize the deforestation risk as <u>low</u>.** Such deforestation has happened before 2020, which aligns with the cutoff date for legislation, such as EUDR (European Union Deforestation Risk), and is therefore not considered high risk.
162
164
 
163
165
  Now, if the datasets under 1., 2. & 3. indicate that there was tree cover, but no agriculture and no disturbances before or by the end of 2020, the Whisp algorithm checks whether degradation or deforestation have been reported in a disturbance dataset after 2020-12-31. If they have, **Whisp will categorize the deforestation risk as <u>high</u>.** <br>
164
166
  However, under the same circumstances but with <u>no</u> disturbances reported after 2020-12-31 there is insufficient evidence and the **Whisp output will be "More info needed".** Such can be the case for, e.g., cocoa or coffee grown under the shade of treecover or agroforestry.
165
167
 
166
168
 
167
169
  ## Run Whisp python package from a notebook <a name="whisp_notebooks"></a>
168
-
170
+
169
171
  For most users we suggest using the Whisp App to process their plot data. But for some, using the python package directly will fit their workflow.
170
172
 
171
- A simple example of the package functionality can be seen in this [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/Colab_whisp_geojson_to_csv.ipynb)
173
+ An example of the package functionality can be seen in this [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/Colab_whisp_geojson_to_csv.ipynb)
172
174
 
173
- For an example notebook adapted for running locally (or in Sepal), see: [whisp_geojson_to_csv.ipynb](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/whisp_geojson_to_csv.ipynb) or if datasets are very large, see [whisp_geojson_to_drive.ipynb](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/whisp_geojson_to_drive.ipynb)
175
+ For running locally (or in Sepal), see: [whisp_geojson_to_csv.ipynb](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/whisp_geojson_to_csv.ipynb) or if datasets are very large (e.g., >100,000 features), see [whisp_ee_asset_to_drive.ipynb](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/whisp_ee_asset_to_drive.ipynb)
174
176
 
175
177
  ### Requirements for running the package
176
178
 
@@ -178,8 +180,6 @@ The **relevant risk assessment column depends on the commodity** in question:
178
180
  - A registered cloud GEE project.
179
181
  - Some experience in Python or a similar language.
180
182
 
181
- More info on Whisp can be found in [here](https://openknowledge.fao.org/items/e9284dc7-4b19-4f9c-b3e1-e6c142585865)
182
-
183
183
 
184
184
  ### Python package installation
185
185
 
@@ -193,7 +193,6 @@ The **relevant risk assessment column depends on the commodity** in question:
193
193
  pip install --pre openforis-whisp
194
194
  ```
195
195
 
196
- If running the package locally we recommend a [virtual environment](https://docs.python.org/3/library/venv.html) to keep your main python installation clean. For users running the package in Sepal see [here](https://docs.sepal.io/en/latest/cli/python.html#virtual-environment).
197
196
 
198
197
  The package relies upon the google earth engine api being setup correctly using a registered cloud project.
199
198
 
@@ -240,128 +239,46 @@ Before submitting a request, consider the following:
240
239
  ---
241
240
 
242
241
 
243
-
244
242
  ### Adding your own data directly
245
243
 
244
+ The python notebooks allow the user to add custom data layers. You can edit the Prepare layers section to do this in the [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/Colab_whisp_geojson_to_csv.ipynb)
245
+ To add your own data directly you will need some coding experience as well as familiarity with Google Earth Engine.
246
246
 
247
- To add your own data you will need some coding experience as well as familiarity with GitHub and Google Earth Engine.
248
-
249
- This approach is for those who want to run a bespoke analysis combining their own data with those already in Whisp.
250
-
251
- Firstly follow the steps below to install the package in editable mode.
252
-
253
- As with the regular pip installation, we recommend a separate [virtual environment](https://docs.python.org/3/library/venv.html) for running in editable mode. For Sepal users see [here](https://docs.sepal.io/en/latest/cli/python.html#virtual-environment).
254
-
255
- ```bash
256
-
257
- git clone https://github.com/forestdatapartnership/whisp.git
258
-
259
- cd whisp/
260
-
261
- pip install -e .[dev]
262
-
263
- ```
264
- Once in editable mode you are running the Whisp package locally based on a cloned version of the code.
265
-
266
-
267
-
268
- There are two files to edit to add your own data:
269
-
270
- - `src/openforis_whisp/datasets.py`
271
-
272
- - `src/openforis_whisp/parameters/lookup_gee_datasets.csv`
273
-
274
-
275
-
276
- The `datasets.py` file is a Python script that defines functions which return GEE images composed of one or more bands.
277
-
278
-
279
-
280
- #### To add your own dataset:
281
-
282
- 1. Add code to `datasets.py` in the form of a function that returns a **single-band binary image** for your dataset. See notes at the top of the file and example functions for formatting.
283
-
284
- 2. Edit the `lookup_gee_datasets.csv` and add a row for your dataset.
285
-
286
-
287
-
288
- **NB:** You need to know what the dataset represents and define how it will be used in the different risk decision trees (if at all).
289
-
290
- For example, if it is a dataset for tree cover in 2000, then add `'treecover'` under the `Theme` column.
291
-
292
-
293
-
294
- #### Example function in `datasets.py`:
295
-
296
-
297
-
298
- ```python
299
-
300
- def my_custom_dataset_prep():
301
-
302
- image = ee.Image("MY/GEE/DATASET")
303
-
304
- binary = image.gt(10) # Example threshold
305
-
306
- return binary.rename("My_custom_dataset")
307
-
308
- ```
309
-
310
-
311
-
312
- ---
313
-
314
-
315
- We are working on ways to make this process smoother. However, in the meantime do contact us through the [issues page on GitHub](https://github.com/forestdatapartnership/whisp/issues), or via the Open Foris email, if this functionality is useful to you or you need help.
316
-
317
-
318
-
319
- ---
320
-
321
-
322
-
323
- ## Contributing to the Whisp code base <a name="whisp_contribute"></a>
324
-
325
- Contributions to the Whisp code in GitHub are welcome. These could be additional functionality, datasets or just cleaner code! Contributions can be made by forking the repository, making and pushing the required changes, then making a pull request to the Whisp repository. After briefly reviewing the request, we can make a branch for which to make a new pull request to. After final checks, we can then incorporate the code into the main branch. If in doubt, get in contact first or log as an issue [here](https://github.com/forestdatapartnership/whisp/issues/).
326
-
327
-
328
- Install the package in editable mode (see Adding your own data directly above):
329
-
330
- Then add additional dependencies required for testing and running pre-commit hooks:
331
-
332
-
333
- ```bash
334
247
 
335
- pre-commit install
248
+ ## Contributing <a name="whisp_contribute"></a>
336
249
 
337
- ```
250
+ Contributions are welcome!
251
+ - Fork the repo, make changes, and open a pull request.
252
+ - For adding new datasets to the codebase and for project-specific coding standards see [.github/copilot-instructions.md](.github/copilot-instructions.md)
338
253
 
254
+ ## Code of Conduct <a name="whisp_conduct"></a>
339
255
 
340
- You should be able to run the Pytest suite by simply running the `pytest` command from the repo's root folder.
256
+ **Purpose**
257
+ We are dedicated to maintaining a safe and respectful environment for all users. Harassment or abusive behavior will not be tolerated. <br>
341
258
 
259
+ **Scope**
260
+ This Code applies to all interactions on the repository and on the app.
342
261
 
343
- Please read the [contributing guidelines](contributing_guidelines.md) for good practice recommendations
262
+ **Expectations** <br>
263
+ *- Respect others:* Treat all contributors and users with courtesy and kindness. <br>
264
+ *- Constructive communication:* Engage respectfully, even in disagreements. <br>
265
+ *- Protect privacy:* Do not share personal information without consent.
344
266
 
267
+ **Prohibited Conduct** <br>
268
+ *- Harassment:* Unwanted or abusive communication, stalking, threats, or bullying.<br>
269
+ *- Discrimination:* Any form of hate speech or exclusion based on race, gender, orientation, or other identities.<br>
270
+ *- Inappropriate Content:* Posting offensive, harmful, or explicit material.
345
271
 
346
- ## Code of Conduct <a name="whisp_conduct"></a>
272
+ **Reporting** <br>
273
+ Users can report violations of this Code of Conduct confidentially by contacting the Open Foris team at
274
+ [open-foris@fao.org](mailto:open-foris@fao.org).
347
275
 
348
- **Purpose**
349
- We are dedicated to maintaining a safe and respectful environment for all users. Harassment or abusive behavior will not be tolerated. <br>
350
276
 
351
- **Scope**
352
- This Code applies to all interactions on the repository and on the app.
277
+ ## Feedback <a name="whisp_feedback"></a>
278
+ - For issues or feature requests [open a GitHub issue](https://github.com/forestdatapartnership/whisp/issues).
279
+ - For general questions, feedback or support, email [open-foris@fao.org](mailto:open-foris@fao.org).
353
280
 
354
- **Expectations** <br>
355
- *- Respect others:* Treat all contributors and users with courtesy and kindness. <br>
356
- *- Constructive communication:* Engage respectfully, even in disagreements. <br>
357
- *- Protect privacy:* Do not share personal information without consent.
281
+ We welcome all feedback and contributions!
358
282
 
359
- **Prohibited Conduct** <br>
360
- *- Harassment:* Unwanted or abusive communication, stalking, threats, or bullying.<br>
361
- *- Discrimination:* Any form of hate speech or exclusion based on race, gender, orientation, or other identities.<br>
362
- *- Inappropriate Content:* Posting offensive, harmful, or explicit material.
363
283
 
364
- **Reporting**
365
- Users can report violations directly to us by emailing the address listed in the "Contact Us" section of the website:
366
- https://openforis.org/solutions/whisp/
367
284
 
@@ -25,6 +25,7 @@
25
25
  - [Add data layers](#whisp_add_data)
26
26
  - [Contribute to the code](#whisp_contribute)
27
27
  - [Code of conduct](#whisp_conduct)
28
+ - [Feedback](#whisp_feedback)
28
29
 
29
30
  <br>
30
31
 
@@ -32,11 +33,11 @@
32
33
  ***Whisp*** can currently be used directly or implemented in your own code through three different pathways:
33
34
 
34
35
 
35
- 1. The Whisp App with its simple interface can be used [right here](https://whisp.openforis.org/) or called from other software by [API](https://whisp.openforis.org/documentation/api-guide). The Whisp App currently supports the processing of up to 1000 geometries per job. The original JS & Python code behind the Whisp App and API can be found [here](https://github.com/forestdatapartnership/whisp-app).
36
+ 1. The Whisp App with its simple interface can be accessed [here](https://whisp.openforis.org/) or called from other software by [API](https://whisp.openforis.org/documentation/api-guide). The Whisp App currently supports the processing of up to 3,000 geometries per job. The original JS & Python code behind the Whisp App and API can be found [here](https://github.com/forestdatapartnership/whisp-app).
36
37
 
37
38
  2. [Whisp in Earthmap](https://whisp.earthmap.org/?aoi=WHISP&boundary=plot1&layers=%7B%22CocoaETH%22%3A%7B%22opacity%22%3A1%7D%2C%22JRCForestMask%22%3A%7B%22opacity%22%3A1%7D%2C%22planet_rgb%22%3A%7B%22opacity%22%3A1%2C%22date%22%3A%222020-12%22%7D%7D&map=%7B%22center%22%3A%7B%22lat%22%3A7%2C%22lng%22%3A4%7D%2C%22zoom%22%3A3%2C%22mapType%22%3A%22satellite%22%7D&statisticsOpen=true) supports the visualization of geometries on actual maps with the possibility to toggle different relevant map products around tree cover, commodities and deforestation. It is practical for demonstration purposes and spot checks of single geometries but not recommended for larger datasets.
38
39
 
39
- 3. Datasets of any size, especially when holding more than 1000 geometries, can be analyzed with Whisp through the [python package on pip](https://pypi.org/project/openforis-whisp/). See example [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/Colab_whisp_geojson_to_csv.ipynb) for implementation with a geojson input. For the detailed procedure please go to the section [Whisp notebooks](#whisp_notebooks).
40
+ 3. Datasets of any size, especially when holding more than 3,000 geometries, can be analyzed with Whisp through the [python package on pip](https://pypi.org/project/openforis-whisp/). See example [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/Colab_whisp_geojson_to_csv.ipynb) for implementation with a geojson input. For further notebooks processing options see [Whisp notebooks](#whisp_notebooks).
40
41
 
41
42
 
42
43
  ## Whisp datasets <a name="whisp_datasets"></a>
@@ -59,7 +60,7 @@ Additional categories are specific for the timber commodity, considering a harve
59
60
 
60
61
  There are multiple datasets for each category. Find the full current [list of datasets used in Whisp here](https://github.com/forestdatapartnership/whisp/blob/main/layers_description.md).
61
62
 
62
- ### Whisp risk assessment <a name="whisp_risk"></a>
63
+ ### Whisp risk assessment <a name="whisp_risk"></a>
63
64
 
64
65
  Whisp checks the plots provided by the user by running zonal statistics on them to answer the following questions:
65
66
 
@@ -116,24 +117,24 @@ The **relevant risk assessment column depends on the commodity** in question:
116
117
 
117
118
  *The Whisp algorithm for **Perennial Crops** visualized:*
118
119
  ![CoE_Graphic 5](https://github.com/user-attachments/assets/007b5f50-3939-4707-95fa-98be4d56745f)
119
-
120
+
120
121
  If no treecover dataset indicates any tree cover for a plot by the end of 2020, **Whisp will categorize the deforestation risk as low.**
121
122
 
122
123
  If one or more treecover datasets indicate tree cover on a plot by the end of 2020, but a commodity dataset indicates agricultural use by the end of 2020, **Whisp will categorize the deforestation risk as low.**
123
124
 
124
- If treecover datasets indicate tree cover on a plot by late 2020, no commodity datasets indicate agricultural use, but a disturbance dataset indicates disturbances before the end of 2020, **Whisp will categorize the deforestation risk as <u>low</u>.** Such deforestation has happened before 2020, which aligns with the cutoff date for legislation such as EUDR, and is therefore not considered high risk.
125
+ If treecover datasets indicate tree cover on a plot by late 2020, no commodity datasets indicate agricultural use, but a disturbance dataset indicates disturbances before the end of 2020, **Whisp will categorize the deforestation risk as <u>low</u>.** Such deforestation has happened before 2020, which aligns with the cutoff date for legislation, such as EUDR (European Union Deforestation Risk), and is therefore not considered high risk.
125
126
 
126
127
  Now, if the datasets under 1., 2. & 3. indicate that there was tree cover, but no agriculture and no disturbances before or by the end of 2020, the Whisp algorithm checks whether degradation or deforestation have been reported in a disturbance dataset after 2020-12-31. If they have, **Whisp will categorize the deforestation risk as <u>high</u>.** <br>
127
128
  However, under the same circumstances but with <u>no</u> disturbances reported after 2020-12-31 there is insufficient evidence and the **Whisp output will be "More info needed".** Such can be the case for, e.g., cocoa or coffee grown under the shade of treecover or agroforestry.
128
129
 
129
130
 
130
131
  ## Run Whisp python package from a notebook <a name="whisp_notebooks"></a>
131
-
132
+
132
133
  For most users we suggest using the Whisp App to process their plot data. But for some, using the python package directly will fit their workflow.
133
134
 
134
- A simple example of the package functionality can be seen in this [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/Colab_whisp_geojson_to_csv.ipynb)
135
+ An example of the package functionality can be seen in this [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/Colab_whisp_geojson_to_csv.ipynb)
135
136
 
136
- For an example notebook adapted for running locally (or in Sepal), see: [whisp_geojson_to_csv.ipynb](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/whisp_geojson_to_csv.ipynb) or if datasets are very large, see [whisp_geojson_to_drive.ipynb](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/whisp_geojson_to_drive.ipynb)
137
+ For running locally (or in Sepal), see: [whisp_geojson_to_csv.ipynb](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/whisp_geojson_to_csv.ipynb) or if datasets are very large (e.g., >100,000 features), see [whisp_ee_asset_to_drive.ipynb](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/whisp_ee_asset_to_drive.ipynb)
137
138
 
138
139
  ### Requirements for running the package
139
140
 
@@ -141,8 +142,6 @@ The **relevant risk assessment column depends on the commodity** in question:
141
142
  - A registered cloud GEE project.
142
143
  - Some experience in Python or a similar language.
143
144
 
144
- More info on Whisp can be found in [here](https://openknowledge.fao.org/items/e9284dc7-4b19-4f9c-b3e1-e6c142585865)
145
-
146
145
 
147
146
  ### Python package installation
148
147
 
@@ -156,7 +155,6 @@ The **relevant risk assessment column depends on the commodity** in question:
156
155
  pip install --pre openforis-whisp
157
156
  ```
158
157
 
159
- If running the package locally we recommend a [virtual environment](https://docs.python.org/3/library/venv.html) to keep your main python installation clean. For users running the package in Sepal see [here](https://docs.sepal.io/en/latest/cli/python.html#virtual-environment).
160
158
 
161
159
  The package relies upon the google earth engine api being setup correctly using a registered cloud project.
162
160
 
@@ -203,127 +201,45 @@ Before submitting a request, consider the following:
203
201
  ---
204
202
 
205
203
 
206
-
207
204
  ### Adding your own data directly
208
205
 
206
+ The python notebooks allow the user to add custom data layers. You can edit the Prepare layers section to do this in the [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/main/notebooks/Colab_whisp_geojson_to_csv.ipynb)
207
+ To add your own data directly you will need some coding experience as well as familiarity with Google Earth Engine.
209
208
 
210
- To add your own data you will need some coding experience as well as familiarity with GitHub and Google Earth Engine.
211
-
212
- This approach is for those who want to run a bespoke analysis combining their own data with those already in Whisp.
213
-
214
- Firstly follow the steps below to install the package in editable mode.
215
-
216
- As with the regular pip installation, we recommend a separate [virtual environment](https://docs.python.org/3/library/venv.html) for running in editable mode. For Sepal users see [here](https://docs.sepal.io/en/latest/cli/python.html#virtual-environment).
217
-
218
- ```bash
219
-
220
- git clone https://github.com/forestdatapartnership/whisp.git
221
-
222
- cd whisp/
223
-
224
- pip install -e .[dev]
225
-
226
- ```
227
- Once in editable mode you are running the Whisp package locally based on a cloned version of the code.
228
-
229
-
230
-
231
- There are two files to edit to add your own data:
232
-
233
- - `src/openforis_whisp/datasets.py`
234
-
235
- - `src/openforis_whisp/parameters/lookup_gee_datasets.csv`
236
-
237
-
238
-
239
- The `datasets.py` file is a Python script that defines functions which return GEE images composed of one or more bands.
240
-
241
-
242
-
243
- #### To add your own dataset:
244
-
245
- 1. Add code to `datasets.py` in the form of a function that returns a **single-band binary image** for your dataset. See notes at the top of the file and example functions for formatting.
246
-
247
- 2. Edit the `lookup_gee_datasets.csv` and add a row for your dataset.
248
-
249
-
250
-
251
- **NB:** You need to know what the dataset represents and define how it will be used in the different risk decision trees (if at all).
252
-
253
- For example, if it is a dataset for tree cover in 2000, then add `'treecover'` under the `Theme` column.
254
-
255
-
256
-
257
- #### Example function in `datasets.py`:
258
-
259
-
260
-
261
- ```python
262
-
263
- def my_custom_dataset_prep():
264
-
265
- image = ee.Image("MY/GEE/DATASET")
266
-
267
- binary = image.gt(10) # Example threshold
268
-
269
- return binary.rename("My_custom_dataset")
270
-
271
- ```
272
-
273
-
274
-
275
- ---
276
-
277
-
278
- We are working on ways to make this process smoother. However, in the meantime do contact us through the [issues page on GitHub](https://github.com/forestdatapartnership/whisp/issues), or via the Open Foris email, if this functionality is useful to you or you need help.
279
-
280
-
281
-
282
- ---
283
-
284
-
285
-
286
- ## Contributing to the Whisp code base <a name="whisp_contribute"></a>
287
-
288
- Contributions to the Whisp code in GitHub are welcome. These could be additional functionality, datasets or just cleaner code! Contributions can be made by forking the repository, making and pushing the required changes, then making a pull request to the Whisp repository. After briefly reviewing the request, we can make a branch for which to make a new pull request to. After final checks, we can then incorporate the code into the main branch. If in doubt, get in contact first or log as an issue [here](https://github.com/forestdatapartnership/whisp/issues/).
289
-
290
-
291
- Install the package in editable mode (see Adding your own data directly above):
292
-
293
- Then add additional dependencies required for testing and running pre-commit hooks:
294
-
295
-
296
- ```bash
297
209
 
298
- pre-commit install
210
+ ## Contributing <a name="whisp_contribute"></a>
299
211
 
300
- ```
212
+ Contributions are welcome!
213
+ - Fork the repo, make changes, and open a pull request.
214
+ - For adding new datasets to the codebase and for project-specific coding standards see [.github/copilot-instructions.md](.github/copilot-instructions.md)
301
215
 
216
+ ## Code of Conduct <a name="whisp_conduct"></a>
302
217
 
303
- You should be able to run the Pytest suite by simply running the `pytest` command from the repo's root folder.
218
+ **Purpose**
219
+ We are dedicated to maintaining a safe and respectful environment for all users. Harassment or abusive behavior will not be tolerated. <br>
304
220
 
221
+ **Scope**
222
+ This Code applies to all interactions on the repository and on the app.
305
223
 
306
- Please read the [contributing guidelines](contributing_guidelines.md) for good practice recommendations
224
+ **Expectations** <br>
225
+ *- Respect others:* Treat all contributors and users with courtesy and kindness. <br>
226
+ *- Constructive communication:* Engage respectfully, even in disagreements. <br>
227
+ *- Protect privacy:* Do not share personal information without consent.
307
228
 
229
+ **Prohibited Conduct** <br>
230
+ *- Harassment:* Unwanted or abusive communication, stalking, threats, or bullying.<br>
231
+ *- Discrimination:* Any form of hate speech or exclusion based on race, gender, orientation, or other identities.<br>
232
+ *- Inappropriate Content:* Posting offensive, harmful, or explicit material.
308
233
 
309
- ## Code of Conduct <a name="whisp_conduct"></a>
234
+ **Reporting** <br>
235
+ Users can report violations of this Code of Conduct confidentially by contacting the Open Foris team at
236
+ [open-foris@fao.org](mailto:open-foris@fao.org).
310
237
 
311
- **Purpose**
312
- We are dedicated to maintaining a safe and respectful environment for all users. Harassment or abusive behavior will not be tolerated. <br>
313
238
 
314
- **Scope**
315
- This Code applies to all interactions on the repository and on the app.
239
+ ## Feedback <a name="whisp_feedback"></a>
240
+ - For issues or feature requests [open a GitHub issue](https://github.com/forestdatapartnership/whisp/issues).
241
+ - For general questions, feedback or support, email [open-foris@fao.org](mailto:open-foris@fao.org).
316
242
 
317
- **Expectations** <br>
318
- *- Respect others:* Treat all contributors and users with courtesy and kindness. <br>
319
- *- Constructive communication:* Engage respectfully, even in disagreements. <br>
320
- *- Protect privacy:* Do not share personal information without consent.
243
+ We welcome all feedback and contributions!
321
244
 
322
- **Prohibited Conduct** <br>
323
- *- Harassment:* Unwanted or abusive communication, stalking, threats, or bullying.<br>
324
- *- Discrimination:* Any form of hate speech or exclusion based on race, gender, orientation, or other identities.<br>
325
- *- Inappropriate Content:* Posting offensive, harmful, or explicit material.
326
245
 
327
- **Reporting**
328
- Users can report violations directly to us by emailing the address listed in the "Contact Us" section of the website:
329
- https://openforis.org/solutions/whisp/
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
4
4
 
5
5
  [tool.poetry]
6
6
  name = "openforis-whisp"
7
- version = "3.0.0a6"
7
+ version = "3.0.0a8"
8
8
  description = "Whisp (What is in that plot) is an open-source solution which helps to produce relevant forest monitoring information and support compliance with deforestation-related regulations."
9
9
  repository = "https://github.com/forestdatapartnership/whisp"
10
10
  authors = ["Andy Arnell <andrew.arnell@fao.org>"]
@@ -24,6 +24,7 @@ classifiers = [
24
24
  "Documentation" = "https://github.com/forestdatapartnership/whisp#readme"
25
25
  "Development Branch" = "https://github.com/forestdatapartnership/whisp/tree/main"
26
26
  "Issues" = "https://github.com/forestdatapartnership/whisp/issues"
27
+ "Changelog" = "https://github.com/forestdatapartnership/whisp/releases"
27
28
 
28
29
  [tool.poetry.dependencies]
29
30
  python = ">=3.10"
@@ -101,6 +101,8 @@ from openforis_whisp.utils import (
101
101
 
102
102
  from openforis_whisp.data_checks import (
103
103
  analyze_geojson,
104
- validate_geojson_constraints,
104
+ check_geojson_limits,
105
+ screen_geojson, # Backward compatibility alias
105
106
  suggest_processing_mode,
107
+ validate_geojson_constraints, # Backward compatibility alias
106
108
  )