Code Monkey home page Code Monkey logo

ghislainv / forestatrisk Goto Github PK

View Code? Open in Web Editor NEW
114.0 6.0 27.0 89.97 MB

πŸ“¦πŸ Python package to model and forecast the risk of deforestation

Home Page: https://ecology.ghislainv.fr/forestatrisk

License: GNU General Public License v3.0

C 12.37% Python 75.80% Shell 3.97% Makefile 0.20% CSS 0.05% TeX 7.61%
python land-use-change spatial-modelling spatial-analysis forecasting spatial-autocorrelation tropical-forests roads protected-areas biodiversity-scenario

forestatrisk's Introduction

πŸ‘‹ Hi, I'm Ghislain 😊

I am an ecologist at Cirad (https://www.cirad.fr), a French research center working with developing countries to tackle environmental and development issues. I am conducting research projects in community ecology 🌱 🌿 🌲 🌳 πŸ‚, conservation biology 🌳 πŸ”₯ 🐦 🦍 🌍, and applied statistics ✏️ πŸ“ πŸ’» πŸ“Š πŸ“‰. More info at https://ecology.ghislainv.fr.

banner

forestatrisk's People

Contributors

12rambau avatar danielskatz avatar ethanwhite avatar ghislainv avatar kbarnhart avatar molgor avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

forestatrisk's Issues

[JOSS Review] Missing links in Community Guidelines

Hi @ghislainv,

I'm reviewing your software for publication in the JOSS. The journal requires instructions for collaborators and contributors detailed in a community guideline and a code of conduct.
The Β΄README.mdΒ΄ file includes a section for these items but the links to these resources seem broken.

Cheers,

Juan

Forest cover input

Hi @ghislainv

I'm quite confused about the forest cover map that is requested as input for the function far.sample. In the documentation I found the following information associate to it: param input_forest_raster: Name of the forest raster file (1=forest, 0=deforested) in the var_dir directory..

Considering it, I'm assuming for instance that 1 should be equal to the remaining forest, and 0 to the amout of deforestation observed during the time period considered. However, I am not sure how to generate this kind of input, since in my head I will need to assign null values for all other pixels that are not remaing forest (class 1) or even deforestation during the period of interest (class 0).

So, the first question is, how to generate this kind of input? using GEE or Python.

Nevertheless, I tried to running the model with two explanation vaiables (SRTM and slope) to see what will happen using as input a raster file with 1 been the remaining forest, and 0 all the rest, because I was not capable to eliminate the pixels that are not deforestation during the period analysed. As a result I got an error, that I will be sharing below. My guess is that this observed error is associate with my input.

I also sharing my progress with a link for google earth engine, and also information about the data I'm using, as well the error message that I got trying to run the package with jupyter notebook.

Thank you in advance @ghislainv

Best from Brazil,

Ricardo

Link to the script on GEE: https://code.earthengine.google.com/d505cf980983d44be7efe4b7d8517dc6
Link to the deforestation asset: https://code.earthengine.google.com/?asset=users/Jurupari/PDigital2000_2021_AMZ
Link to the study area asset: https://code.earthengine.google.com/?asset=users/Jurupari/RRL

error observed.txt

PDigital2000_2021_AMZ.txt

[JOSS Review] Automated test failed

Hi @ghislainv,

The automated tests (located in tests) failed. I'm appending the obtained output.

(conda-far) otus:forestatrisk juan$ py.test
========================================== test session starts ==========================================
platform darwin -- Python 3.7.7, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /.../JOSS/forestatrisk
collected 17 items

test/test_get_started.py ......FF........                                                         [ 94%]
test/test_import.py .                                                                             [100%]

=============================================== FAILURES ================================================
_______________________________________ test_model_binomial_iCAR ________________________________________

gstart = {'adj': array([ 1, 11, 12,  0,  2, 11, 12, 13,  1,  3, 12, 13, 14,  2,  4, 13, 14,
       15,  3,  5, 14, 15, 16,  4, ...       5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5,
       3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3]), ...}

    def test_model_binomial_iCAR(gstart):

        p = np.array([0.34388896, 0.29002158, 0.51594223, 0.48436339,
                      0.60838453, 0.61257058, 0.55034979, 0.58819568,
                      0.51087469, 0.58819568, 0.64149789, 0.57400436,
                      0.59570952, 0.63212285, 0.566676, 0.62562204,
                      0.55379459, 0.15644965, 0.61284327, 0.36638686,
                      0.55439297, 0.57325744, 0.62562204, 0.17995823,
                      0.4930868, 0.54641479, 0.59782004, 0.48159526,
                      0.62882886, 0.59831051, 0.76245777, 0.74576097,
                      0.77356767, 0.73863295, 0.78188891, 0.75056545,
                      0.60775752, 0.64978574, 0.74654465, 0.77378323,
                      0.53994416, 0.75852715, 0.77754366, 0.60053684,
                      0.71543739, 0.74565542, 0.7555028, 0.44598923,
                      0.76401273, 0.75953027, 0.49027142, 0.69610182,
                      0.75679461, 0.78543649, 0.76863321, 0.6209473,
                      0.77653139, 0.76182804, 0.78169681, 0.58816002,
                      0.50453473, 0.77980428, 0.76084413, 0.73054832,
                      0.78289747, 0.71858934, 0.78362842, 0.74702923,
                      0.67357571, 0.78940242, 0.75358937, 0.66791346,
                      0.75602843, 0.42494845, 0.77653139, 0.60509306,
                      0.60846943, 0.76187008, 0.73278992, 0.72792572,
                      0.47661681, 0.59456417, 0.71894598, 0.6731302,
                      0.74964489, 0.77247818, 0.78289747, 0.74200682,
                      0.78940242, 0.78508877, 0.73153419, 0.65636031,
                      0.78607775, 0.59738545, 0.72596162, 0.78216462,
                      0.75078253, 0.77527468, 0.69907386, 0.71991522])

>       assert np.allclose(gstart["pred_icar"][0:100], p)
E       assert False
E        +  where False = <function allclose at 0x10435e8c0>(array([0.38174266, 0.34110367, 0.49796017, 0.4767064 , 0.56710096,\n       0.57024475, 0.5418506 , 0.55263309, 0.512898...77, 0.67407704, 0.77655815, 0.57789   , 0.76288142,\n       0.77055253, 0.73327539, 0.76372531, 0.67347268, 0.68633676]), array([0.34388896, 0.29002158, 0.51594223, 0.48436339, 0.60838453,\n       0.61257058, 0.55034979, 0.58819568, 0.510874...19, 0.65636031, 0.78607775, 0.59738545, 0.72596162,\n       0.78216462, 0.75078253, 0.77527468, 0.69907386, 0.71991522]))
E        +    where <function allclose at 0x10435e8c0> = np.allclose

/../forestatrisk/test/test_get_started.py:132: AssertionError
_______________________________________________ test_rho ________________________________________________

gstart = {'adj': array([ 1, 11, 12,  0,  2, 11, 12, 13,  1,  3, 12, 13, 14,  2,  4, 13, 14,
       15,  3,  5, 14, 15, 16,  4, ...       5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 5, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5,
       3, 5, 5, 5, 5, 5, 5, 5, 5, 5, 3]), ...}

    def test_rho(gstart):

        r = np.array([-3.72569484e-02, -1.16871478e-01, -1.82400711e-01,
                      2.13446770e-01, -6.44591325e-01, -9.89850864e-02,
                      1.10439030e-01, -2.31551563e-02, -3.30273946e-01,
                      -2.66995061e-01, -3.84426210e-01, 5.73572517e-02,
                      -5.73353804e-02, -3.12497338e-01, -8.37127591e-01,
                      7.62072575e-02, 3.86361945e-01, 1.26487021e-02,
                      -8.22069815e-02, -3.60656850e-01, -5.46586761e-01,
                      -4.17346094e-01, 1.05212875e+00, -4.32508096e-02,
                      -4.49589533e-01, -6.89872259e-01, -4.91230799e-01,
                      -3.84040358e-01, 5.67299746e-01, -2.10071117e-01,
                      -1.07456253e+00, -6.69339978e-01, -6.21974970e-01,
                      2.15020267e+00, -7.16437085e-02, -4.46424607e-01,
                      -2.17259138e-01, -3.30043032e-01, -2.59613996e-01,
                      2.68845283e-01, -3.78046974e-01, -5.18108829e-01,
                      -6.18235133e-01, -7.59652734e-01, 1.51771355e+00,
                      1.75357016e+00, -8.01814048e-02, 1.99270623e-01,
                      -1.75157345e-01, -6.10561635e-02, -1.26099802e-01,
                      -1.77864133e-01, -3.03381214e-01, -5.29892286e-01,
                      -5.47125418e-01, 1.30320979e+00, 2.37670385e+00,
                      4.97829325e-01, 8.88668246e-01, 3.92682659e-01,
                      -6.56913949e-03, -2.95774565e-01, -5.15489012e-01,
                      -6.01407176e-01, -5.67695385e-01, -6.48479745e-01,
                      1.47482553e+00, 1.45848019e+00, 4.05321503e-01,
                      1.06327906e+00, 4.37780456e-01, -1.12202021e-01,
                      -7.22139489e-01, -7.33312519e-01, -6.68442058e-01,
                      -7.76218335e-01, -8.02763852e-01, 1.41620727e+00,
                      1.56564133e+00, 1.24252305e+00, 9.07095194e-01,
                      4.38959947e-01, -2.95546782e-01, -4.92024764e-01,
                      -9.62965263e-01, -8.93107795e-01, -9.80673724e-01,
                      -9.94878624e-01, 1.41460696e+00, 1.38942057e+00,
                      1.97092977e+00, 1.06797639e+00, 4.36803818e-01,
                      2.15296806e-03, -6.14110567e-01, -7.76157636e-01,
                      -9.47693103e-01, -1.05424592e+00, -1.12226096e+00])

>       assert np.allclose(gstart["rho"], r)
E       assert False
E        +  where False = <function allclose at 0x10435e8c0>(array([ 0.0624157 , -0.15277958, -0.38287764,  0.23009508, -0.850125  ,\n       -0.24314522, -0.19327062, -0.58031306, ...36883 ,  1.16946349,  0.45945857, -0.15399801, -0.61728853,\n       -0.6482013 , -0.57797415, -0.38994641, -0.25915156]), array([-3.72569484e-02, -1.16871478e-01, -1.82400711e-01,  2.13446770e-01,\n       -6.44591325e-01, -9.89850864e-02,  1...3818e-01,  2.15296806e-03, -6.14110567e-01, -7.76157636e-01,\n       -9.47693103e-01, -1.05424592e+00, -1.12226096e+00]))
E        +    where <function allclose at 0x10435e8c0> = np.allclose

/../forestatrisk/test/test_get_started.py:171: AssertionError
=========================================== warnings summary ============================================
../../../miniconda3/envs/conda-far/lib/python3.7/site-packages/osgeo/__init__.py:8
  /../miniconda3/envs/conda-far/lib/python3.7/site-packages/osgeo/__init__.py:8: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses
    import imp

../../../miniconda3/envs/conda-far/lib/python3.7/site-packages/patsy/constraint.py:13
  /../miniconda3/envs/conda-far/lib/python3.7/site-packages/patsy/constraint.py:13: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working
    from collections import Mapping

-- Docs: https://docs.pytest.org/en/stable/warnings.html
======================================== short test summary info ========================================
FAILED test/test_get_started.py::test_model_binomial_iCAR - assert False
FAILED test/test_get_started.py::test_rho - assert False
=============================== 2 failed, 15 passed, 2 warnings in 51.58s ===============================
:100.0%, mean accept. rates= beta:0.350, rho:0.443

Is it my side?
I don't have much idea of what could it be. However, the getting started tutorial worked 100% and the installation process showed no problems.

Cheers,

Juan

Compute the forest data but HTTP error and doesn’t recognize BRA-AC--reverts to Caledonia extent--error: no driver to open shape file for Brazil!?

Rconfig points to all the right folders in terminal...

Compute gee forest data

far.data.country_forest_run(
iso3, proj="EPSG:4326",
output_dir="data_raw",
keep_dir=True,
fcc_source="jrc", perc=50,
gdrive_remote_rclone="gdrive_xxx",
gdrive_folder="GEE-forestatrisk-notebooks")

HTTPError Traceback (most recent call last)
/var/folders/hv/rrx0n8mj291dq3qrfcb9x9bw0000gn/T/ipykernel_68748/465982169.py in <cell line: 2>()
1 # Compute gee forest data
----> 2 far.data.country_forest_run(
3 iso3, proj="EPSG:4326",
4 output_dir="data_raw",
5 keep_dir=True,

~/opt/miniconda3/envs/FAR/lib/python3.10/site-packages/forestatrisk/build_data/data.py in country_forest_run(iso3, proj, output_dir, keep_dir, fcc_source, perc, gdrive_remote_rclone, gdrive_folder)
137 fname = output_dir + "/" + iso3 + "shp.zip"
138 url = "http://biogeo.ucdavis.edu/data/gadm3.6/shp/gadm36
" + iso3 + "_shp.zip"
--> 139 urlretrieve(url, fname)
140
141 # Extract files from zip

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in urlretrieve(url, filename, reporthook, data)
239 url_type, path = _splittype(url)
240
--> 241 with contextlib.closing(urlopen(url, data)) as fp:
242 headers = fp.info()
243

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in urlopen(url, data, timeout, cafile, capath, cadefault, context)
214 else:
215 opener = _opener
--> 216 return opener.open(url, data, timeout)
217
218 def install_opener(opener):

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in open(self, fullurl, data, timeout)
523 for processor in self.process_response.get(protocol, []):
524 meth = getattr(processor, meth_name)
--> 525 response = meth(req, response)
526
527 return response

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in http_response(self, request, response)
632 # request was successfully received, understood, and accepted.
633 if not (200 <= code < 300):
--> 634 response = self.parent.error(
635 'http', request, response, code, msg, hdrs)
636

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in error(self, proto, *args)
555 http_err = 0
556 args = (dict, proto, meth_name) + args
--> 557 result = self._call_chain(*args)
558 if result:
559 return result

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
494 for handler in handlers:
495 func = getattr(handler, meth_name)
--> 496 result = func(*args)
497 if result is not None:
498 return result

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in http_error_302(self, req, fp, code, msg, headers)
747 fp.close()
748
--> 749 return self.parent.open(new, timeout=req.timeout)
750
751 http_error_301 = http_error_303 = http_error_307 = http_error_302

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in open(self, fullurl, data, timeout)
523 for processor in self.process_response.get(protocol, []):
524 meth = getattr(processor, meth_name)
--> 525 response = meth(req, response)
526
527 return response

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in http_response(self, request, response)
632 # request was successfully received, understood, and accepted.
633 if not (200 <= code < 300):
--> 634 response = self.parent.error(
635 'http', request, response, code, msg, hdrs)
636

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in error(self, proto, *args)
555 http_err = 0
556 args = (dict, proto, meth_name) + args
--> 557 result = self._call_chain(*args)
558 if result:
559 return result

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
494 for handler in handlers:
495 func = getattr(handler, meth_name)
--> 496 result = func(*args)
497 if result is not None:
498 return result

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in http_error_302(self, req, fp, code, msg, headers)
747 fp.close()
748
--> 749 return self.parent.open(new, timeout=req.timeout)
750
751 http_error_301 = http_error_303 = http_error_307 = http_error_302

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in open(self, fullurl, data, timeout)
523 for processor in self.process_response.get(protocol, []):
524 meth = getattr(processor, meth_name)
--> 525 response = meth(req, response)
526
527 return response

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in http_response(self, request, response)
632 # request was successfully received, understood, and accepted.
633 if not (200 <= code < 300):
--> 634 response = self.parent.error(
635 'http', request, response, code, msg, hdrs)
636

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in error(self, proto, *args)
561 if http_err:
562 args = (dict, 'default', 'http_error_default') + orig_args
--> 563 return self._call_chain(*args)
564
565 # XXX probably also want an abstract factory that knows when it makes

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in _call_chain(self, chain, kind, meth_name, *args)
494 for handler in handlers:
495 func = getattr(handler, meth_name)
--> 496 result = func(*args)
497 if result is not None:
498 return result

~/opt/miniconda3/envs/FAR/lib/python3.10/urllib/request.py in http_error_default(self, req, fp, code, msg, hdrs)
641 class HTTPDefaultErrorHandler(BaseHandler):
642 def http_error_default(self, req, fp, code, msg, hdrs):
--> 643 raise HTTPError(req.full_url, code, msg, hdrs, fp)
644
645 class HTTPRedirectHandler(BaseHandler):

HTTPError: HTTP Error 404: Not Found

CalledProcessError after running country_forest_run

Hi @ghislainv could you please give me some help here? I'm totally stuck with this error. I've tried several alternatives and haven't been able to resolve it. Any tips will help me a lot. Thanks.

far.data.country_forest_run(
iso3, proj="EPSG:4326",
output_dir="data_raw",
keep_dir=True,
fcc_source="gfc", perc=90,
gdrive_remote_rclone="gdrive_zwarg",
gdrive_folder="GEE-forestatrisk-notebooks")


CalledProcessError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_15332/1526280857.py in
6 fcc_source="gfc", perc=90,
7 gdrive_remote_rclone="gdrive_zwarg",
----> 8 gdrive_folder="GEE-forestatrisk-notebooks")

~\miniconda3\envs\conda-far\lib\site-packages\forestatrisk\build_data\data.py in country_forest_run(iso3, proj, output_dir, keep_dir, fcc_source, perc, gdrive_remote_rclone, gdrive_folder)
170 # Check data availability
171 data_availability = ee_gfc.check(gdrive_remote_rclone,
--> 172 gdrive_folder, iso3)
173 # If not available, run GEE
174 if data_availability is False:

~\miniconda3\envs\conda-far\lib\site-packages\forestatrisk\build_data\ee_gfc.py in check(gdrive_remote_rclone, gdrive_folder, iso3)
125 cmd = ["rclone", "lsf", "--include", pattern, remote_path]
126 cmd = " ".join(cmd)
--> 127 out = subprocess.check_output(cmd, shell=True).decode("utf-8")
128 # Filename to find
129 fname = "forest_" + iso3

~\miniconda3\envs\conda-far\lib\subprocess.py in check_output(timeout, *popenargs, **kwargs)
409
410 return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
--> 411 **kwargs).stdout
412
413

~\miniconda3\envs\conda-far\lib\subprocess.py in run(input, capture_output, timeout, check, *popenargs, **kwargs)
510 if check and retcode:
511 raise CalledProcessError(retcode, process.args,
--> 512 output=stdout, stderr=stderr)
513 return CompletedProcess(process.args, retcode, stdout, stderr)
514

CalledProcessError: Command 'rclone lsf --include 'forest_BRA*.tif' gdrive_zwarg:GEE-forestatrisk-notebooks' returned non-zero exit status 1.

Annual forest loss

Create a function to compute the historical mean annual deforestation rate (in ha).

Forest pixel with NA

When a forest pixel has NA as value for environmental variables, the spatial probability of deforestation cannot be computed for that forest pixel. It might happen for example for forest pixels close to the sea (mangroves) where the SRTM data is not provided. Write a function to empty holes with neighboring probability values.

Eg. Coast for Equatorial Guinea. Aspect and slope are not computed on the 90m along the coast. Also some forest pixels have NA values for aspect when slope=0.

far.predict_raster_binomial_iCAR

Dear @ghislainv

Could you please explain what is the forest_t3.tif that you have been used in the far.predict_raster_binomial_iCAR? I'm assuming that t1 in your example is forest in 2010, and t2 forest in 2020. So, what about t3?

Thank you,

All the best

Ricardo.

csize impact in iCAR model

Dear @ghislainv

How are you?

I want to bring here a question about the csize parameter in the functions far.sample and far.cellneigh, and their relation with the performance of the iCAR model.

To be more specific, when I run the iCAR model by setting the csize equal to 10 in the functons cited above, wich is the same value that you have been work with in the Get Started example, the model crashes taking a long time to respond. So, after several minutes I decided to interrompe the model and set the csize equal to 0.0001, and it solved the problem. But I'm still confuse what should be a acceptable csize according to the size of my area of interest (in this case ~ 1,5 millions hectares), and what is the impact of the csize in the model outputs.

Thank you very much @ghislainv

Using csize equal to 10 I got:

Compute number of 10 x 10 km spatial cells
... 1 cells (1 x 1)
Identify adjacent cells and compute number of neighbors

Changing the csize from 10 to 0.0001:

Compute number of 0.0001 x 0.0001 km spatial cells
... 144 cells (12 x 12)
Identify adjacent cells and compute number of neighbors

Carbon emissions

Create a function to compute carbon emissions associated to future deforestation.

Installation testing

I did the installation via conda as described here and when testing the installation by running "forestatrisk" I get this import error:

no display found. Using non-interactive Agg backend
RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
Traceback (most recent call last):`
  File "c:\users\felip\miniconda3\envs\conda-far\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\felip\miniconda3\envs\conda-far\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\felip\miniconda3\envs\conda-far\Scripts\forestatrisk.exe\__main__.py", line 4, in <module>
  File "c:\users\felip\miniconda3\envs\conda-far\lib\site-packages\forestatrisk\__init__.py", line 29, in <module>
    from .model import cellneigh, cellneigh_ctry
  File "c:\users\felip\miniconda3\envs\conda-far\lib\site-packages\forestatrisk\model\__init__.py", line 13, in <module>
    from .model_binomial_iCAR import model_binomial_iCAR
  File "c:\users\felip\miniconda3\envs\conda-far\lib\site-packages\forestatrisk\model\model_binomial_iCAR.py", line 24, in <module>
    from .. import hbm
ImportError: numpy.core.multiarray failed to import

Forest Cover Change Dataset

I have been trying to replicate this methodology to my study area, and I have had a few challenges, and a help from you will be great.

My challenge lies around the Land cover change datasets. From creating sample points in line 4 of your code right up till interpolate spatial random effects in line 9, the land cover change datasets used is "fcc23.tif". But in line 10 of your code in compute prediction the input_forest_raster makes use of "forest_t3.tif" which is different from the previous dataset you have been using, and it got me all confused.

So I wish to ask if you can please provide me with the methodology you used in creating the forest cover change dataset. Because what I did was created a supervised classification land use land cover map of my area for the year 2000 and 2021 then performed post-classification analysis to get the land cover change dataset for my area. But from the datasets you used, there are different types of forest cover change datasets.

ReadAsArray and NoData

In function emissions.py, there is a problem when setting NoData to zero. The NoData value in the raster has not the exact same value as the NoData value in the array obtained with ReadAsArray. Maybe a type problem.

change gdal dependency to pygdal ?

install_requires=["earthengine-api", "gdal", "numpy", "matplotlib",

You define as a dependency gdal which is the worst possible neighbore in a python environment. What would you say if instead we use the saythised ersion of it: pygdal ?

I don't know what gdal is used for but if it's possible to get fully rid of it it's even better (it's embeded in the wheel of rasterio, rioxarray, geopandas)

Replace sklearn in dependencies

Replace witk scikit-learn or statsmodels to avoid having multiple dependencies and to avoid having to install these three packages for the tutorial.

Overview forest cover 2050

Due to the way pyramids are computed, ares with forest loss do not appear in red (cf. difference with probability of deforestation). It should be better to make new figures and png files correcting that.

drop gdal

As you can imagine I would like to set this as a module in SEPAL (and outside as well) but to do that I would need to drop the gdal requirements of the lib.

I can start the modifications in a PR but i would need some support to make sure I don't break anything.

Would you have some time for small support ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.