ghislainv / forestatrisk

📦🐍 Python package to model and forecast the risk of deforestation
https://ecology.ghislainv.fr/forestatrisk
GNU General Public License v3.0
116 stars 27 forks source link

csize impact in iCAR model #67

Closed ricardozwarg closed 2 years ago

ricardozwarg commented 2 years ago

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

ghislainv commented 2 years ago

@ricardozwarg, you are probably working in lat/long (in decimal degrees). In this case, if you set csize to 0.0001, it means that csize = 0.0001*1000 degrees = 0.1 degree (~11.1 km at the equator). If you have 12 x 12 cells, this means your study area is about 132 x 132 km, which I think is the case.

For distance and area computation, you must project your data and work with m for map unit.

ricardozwarg commented 2 years ago

@ghislainv thank you for your answer. It is clear now.

Best,