openforis-whisp 0.1.0a0__py3-none-any.whl → 0.1.0a2__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.1.0a0.dist-info → openforis_whisp-0.1.0a2.dist-info}/METADATA +24 -88
- {openforis_whisp-0.1.0a0.dist-info → openforis_whisp-0.1.0a2.dist-info}/RECORD +4 -4
- {openforis_whisp-0.1.0a0.dist-info → openforis_whisp-0.1.0a2.dist-info}/LICENSE +0 -0
- {openforis_whisp-0.1.0a0.dist-info → openforis_whisp-0.1.0a2.dist-info}/WHEEL +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: openforis-whisp
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.0a2
|
|
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
|
|
@@ -74,7 +74,7 @@ The Forest Data Partnership promotes this approach for forest and commodities mo
|
|
|
74
74
|
|
|
75
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.
|
|
76
76
|
|
|
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 [Colab
|
|
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).
|
|
78
78
|
|
|
79
79
|
|
|
80
80
|
## Whisp datasets <a name="whisp_datasets"></a>
|
|
@@ -82,8 +82,8 @@ The Forest Data Partnership promotes this approach for forest and commodities mo
|
|
|
82
82
|
|
|
83
83
|
1) Tree and forest cover (at the end of 2020);
|
|
84
84
|
2) Commodities (i.e., crop plantations and other agricultural uses at the end of 2020);
|
|
85
|
-
3) Disturbances **before 2020** (i.e.,
|
|
86
|
-
4) Disturbances **after 2020** (i.e.,
|
|
85
|
+
3) Disturbances **before 2020** (i.e., degradation or deforestation until 2020-12-31);
|
|
86
|
+
4) Disturbances **after 2020** (i.e., degradation or deforestation from 2021-01-01 onward).
|
|
87
87
|
|
|
88
88
|
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).
|
|
89
89
|
Whisp checks the plots provided by the user by running zonal statistics on them to answer the following questions:
|
|
@@ -93,35 +93,27 @@ There are multiple datasets for each category. Find the full current [list of da
|
|
|
93
93
|
3) Were there disturbances until 2020-12-31?
|
|
94
94
|
4) Were there disturbances after 2020-12-31 / starting 2021-01-01?
|
|
95
95
|
|
|
96
|
-
If no treecover dataset indicates any tree cover for a plot by the end of 2020, **Whisp will
|
|
96
|
+
If no treecover dataset indicates any tree cover for a plot by the end of 2020, **Whisp will categorize the deforestation risk as low.**
|
|
97
97
|
|
|
98
|
-
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
|
|
98
|
+
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.**
|
|
99
99
|
|
|
100
|
-
If treecover datasets indicate tree cover on a plot by late 2020, no commodity datasets indicate agricultural use, but a disturbance
|
|
100
|
+
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 the EUDR cutoff date and is therefore not considered high risk for the EUDR.
|
|
101
101
|
|
|
102
|
-
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
|
|
102
|
+
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>
|
|
103
103
|
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.
|
|
104
104
|
|
|
105
105
|
|
|
106
106
|
*The Whisp algorithm visualized:*
|
|
107
|
-

|
|
108
108
|
|
|
109
|
-
--------------------------------------------------------------------------------
|
|
110
109
|
|
|
111
|
-
|
|
110
|
+
# Run Whisp python package from a notebook
|
|
112
111
|
|
|
112
|
+
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.
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
A simple example of the package functionality can be seen in this [Colab Notebook](https://github.com/forestdatapartnership/whisp/blob/package-test-new-structure/notebooks/Colab_whisp_geojson_to_csv.ipynb)
|
|
115
115
|
|
|
116
|
-
##
|
|
117
|
-
|
|
118
|
-
For most users we suggest using the Whisp App to porcess their plots.
|
|
119
|
-
|
|
120
|
-
For bespoke analyses using or implemetation in a python workflow you can sue the python package directly.
|
|
121
|
-
|
|
122
|
-
See example [Colab notebook] (https://github.com/forestdatapartnership/whisp/blob/package-test-new-structure/notebooks/Colab_whisp_geojson_to_csv.ipynb)
|
|
123
|
-
|
|
124
|
-
# Requirements
|
|
116
|
+
## Requirements for running the package
|
|
125
117
|
|
|
126
118
|
- A Google Earth Engine (GEE) account.
|
|
127
119
|
- A registered cloud GEE project.
|
|
@@ -129,86 +121,30 @@ See example [Colab notebook] (https://github.com/forestdatapartnership/whisp/blo
|
|
|
129
121
|
|
|
130
122
|
More info on Whisp can be found in [here](https://openknowledge.fao.org/items/e9284dc7-4b19-4f9c-b3e1-e6c142585865)
|
|
131
123
|
|
|
132
|
-
|
|
124
|
+
## Python package installation
|
|
133
125
|
|
|
134
|
-
pip
|
|
126
|
+
The Whisp package is available on pip
|
|
127
|
+
https://pypi.org/project/openforis-whisp/
|
|
135
128
|
|
|
136
|
-
...
|
|
137
129
|
|
|
138
|
-
|
|
130
|
+
It can be installed with one line of code:
|
|
139
131
|
|
|
140
132
|
```
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
# Earth Engine project name
|
|
144
|
-
gee_project_name="my-ee-project"
|
|
133
|
+
pip install openforis-whisp
|
|
145
134
|
```
|
|
146
|
-
Where you must replace the GEE project in the
|
|
147
|
-
ee.Initialize(project=gee_project_name)
|
|
148
135
|
|
|
149
|
-
|
|
136
|
+
If running locally we recommend a [virtual environment](https://docs.python.org/3/library/venv.html) to keep your main python installation clean.
|
|
137
|
+
|
|
138
|
+
The package relies upon the google earth engine api being setup correctly using a registered cloud project.
|
|
150
139
|
|
|
151
140
|
More info on Whisp can be found in [here](https://openknowledge.fao.org/items/e9284dc7-4b19-4f9c-b3e1-e6c142585865)
|
|
152
141
|
|
|
153
142
|
|
|
154
143
|
## How to add data layers to Whisp
|
|
155
|
-
|
|
156
|
-
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
|
|
157
|
-
|
|
158
|
-
### Requesting a dataset addition
|
|
159
|
-
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.
|
|
160
|
-
|
|
161
|
-
### Adding your own dataset for a bespoke Whisp analysis (using the Python Notebooks)
|
|
162
|
-
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.
|
|
163
|
-
|
|
164
|
-
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.
|
|
165
|
-
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.
|
|
166
|
-
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.
|
|
167
|
-
|
|
168
|
-
The above assumes a single band image that is being included, which results in a single column being added.
|
|
169
|
-
If you have multiband images to add and want each band to be a layer in Whisp, make sure each band is named.
|
|
170
|
-
Make sure to add all the bands to the lookup CSV (see Step 3), else they won’t appear in the output.
|
|
171
|
-
|
|
172
|
-
How to fill out the columns parameters/lookup_gee_datasets.csv
|
|
173
|
-
a. name: the name for the dataset column. NB must be exactly the same as the name of the image band in step 1.
|
|
174
|
-
b. order: choose a number for where you want the dataset column placed in the CSV output.
|
|
175
|
-
c. theme: a word denoting the dataset Theme. Currently there are five themes where i to iv correspond to:
|
|
176
|
-
i. treecover: for forest or treecover at the end of 2020
|
|
177
|
-
ii. commodities: representing commodities in 2020 (typically ones that tree cover might be confused with in remote sensing products).
|
|
178
|
-
iii. disturbance_before: forest/tree cover disturbance before the end of 2020
|
|
179
|
-
iv. disturbance_after: forest/tree cover disturbance after the end of 2020
|
|
180
|
-
v. ancillary: other relevant layers, such as representing protected areas or areas of importance for biodiversity.
|
|
181
|
-
d. use_for_risk: if 1 is added here this dataset is included in the risk calculations. The type of risk indicator it will contribute to is automatically governed by the “theme” column.
|
|
182
|
-
NB if there is in a 1 in the "exclude_from_output" column this over-rules all of the above and the dataset is ignored. There are functions (in the modules/risk.py), to create lists for each of the 4 indicators from the lookup csv. These are used in the "whisp_risk" function for creating default columns to include in the final overall risk column.
|
|
183
|
-
e. exclude_from_output: removes the column from the formatted final table (to remove input code out the function in the datasets.py)
|
|
184
|
-
f. col_type:
|
|
185
|
-
- choose 'float32' (most )
|
|
186
|
-
- exceptions are 'bool' for showing True/False, where values >0 gives True.
|
|
187
|
-
e. is nullable: set to 1
|
|
188
|
-
f. is required: set to 0
|
|
189
|
-
g. corresponding variable: the name of the function for creating the dataset in datasets.py (should end with "_prep")
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
### Tips for preparing and adding in your data
|
|
193
|
-
• It’s sometimes easier to do initial checks in JavaScript and check all looks ok on the map in Code Editor, and then convert the code into Python. Tools that can help convert include AI interfaces such as ChatGPT, or [geemap] (https://giswqs.medium.com/15-converting-earth-engine-javascripts-to-python-code-with-just-a-few-mouse-clicks-6aa02b1268e1/).
|
|
194
|
-
• Check your data: Python functions will still need sense checking and putting on a map is one way to do this using functions in [geemap] (https://geemap.org/notebooks/09_plotting/)
|
|
195
|
-
• 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).
|
|
196
|
-
• 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.
|
|
197
|
-
|
|
198
|
-
## Key files
|
|
199
|
-
|
|
200
|
-
# Parameters:
|
|
201
|
-
- `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).
|
|
202
|
-
|
|
203
|
-
### src code
|
|
204
|
-
|
|
205
|
-
Main Whisp analysis functions are found in the following files:
|
|
206
|
-
- `datasets.py` functions for compiling GEE datasets into a single multiband image ready for input into the whisp analysis
|
|
207
|
-
- `stats.py` functions to run Whisp analysis for each GEE dataset, providing results for coverage of each plot as an area in hectares
|
|
208
|
-
-`risk.py` functions for estimating risk of deforestation.
|
|
144
|
+
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. Currently the latter approach is under revision since moving to implementation in a python package. In the meantime please contact us through the issues page if this is functionality is useful to you.
|
|
209
145
|
|
|
210
146
|
## Contributing to the Whisp code base
|
|
211
|
-
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]
|
|
147
|
+
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/).
|
|
212
148
|
|
|
213
149
|
Install the package in editable mode with the additional dependencies required for testing and running pre-commit hooks:
|
|
214
150
|
```
|
|
@@ -224,5 +160,5 @@ pre-commit install
|
|
|
224
160
|
|
|
225
161
|
You should be able to run the Pytest suite by simple running the `pytest` command from the repo's root folder.
|
|
226
162
|
|
|
227
|
-
Please read the
|
|
163
|
+
Please read the [contributing guidelines](contributing_guidelines.md) for good practice recommendations.
|
|
228
164
|
|
|
@@ -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.1.
|
|
15
|
-
openforis_whisp-0.1.
|
|
16
|
-
openforis_whisp-0.1.
|
|
17
|
-
openforis_whisp-0.1.
|
|
14
|
+
openforis_whisp-0.1.0a2.dist-info/LICENSE,sha256=nqyqICO95iw_iwzP1t_IIAf7ZX3DPbL_M9WyQfh2q1k,1085
|
|
15
|
+
openforis_whisp-0.1.0a2.dist-info/METADATA,sha256=ZZ5LLEnWy0pyWPBWUjCw-gUagXQ_6IeN1w-TdyWr6NQ,10359
|
|
16
|
+
openforis_whisp-0.1.0a2.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
|
|
17
|
+
openforis_whisp-0.1.0a2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|