forestatrisk.deforest_diffusion(forest_t0, t0, annual_defor, t)[source]

Diffusion of the deforestation between states of a country.

Diffusion of the deforestation between states of a country. We suppose that the deforestation is constant at the country level. When a state has no more forest, its deforestation (annual area of deforestation) is attributed to the other states of the country still having forest. This function can be useful for Brazil for example.

Parameters:
  • forest_t0 – Forest area at t0 for each state. Numpy array.

  • t0 – Year at t0.

  • annual_defor – Annual deforestation for each state. Numpy array.

  • t – Year at the end of the deforestation period.

Returns:

A dictionnary with forest at t0 (“forest_t0”), forest at time t (“forest_t”) and deforestation between t0 and t (“defor_t0_t”).

forestatrisk.deforest_diffusion_t_nofor(forest_t0, t0, annual_defor)[source]

Compute the number of years until there is no forest in each state for of a deforestation with diffusion.

Compute the number of years until there is no forest in each state for of a deforestation with diffusion. When a state has no more forest, its deforestation (annual area of deforestation) is attributed to the other states of the country still having forest. This function can be useful for Brazil for example.

Parameters:
  • forest_t0 – Forest area at t0 for each state. Numpy array.

  • t0 – Year at t0.

  • annual_defor – Annual deforestation for each state. Numpy array.

Returns:

A dictionnary indicating the number of years (“ny”), for each state, after which all the forest will have disappeared, and the corresponding year (“y”, assuming forest_t0 was estimated at the beginning of the year).

forestatrisk.deforest(input_raster, hectares, output_file='output/fcc.tif', blk_rows=128)[source]

Function to map the future forest-cover change.

This function computes the future forest cover map based on (i) a raster of probability of deforestation (rescaled from 1 to 65535), and (ii) a surface (in hectares) to be deforested.

Parameters:
  • input_raster – Raster of probability of deforestation (1 to 65535 with 0 as nodata value).

  • hectares – Number of hectares to deforest.

  • output_file – Name of the raster file for forest cover map.

  • blk_rows – If > 0, number of rows for block (else 256x256).

  • figsize – Figure size in inches.

  • dpi – Resolution for output image.

Returns:

A dictionary of statistics (counts, hectares, threshold, error, error_perc, ndp, nfp).

  • counts: histogram of deforestation probabilities.

  • hectares: number of hectares to be deforested.

  • threshold: probability threshold above which (>=) pixels are deforested.

  • error: difference between hectares to be deforested and hectares trully deforested (in ha).

  • error_perc: percentage of error (must be < 1%).

  • ndp: number of deforested pixels.

  • nfp: number of forest pixels before deforestation.

forestatrisk.emissions(input_stocks='data/emissions/AGB.tif', input_forest='output/forest_cover_2050.tif', coefficient=0.47, blk_rows=128)[source]

Predict the carbon emissions associated to future deforestation.

This function predicts the carbon emissions associated to future deforestation. Computation are done by block and can be performed on large geographical areas.

Parameters:
  • input_stocks – Path to raster of biomass or carbon stocks (in Mg/ha).

  • input_forest – Path to forest-cover change raster (0=deforestation).

  • coefficient – Coefficient to convert stocks in MgC/ha (can be 1).

  • blk_rows – If > 0, number of rows for computation by block.

Returns:

Emissions of carbon in MgC.