forestatrisk.countpix(input_raster, value=1, blk_rows=0)[source]

Count the number of pixels having a specific value.

Count the number of pixels (and the corresponding area in ha) having a specific value.

Parameters:
  • input_raster – Input raster file.

  • value – Target value.

  • blk_rows – if > 0, number of lines per block.

Returns:

A dictionary with the number of pixels having the specified value (npix) and the total area (area, in ha).

forestatrisk.invlogit(x)[source]

Compute the inverse-logit of a numpy array.

We differenciate the positive and negative values to avoid under/overflow with the use of exp().

Parameters:

x – Numpy array.

Returns:

Return the inverse-logit of the array.

forestatrisk.make_dir(newdir)[source]

Make new directory

  • Already exists, silently complete

  • Regular file in the way, raise an exception

  • Parent directory(ies) does not exist, make them as well

Parameters:

newdir – Directory path to create.