openforis-whisp 0.0.1__py3-none-any.whl → 0.1.0a1__py3-none-any.whl
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.
- {openforis_whisp-0.0.1.dist-info → openforis_whisp-0.1.0a1.dist-info}/METADATA +59 -125
- {openforis_whisp-0.0.1.dist-info → openforis_whisp-0.1.0a1.dist-info}/RECORD +4 -4
- {openforis_whisp-0.0.1.dist-info → openforis_whisp-0.1.0a1.dist-info}/LICENSE +0 -0
- {openforis_whisp-0.0.1.dist-info → openforis_whisp-0.1.0a1.dist-info}/WHEEL +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: openforis-whisp
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.1.0a1
|
|
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,10 @@ 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: Documentation, https://github.com/forestdatapartnership/whisp#readme
|
|
33
|
+
Project-URL: Development Branch, https://github.com/forestdatapartnership/whisp/tree/package-test-new-structure
|
|
34
|
+
Project-URL: Issues, https://github.com/forestdatapartnership/whisp/issues
|
|
35
|
+
Project-URL: Repository, https://github.com/forestdatapartnership/whisp
|
|
32
36
|
Description-Content-Type: text/markdown
|
|
33
37
|
|
|
34
38
|
whisp
|
|
@@ -38,7 +42,6 @@ whisp
|
|
|
38
42
|
[](https://doi.org/10.4060/cd0957en)
|
|
39
43
|
|
|
40
44
|
|
|
41
|
-
|
|
42
45
|

|
|
43
46
|
|
|
44
47
|
## Convergence of Evidence <a name="whisp_coe"></a>
|
|
@@ -67,13 +70,12 @@ The Forest Data Partnership promotes this approach for forest and commodities mo
|
|
|
67
70
|
***Whisp*** can currently be used directly or implemented in your own code through three different pathways:
|
|
68
71
|
|
|
69
72
|
|
|
70
|
-
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
|
|
73
|
+
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).
|
|
71
74
|
|
|
72
75
|
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.
|
|
73
76
|
|
|
74
|
-
3. Datasets of any size, especially when holding more than
|
|
77
|
+
3. Datasets of any size, especially when holding more than 1000 geometries, can be "whisped" through the [python package on pip](https://pypi.org/project/openforis-whisp/). See example [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/package-test-new-structure/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).
|
|
75
78
|
|
|
76
|
-
<br>
|
|
77
79
|
|
|
78
80
|
## Whisp datasets <a name="whisp_datasets"></a>
|
|
79
81
|
***Whisp*** implements the convergence of evidence approach by providing a transparent and public processing flow using datasets covering the following categories:
|
|
@@ -108,143 +110,47 @@ However, under the same circumstances but with <u>no</u> disturbances reported a
|
|
|
108
110
|
|
|
109
111
|

|
|
110
112
|
|
|
111
|
-
# Requirements
|
|
112
|
-
|
|
113
|
-
- A Google Earth Engine (GEE) account.
|
|
114
|
-
- A registered cloud GEE project.
|
|
115
|
-
- Some experience in Python or a similar language.
|
|
116
|
-
|
|
117
|
-
# Setup
|
|
118
|
-
Consider creating a virtual environment to keep your main python installation clean.
|
|
119
|
-
This can be done through this command line
|
|
120
|
-
```
|
|
121
|
-
python -m venv env
|
|
122
|
-
```
|
|
123
|
-
More info on virtual environments here: https://docs.python.org/3/library/venv.html
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
If installing from GitHUb
|
|
127
|
-
Clone the Whisp repo and install the package:
|
|
128
|
-
```
|
|
129
|
-
git clone https://github.com/forestdatapartnership/whisp.git
|
|
130
|
-
cd whisp/
|
|
131
|
-
pip install .
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
Create a `.env` file with the required information for Earth Engine login (you may copy and edit the `.env.template`
|
|
135
|
-
file found in the root directory). The file must contain the following environment variables:
|
|
136
|
-
```
|
|
137
|
-
# Earth Engine project name
|
|
138
|
-
PROJECT="my-ee-project"
|
|
139
|
-
```
|
|
140
|
-
Where you must replace the GEE project name by your own.
|
|
141
|
-
|
|
142
|
-
Note: this should be a registered cloud project. If unsure of this check pic here: https://developers.google.com/earth-engine/cloud/assets
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
# Contributing
|
|
146
|
-
|
|
147
|
-
Install the package in editable mode with the additional dependencies required for testing and running pre-commit hooks:
|
|
148
|
-
```
|
|
149
|
-
git clone https://github.com/forestdatapartnership/whisp.git
|
|
150
|
-
cd whisp/
|
|
151
|
-
pip install -e .[dev]
|
|
152
|
-
```
|
|
153
|
-
|
|
154
|
-
Setup the pre-commit hooks:
|
|
155
|
-
```
|
|
156
|
-
pre-commit install
|
|
157
|
-
```
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
You should be able to run the Pytest suite by simple running the `pytest` command from the repo's root folder.
|
|
161
113
|
|
|
162
|
-
|
|
114
|
+

|
|
163
115
|
|
|
116
|
+
## Run Whisp package using Python Notebooks
|
|
164
117
|
|
|
165
|
-
|
|
166
|
-
***whisp*** can be implemented through at least three pathways
|
|
118
|
+
For most users we suggest using the Whisp App to porcess their plots.
|
|
167
119
|
|
|
168
|
-
|
|
120
|
+
For bespoke analyses using or implemetation in a python workflow you can sue the python package directly.
|
|
169
121
|
|
|
170
|
-
|
|
122
|
+
See example [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/package-test-new-structure/notebooks/Colab_whisp_geojson_to_csv.ipynb)
|
|
171
123
|
|
|
172
|
-
|
|
124
|
+
# Requirements
|
|
173
125
|
|
|
174
|
-
|
|
126
|
+
- A Google Earth Engine (GEE) account.
|
|
127
|
+
- A registered cloud GEE project.
|
|
128
|
+
- Some experience in Python or a similar language.
|
|
175
129
|
|
|
176
130
|
More info on Whisp can be found in [here](https://openknowledge.fao.org/items/e9284dc7-4b19-4f9c-b3e1-e6c142585865)
|
|
177
131
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
The Python notebooks are currently set up to run in Sepal and to focus on polygon data provided by the user or geo_ids that allow the notebooks to access polygons stored and registered in the Asset Registry. NB: We value your feedback in terms of what input data we should support.
|
|
181
|
-
|
|
182
|
-
If your data is available as a feature collection and the GitHub repo is cloned, you are ready to start processing. We suggest first familiarizing yourself with running the notebooks using the default inputs in the notebook code. This will allow you to understand the expected outputs and the general functionality, as well as check if the setup worked successfully.
|
|
183
|
-
|
|
184
|
-
### Whisping a GeoJSON containing plot data
|
|
185
|
-
|
|
186
|
-
1. Open Jupyter Lab (see Apps).
|
|
187
|
-
2. Open the notebook `whisp_geojson.ipynb` from inside the "notebooks" folder.
|
|
188
|
-
3. To run the notebook cells, press the Play icon, or use the Shift + Enter shortcut. For more info on Jupyter and controlling notebooks, see [here](https://jupyter.org/try-jupyter/lab/).
|
|
189
|
-
4. Once you have initialised and agreed to the Google Earth Engine access requirements, you can process a geojson file containing plot informations.
|
|
190
|
-
5. The outputs from the notebook can be set to where you want to store them.
|
|
191
|
-
6. Outputs from the process include a CSV file `whisp_output_table.csv`.
|
|
192
|
-
7. NB If the processing job is large this may take some time. IF the outputs fail to process due to memory or time out errors, you can use the alternative function 'whisp_stats_geojson_to_drive', that sends a csv outpout to your Google drive. We are developing functionality to upload the csv automatically. In the meantime manually downloading from Google Drive and saving the csv is required. You can then import the csv as a pandas dataframe and use the 'validate_dataframe_using_lookups' function to get the Whisp output format (i.e., using a set schema for a standardised output, useful for showing in Power Bi etc).
|
|
193
|
-
|
|
194
|
-
### Adding risk indicators to your results
|
|
195
|
-
8. Finally, functions at the end of the notebook allow the user to add EUDR risk indicators to the table. NB: these risk indicators are still at the experimental stage.
|
|
196
|
-
|
|
197
|
-
### Output 1
|
|
198
|
-
|
|
199
|
-
- A CSV called `whisp_output_table.csv` contains results from the whisp processing.
|
|
200
|
-
|
|
201
|
-
### Output 2
|
|
202
|
-
|
|
203
|
-
- A CSV called `whisp_output_table_w_risk.csv` contains results from the whisp processing and risk indicators.
|
|
204
|
-
|
|
132
|
+
# Python package installation
|
|
205
133
|
|
|
206
|
-
|
|
134
|
+
...
|
|
135
|
+
pip install openforis-whisp
|
|
207
136
|
|
|
208
|
-
|
|
137
|
+
import openforis_whisp as whisp
|
|
138
|
+
...
|
|
209
139
|
|
|
210
|
-
|
|
140
|
+
If running the package locally we recommend using a [virtual environment](https://docs.python.org/3/library/venv.html) to keep your main python installation clean.
|
|
211
141
|
|
|
212
|
-
Key files include:
|
|
213
|
-
- `lookup_gee_datasets.csv` contains the list of input datasets, the order they will be displayed, which ones are to be excluded from the current analysis, and which ones are shown as flags (i.e., shown as presence or absence instead of figures for area/percentage coverage of the plot).
|
|
214
|
-
- `config_runtime.py` contains parameters such as default file and column names. **WARNING: USERS SHOULD NOT EDIT PACKAGE CONFIG ; IF THEY WANT TO, THEY SHOULD INSTALL THE PACKAGE IN EDITABLE MODE IN ORDER TO BE ABLE TO MODIFY CONFIGS WITHOUT HAVING TO RE-INSTALL THE PACKGE EVERY TIME**
|
|
215
142
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
Various functions for the main Whisp analysis along with some for interacting with the AgStack Asset Registry.
|
|
219
|
-
|
|
220
|
-
Key files:
|
|
221
|
-
- `datasets.py` contains a series of functions related to the creation of a single multiband GEE image to be used in the Whisp summary statistics analysis.
|
|
222
|
-
- `stats.py` contains functions to run the Whisp analysis for each of the various datasets and to provide results for coverage of each plot as a percentage (or as an area in hectares).
|
|
223
|
-
|
|
224
|
-
## Setting Up Your System
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
### Setting Up SEPAL
|
|
143
|
+
The package relies upon the earth engine api being setup correctly using a registered cloud project
|
|
228
144
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
1. Login to SEPAL.
|
|
232
|
-
2. Start an instance (see Terminal info) to provide you with free processing power.
|
|
233
|
-
3. If you don’t have SEPAL set up:
|
|
234
|
-
- To create a SEPAL account, please follow the registration steps described [here](https://docs.sepal.io/en/latest/setup/register.html) and then familiarize yourself with the tool by exploring its interface.
|
|
235
|
-
- To create a Google Earth Engine (GEE) account, please follow these steps and don’t forget to initialize the home folder.
|
|
236
|
-
|
|
237
|
-
### Setting Up the Whisp GitHub Repository
|
|
145
|
+
# Earth Engine project name
|
|
146
|
+
gee_project_name="my-ee-project"
|
|
238
147
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
3. To clone (i.e., copy) the GitHub repository so that it is accessible in SEPAL, type into the SEPAL terminal:
|
|
148
|
+
Where you must replace the GEE project in the
|
|
149
|
+
ee.Initialize(project=gee_project_name)
|
|
242
150
|
|
|
243
|
-
|
|
244
|
-
git clone https://github.com/forestdatapartnership/whisp.git
|
|
245
|
-
```
|
|
151
|
+
Note: this should be a registered cloud project. If unsure of this check pic here: https://developers.google.com/earth-engine/cloud/assets
|
|
246
152
|
|
|
247
|
-
|
|
153
|
+
More info on Whisp can be found in [here](https://openknowledge.fao.org/items/e9284dc7-4b19-4f9c-b3e1-e6c142585865)
|
|
248
154
|
|
|
249
155
|
|
|
250
156
|
## How to add data layers to Whisp
|
|
@@ -252,12 +158,12 @@ SEPAL is closely linked to Google Earth Engine (GEE), a Google-powered Earth-obs
|
|
|
252
158
|
There are two main approaches: to request a layer be incorporated into the core Whisp inputs, or to add in your own data directly to complement the core ones in Whisp
|
|
253
159
|
|
|
254
160
|
### Requesting a dataset addition
|
|
255
|
-
If you think a particular dataset has wide applicability for Whisp users, you can request it be added to the main Whisp repository by logging as an issue in Github [here] (https://github.com/forestdatapartnership/whisp/issues/).
|
|
161
|
+
If you think a particular dataset has wide applicability for Whisp users, you can request it be added to the main Whisp repository by logging as an issue in Github [here] (https://github.com/forestdatapartnership/whisp/issues/). Before requesting consider: 1) is the resolution high enough for plot level analysis (e.g. 30m or 10m resolution), 2) is there an indication of data quality (e.g. accuracy assessment detailed in a scientific publication) and 3) is there relevant metadata available.
|
|
256
162
|
|
|
257
163
|
### Adding your own dataset for a bespoke Whisp analysis (using the Python Notebooks)
|
|
258
164
|
Adding your To add other datasets, such as that are specific to your circumstances, or can’t be shared directly in GEE, follow the steps and guidance below.
|
|
259
165
|
|
|
260
|
-
1) Edit
|
|
166
|
+
1) Edit the datasets.py and add in a function to make a binary GEE image (i.e., where values are either 0 or 1*). Make sure the function name ends with "_prep", as only functions with this suffix are used.
|
|
261
167
|
2) Choose a name to represent the data layer in the final CSV output. Place in speech brackets in the .rename() section at the end of the function. See examples elsewhere in the functions in this script.
|
|
262
168
|
3) Edit parameters/lookup_gee_datasets.csv to include the chosen dataset name in a new row. Make sure other relevant columns are filled in.
|
|
263
169
|
|
|
@@ -291,6 +197,34 @@ g. corresponding variable: the name of the function for creating the dataset in
|
|
|
291
197
|
• A binary input image is expected, but non-integer values are allowed if they range between 0 and 1. This is most appropriate for datasets that have proportion of coverage in a pixel (e.g., a value of 0.5 would represent having half the pixel covered).
|
|
292
198
|
• If you are adding timeseries data, when creating the function you can use loops/mapping to compile a multiband input and to name each band accordingly.
|
|
293
199
|
|
|
200
|
+
## Key files
|
|
201
|
+
|
|
202
|
+
# Parameters:
|
|
203
|
+
- `lookup_gee_datasets.csv` contains the list of input datasets, the order they will be displayed, which ones are to be excluded from the current analysis, and which ones are shown as flags (i.e., shown as presence or absence instead of figures).
|
|
204
|
+
|
|
205
|
+
### src code
|
|
206
|
+
|
|
207
|
+
Main Whisp analysis functions are found in the following files:
|
|
208
|
+
- `datasets.py` functions for compiling GEE datasets into a single multiband image ready for input into the whisp analysis
|
|
209
|
+
- `stats.py` functions to run Whisp analysis for each GEE dataset, providing results for coverage of each plot as an area in hectares
|
|
210
|
+
-`risk.py` functions for estimating risk of deforestation.
|
|
211
|
+
|
|
294
212
|
## Contributing to the Whisp code base
|
|
295
213
|
Contributions to the Whisp code in GitHub are welcome. They 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. If in doubt get in contact first or log as an issue [here] (https://github.com/forestdatapartnership/whisp/issues/).
|
|
296
214
|
|
|
215
|
+
Install the package in editable mode with the additional dependencies required for testing and running pre-commit hooks:
|
|
216
|
+
```
|
|
217
|
+
git clone https://github.com/forestdatapartnership/whisp.git
|
|
218
|
+
cd whisp/
|
|
219
|
+
pip install -e .[dev]
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Setup the pre-commit hooks:
|
|
223
|
+
```
|
|
224
|
+
pre-commit install
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
You should be able to run the Pytest suite by simple running the `pytest` command from the repo's root folder.
|
|
228
|
+
|
|
229
|
+
Please read the  for good practice recommendations.
|
|
230
|
+
|
|
@@ -11,7 +11,7 @@ openforis_whisp/reformat.py,sha256=_ByLR5bu_gPecH6W4jxymkcIN5Hph3bRIuRfjZByNBU,1
|
|
|
11
11
|
openforis_whisp/risk.py,sha256=qgrBnioYS_vMPWs_rXFR5k_TacxBACHbeYmPhBmqMrM,13367
|
|
12
12
|
openforis_whisp/stats.py,sha256=Y-IfazrTA_O5wQ8YE0GypXQYopp1V-ym_jPLwtNCw4M,26405
|
|
13
13
|
openforis_whisp/utils.py,sha256=hpeY9aA3BND2m9c15PZ6_nClemsfiVNUEzA4pQXfztA,5330
|
|
14
|
-
openforis_whisp-0.
|
|
15
|
-
openforis_whisp-0.
|
|
16
|
-
openforis_whisp-0.
|
|
17
|
-
openforis_whisp-0.
|
|
14
|
+
openforis_whisp-0.1.0a1.dist-info/LICENSE,sha256=nqyqICO95iw_iwzP1t_IIAf7ZX3DPbL_M9WyQfh2q1k,1085
|
|
15
|
+
openforis_whisp-0.1.0a1.dist-info/METADATA,sha256=irr0deDjHjv6Dd1Z0LecKaR73dlfG8vnqe6kp5Zikg8,15647
|
|
16
|
+
openforis_whisp-0.1.0a1.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
17
|
+
openforis_whisp-0.1.0a1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|