Skip to content

Commit

Permalink
Adding specificities
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainv committed Jun 23, 2024
1 parent f818c87 commit 1d438ba
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 5 deletions.
8 changes: 6 additions & 2 deletions far_functions/far_calibrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,9 @@ def run(self):
# Chains
burnin=1000, mcmc=1000, thin=1,
# Starting values
beta_start=self.beta_start)
beta_start=self.beta_start,
# Verbose = False for QGIS task
verbose=0)
# Ecological and statistical significance
effects = mod_icar.betas[1:]
positive_effects = effects >= 0
Expand Down Expand Up @@ -204,7 +206,9 @@ def run(self):
mcmc=mcmc,
thin=thin,
# Starting values
beta_start=beta_start)
beta_start=beta_start,
# Verbose = False for QGIS task
verbose=0)

# Check isCanceled() to handle cancellation
if self.isCanceled():
Expand Down
20 changes: 19 additions & 1 deletion help/docsrc/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,25 @@ Deforestation risk maps obtained using this plugin can be used to estimate emiss
#+attr_rst: :alt Banner
[[https://ecology.ghislainv.fr/deforisk-qgis-plugin][https://ecology.ghislainv.fr/deforisk-qgis-plugin/_static/banner.png]]

* Specificities

*Python based.* The ~deforisk~ plugin relies on four specific Python packages developed specifically for modelling deforestation: ~geefcc~, ~pywdpa~, ~forestatrisk~, and ~riskmapjnr~. The ~geefcc~ packages can be used to make forest cover change maps from Google Earth Engine (GEE) and download them locally using two global tree/forest cover change products: Global Forest Change or Tropical Moist Forests. The ~pywdpa~ package allows downloading vector files of protected areas for any countries using the World Database on Protected Areas (WDPA). The ~forestatrisk~ package provides functions to model deforestation and predict the spatial deforestation risk using various explanatory variables (distance to forest edge, elevation, protected areas, etc.) and various statistical models including iCAR, GLM, and Random Forest models. The ~riskmapjnr~ package allows deriving deforestation risk maps following Verra JNR methodologies which include a moving window model and a benchmark model which assumes a decrease of the deforestation risk with the distance to forest edge.

#+attr_rst: :alt geefc :width 100px
[[https://ecology.ghislainv.fr/geefcc][https://ecology.ghislainv.fr/deforisk-qgis-plugin/_static/logo-geefcc.png]]
#+attr_rst: :alt pywdpa :width 100px
[[https://ecology.ghislainv.fr/pywdpa][https://ecology.ghislainv.fr/deforisk-qgis-plugin/_static/logo-pywdpa.png]]
#+attr_rst: :alt forestatrisk :width 100px
[[https://ecology.ghislainv.fr/forestatrisk][https://ecology.ghislainv.fr/deforisk-qgis-plugin/_static/logo-forestatrisk.png]]
#+attr_rst: :alt riskmapjnr :width 100px
[[https://ecology.ghislainv.fr/riskmapjnr][https://ecology.ghislainv.fr/deforisk-qgis-plugin/_static/logo-riskmapjnr.png]]

*Processing raster by blocks.* Raster files of forest cover change and explanatory variables might occupy a space of several gigabytes on disk. Processing such large rasters in memory can be prohibitively intensive on computers with limited RAM. Functions used in the ~deforisk~ plugin process large rasters by blocks of pixels representing subsets of the raster data. This makes computation efficient, with low memory usage. Reading and writing subsets of raster data is done by using functions from GDAL, a dependency of the plugin. Numerical computations on arrays are performed with the NumPy Python package, whose core is mostly made of optimized and compiled C code that runs quickly.

*Running tasks in parallel.* State-of-the-art approach to select the best deforestation risk map and forecast deforestation implies comparing various models, fit the models using forest cover change over different time periods and predict the deforestation risk at several dates. This implies repeating a high number of tasks. To save computation time, the ~deforisk~ plugin use the QGIS task manager which allows running several analysis in parallel.

*OS independent.* Using both computation by block for large rasters and task parallelization, the ~deforisk~ plugin allows selecting the best deforestation risk map and forecast deforestation for large countries or areas of interest in a limited amount of time, even on personal computers with average performance hardware. Because the ~deforisk~ is a QGIS plugin written in Python, it should run on all operating systems able to run QGIS, including Windows ($\geq10$), Linux, and Mac OS.

* Installing the ~deforisk~ plugin in Qgis

#+attr_rst: :directive note
Expand All @@ -78,7 +97,6 @@ The development of the plugin has been funded by [[https://www.cirad.fr/en/][Cir
#+attr_rst: :height 100px :alt Logo FAO
[[https://www.fao.org][https://ecology.ghislainv.fr/deforisk-qgis-plugin/_static/logo_fao.png]]


* Contributing

The ~deforisk~ QGIS plugin is Open Source and released under the [[https://ecology.ghislainv.fr/deforisk-qgis-plugin/license.html][GNU GPL version 3 license]]. Anybody who is interested can contribute to the package development following our [[https://ecology.ghislainv.fr/deforisk-qgis-plugin/contributing.html][Community guidelines]]. Every contributor must agree to follow the project's [[https://ecology.ghislainv.fr/deforisk-qgis-plugin/code_of_conduct.html][Code of conduct]].
Expand Down
31 changes: 31 additions & 0 deletions help/docsrc/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,37 @@ Deforestation risk maps obtained using this plugin can be used to estimate emiss
:target: https://ecology.ghislainv.fr/deforisk-qgis-plugin
:alt: Banner

Specificities
-------------

**Python based.** The ``deforisk`` plugin relies on four specific Python packages developed specifically for modelling deforestation: ``geefcc``, ``pywdpa``, ``forestatrisk``, and ``riskmapjnr``. The ``geefcc`` packages can be used to make forest cover change maps from Google Earth Engine (GEE) and download them locally using two global tree/forest cover change products: Global Forest Change or Tropical Moist Forests. The ``pywdpa`` package allows downloading vector files of protected areas for any countries using the World Database on Protected Areas (WDPA). The ``forestatrisk`` package provides functions to model deforestation and predict the spatial deforestation risk using various explanatory variables (distance to forest edge, elevation, protected areas, etc.) and various statistical models including iCAR, GLM, and Random Forest models. The ``riskmapjnr`` package allows deriving deforestation risk maps following Verra JNR methodologies which include a moving window model and a benchmark model which assumes a decrease of the deforestation risk with the distance to forest edge.

.. image:: https://ecology.ghislainv.fr/deforisk-qgis-plugin/\_static/logo-geefcc.png
:target: https://ecology.ghislainv.fr/geefcc
:alt: geefc
:width: 100px

.. image:: https://ecology.ghislainv.fr/deforisk-qgis-plugin/\_static/logo-pywdpa.png
:target: https://ecology.ghislainv.fr/pywdpa
:alt: pywdpa
:width: 100px

.. image:: https://ecology.ghislainv.fr/deforisk-qgis-plugin/\_static/logo-forestatrisk.png
:target: https://ecology.ghislainv.fr/forestatrisk
:alt: forestatrisk
:width: 100px

.. image:: https://ecology.ghislainv.fr/deforisk-qgis-plugin/\_static/logo-riskmapjnr.png
:target: https://ecology.ghislainv.fr/riskmapjnr
:alt: riskmapjnr
:width: 100px

**Processing raster by blocks.** Raster files of forest cover change and explanatory variables might occupy a space of several gigabytes on disk. Processing such large rasters in memory can be prohibitively intensive on computers with limited RAM. Functions used in the ``deforisk`` plugin process large rasters by blocks of pixels representing subsets of the raster data. This makes computation efficient, with low memory usage. Reading and writing subsets of raster data is done by using functions from GDAL, a dependency of the plugin. Numerical computations on arrays are performed with the NumPy Python package, whose core is mostly made of optimized and compiled C code that runs quickly.

**Running tasks in parallel.** State-of-the-art approach to select the best deforestation risk map and forecast deforestation implies comparing various models, fit the models using forest cover change over different time periods and predict the deforestation risk at several dates. This implies repeating a high number of tasks. To save computation time, the ``deforisk`` plugin use the QGIS task manager which allows running several analysis in parallel.

**OS independent.** Using both computation by block for large rasters and task parallelization, the ``deforisk`` plugin allows selecting the best deforestation risk map and forecast deforestation for large countries or areas of interest in a limited amount of time, even on personal computers with average performance hardware. Because the ``deforisk`` is a QGIS plugin written in Python, it should run on all operating systems able to run QGIS, including Windows (:math:`\geq10`), Linux, and Mac OS.

Installing the ``deforisk`` plugin in Qgis
------------------------------------------

Expand Down
Binary file added help/docsrc/_images/python_pkgs/logo-far.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added help/docsrc/_images/python_pkgs/logo-geefcc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added help/docsrc/_images/python_pkgs/logo-pywdpa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added help/docsrc/_images/python_pkgs/python_pkgs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added help/docsrc/_images/python_pkgs/python_pkgs.xcf
Binary file not shown.
Binary file added help/docsrc/_static/logo-far.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added help/docsrc/_static/logo-geefcc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added help/docsrc/_static/logo-pywdpa.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added help/docsrc/_static/logo-riskmapjnr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion help/docsrc/get_started.org
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

Open QGIS on your computer. To have access to log messages, activate the "Log Messages" panel in QGIS going to =View > Panel > Log Messages= in the Menu. When using a plugin, it is also a good habit to open the Python console in QGIS to have access to Python messages returned in the console. To open it, click on the Python icon @@rst:|ico_py|@@ in the "Plugins Toolbar". If the toolbar is not visible, activate it going to =View > Toolbars > Plugins Toolbar= in the Menu.

Once the plugin has been installed (see [[file:installation.html][Installation]] instructions), open the plugin clicking on its icon @@rst:|ico_deforisk|@@. You should see the versions of the dependencies installed in your environment written in the Python console. Check that these version numbers correspond to the last version for each dependency. Otherwise upgrade your dependencies.
Once the plugin has been installed (see [[file:installation.html][Installation]] instructions), open the plugin clicking on its icon @@rst:|ico_deforisk|@@. You should see the versions of the dependencies installed in your environment written in the Python console. Check that these version numbers correspond to the last version for each dependency. Otherwise upgrade the dependencies.

#+begin_src python :results none :exports code
osmconvert 0.8.10
Expand Down
2 changes: 1 addition & 1 deletion help/docsrc/get_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Introduction

Open QGIS on your computer. To have access to log messages, activate the “Log Messages” panel in QGIS going to ``View > Panel > Log Messages`` in the Menu. When using a plugin, it is also a good habit to open the Python console in QGIS to have access to Python messages returned in the console. To open it, click on the Python icon |ico_py| in the “Plugins Toolbar”. If the toolbar is not visible, activate it going to ``View > Toolbars > Plugins Toolbar`` in the Menu.

Once the plugin has been installed (see `Installation <installation.html>`_ instructions), open the plugin clicking on its icon |ico_deforisk|. You should see the versions of the dependencies installed in your environment written in the Python console. Check that these version numbers correspond to the last version for each dependency. Otherwise upgrade your dependencies.
Once the plugin has been installed (see `Installation <installation.html>`_ instructions), open the plugin clicking on its icon |ico_deforisk|. You should see the versions of the dependencies installed in your environment written in the Python console. Check that these version numbers correspond to the last version for each dependency. Otherwise upgrade the dependencies.

.. code:: python
Expand Down

0 comments on commit 1d438ba

Please sign in to comment.