- get_fcc(aoi, buff=0, years=[2000, 2010, 2020], source='tmf', perc=75, tile_size=1, crop_to_aoi=False, parallel=False, ncpu=None, output_file='fcc.tif')[source]¶
Get forest cover change data.
Produce a forest cover change raster file. One band for each year. Value 1 for forest and 0 for non-forest.
- Parameters:
aoi – Area of interest defined either by a country iso code (three letters), a vector file, or an extent in lat/long (tuple with (xmin, ymin, xmax, ymax)).
buff – Buffer around the aoi. In decimal degrees (e.g. 0.08983152841195216 correspond to ~10 km at the equator).
years – List of years defining time-periods for estimating forest cover change. Years for computing forest cover change can be in the interval 2001–2024 for GFC (GFC does not provide loss for the year 2000) and 2000–2023 for TMF.
source – Either “gfc” for Global Forest Change or “tmf” for Tropical Moist Forest. If “gfc”, the tree cover threshold defining the forest must be specified with parameter
perc
.perc – Tree cover threshold defining the forest for GFC product.
tile_size – Tile size for parallel computing.
crop_to_aoi – Crop the raster GeoTIFF file to aoi with buffer. If
False
, the output file will match the grid covering the aoi with buffer.parallel – Logical. Parallel (if
True
) or sequential (ifFalse
) computing. Default toFalse
.ncpu – Number of CPU to use for parallel computing. If None, it will be set to the number of cores on the computer minus one.
output_file – Path to output GeoTIFF file. If directories in path do not exist they will be created.
- sum_raster_bands(input_file, output_file='sum.tif', blk_rows=128, verbose=True)[source]¶
Summing the raster bands.
- Parameters:
file (input) – Input file with several bands.
output_file – Output file with one band corresponding to the sum of the input bands.
blk_rows – Number of rows for block. This is used to break lage raster files in several blocks of data that can be hold in memory.
verbose – Logical. Whether to print messages or not.