Skip to content

Commit

Permalink
Removing dependencies to EE API and RClone
Browse files Browse the repository at this point in the history
  • Loading branch information
ghislainv committed May 30, 2024
1 parent 1f9a3ff commit 20a8187
Show file tree
Hide file tree
Showing 20 changed files with 42 additions and 1,180 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
Changelog
=========

forestatrisk 1.2
++++++++++++++++++

* Removing dependencies to Earth Engine API and RClone which were used to interact with Google Earth Engine and Google Drive to compute and download forest and WHRC biomass data.
* Removing functions ``run_gee_forest()`` (and alias ``country_forest_run()``), ``download_forest()``, and dependencies.
* Removing functions ``run_gee_biomass_whrc()``, ``download_biomass_whrc()``, and dependencies.
* Package `geefcc <https://ecology.ghislainv.fr/geefcc/>`_ can now be used to compute and download forest from GEE.
* Adding dependency to ``geefcc``.

forestatrisk 1.1.3
++++++++++++++++++

Expand Down
6 changes: 3 additions & 3 deletions docsrc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
# import os
# import sys
import os
import sys
import datetime
import re # Regular expression
# sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('..'))


# -- Project information -----------------------------------------------------
Expand Down
13 changes: 2 additions & 11 deletions docsrc/python_api/forestatrisk.data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,10 @@ Download
--------

.. autofunction:: forestatrisk.data.country_download
.. autofunction:: forestatrisk.data.download.download_biomass_whrc
.. autofunction:: forestatrisk.data.download.download_gadm
.. autofunction:: forestatrisk.data.download.download_osm
.. autofunction:: forestatrisk.data.download.download_srtm
.. autofunction:: forestatrisk.data.download.download_wdpa

Run on GEE
----------

.. autofunction:: forestatrisk.data.run_gee_biomass_whrc
.. autofunction:: forestatrisk.data.download.download_wdpa

Compute
-------
Expand All @@ -34,12 +28,9 @@ Sample
Various
-------

.. autofunction:: forestatrisk.get_vector_extent
.. autofunction:: forestatrisk.get_vector_extent

Deprecated
----------

.. autofunction:: forestatrisk.data.download.download_forest
.. autofunction:: forestatrisk.data.run_gee_forest
.. autofunction:: forestatrisk.data.country_forest_run
.. autofunction:: forestatrisk.extent_shp
2 changes: 1 addition & 1 deletion forestatrisk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# https://peps.python.org/pep-0008/#module-level-dunder-names
__author__ = "Ghislain Vieilledent"
__email__ = "[email protected]"
__version__ = "1.1.4"
__version__ = "1.2"

# GDAL exceptions
from osgeo import gdal
Expand Down
2 changes: 0 additions & 2 deletions forestatrisk/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@
from .country_download import country_download
from .sample import sample
from .extent_shp import extent_shp, get_vector_extent
from .run_gee import run_gee_forest, run_gee_biomass_whrc
from .run_gee import country_forest_run # Alias for run_gee_forest

# EOF
2 changes: 1 addition & 1 deletion forestatrisk/data/compute/compute_forest.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def compute_forest(iso, proj, extent, verbose=False):
copts = ["COMPRESS=LZW", "PREDICTOR=2", "BIGTIFF=YES"]

# Build vrt file
tif_forest_files = glob("forest_" + iso + "*.tif")
tif_forest_files = glob("forest_*.tif")
gdal.BuildVRT("forest.vrt", tif_forest_files, callback=cback)

# Reproject
Expand Down
16 changes: 11 additions & 5 deletions forestatrisk/data/country_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@


def country_download(
iso3,
get_fcc_args,
iso3,
output_dir=".",
gadm=True,
srtm=True,
Expand All @@ -21,16 +21,22 @@ def country_download(
Function to download all the data for a specific country. It
includes GEE forest data, GADM, OSM, SRTM, and WDPA data.
:param iso3: Country iso code used to download GADM, OSM, SRTM,
and WDPA data. The iso code should correspond to the country
to which the aoi provided in ``get_fcc_args`` belongs.
.. versionadded:: 1.2
The ``get_fcc_args`` parameter.
.. versionremoved:: 1.2
The ``gdrive_remote_rclone`` and ``gdrive_folder`` parameters.
:param get_fcc_args: Dictionary of arguments for function
``get_fcc()`` from Python package ``geefcc``. For example:
``{"aoi": "MTQ", "buff": 0.08983152841195216 , "years": [2000,
2010, 2020], "source": "tmf", "perc": 75, "tile_sze": 1,
2010, 2020], "source": "tmf", "perc": 75, "tile_size": 1,
"ncpu": None, "output_file": "forest_MTQ.tiff"}``.
:param iso3: Country iso code used to download GADM, OSM, SRTM,
and WDPA data. The iso code should correspond to the country
to which the aoi provided in ``get_fcc_args`` belongs.
:param output_dir: Directory where data is downloaded. Default to
current working directory.
Expand Down
2 changes: 0 additions & 2 deletions forestatrisk/data/download/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Download geospatial data."""

from .download_biomass_whrc import download_biomass_whrc
from .download_forest import download_forest
from .download_gadm import download_gadm
from .download_osm import download_osm
from .download_srtm import download_srtm
Expand Down
62 changes: 0 additions & 62 deletions forestatrisk/data/download/download_biomass_whrc.py

This file was deleted.

47 changes: 0 additions & 47 deletions forestatrisk/data/download/download_forest.py

This file was deleted.

2 changes: 1 addition & 1 deletion forestatrisk/data/extent_shp.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get_vector_extent(input_file):
def extent_shp(input_file):
"""Compute the extent of a vector file.
.. deprecated:: 1.1.4
.. deprecated:: 1.2
Use :func:`forestatrisk.get_vector_extent`.
.. warning::
Expand Down
4 changes: 0 additions & 4 deletions forestatrisk/data/run_gee/__init__.py

This file was deleted.

139 changes: 0 additions & 139 deletions forestatrisk/data/run_gee/ee_biomass_whrc.py

This file was deleted.

Loading

0 comments on commit 20a8187

Please sign in to comment.