forestables
2024-07-05
Adriana Tovar-Rodríguez
Ecosystem Modelling Facility - CREAFVíctor Granda-García
Ecosystem Modelling Facility - CREAFEcosystem Modelling Facility
Ecosystem Modelling Facility - CREAFforestables
Read and uniformize forest inventories data from the FIA (USA forest inventory), FFI (France forest inventory) and IFN (Spain forest inventory).
Installation
You can install the development version of forestables from GitHub with:
1# install.packages("devtools")
2devtools::install_github("emf-creaf/forestables")
Inventories files
forestables
offers download functions to get the inventory files from
the official websites from each inventory:
We recommend to manually download and unzip the data in the desired folder. Download functions are offered as helpers for programmatically approaches, but users should be careful as data can be missing due to connection errors, link changes…
Example
Download FFI (France forest inventory) and extract all plots from the Loire department for 2015:
1library(forestables)
2#> Loading required package: data.table
3#> Loading required package: dtplyr
1library(dplyr)
2#>
3#> Attaching package: 'dplyr'
4#> The following objects are masked from 'package:data.table':
5#>
6#> between, first, last
7#> The following objects are masked from 'package:stats':
8#>
9#> filter, lag
10#> The following objects are masked from 'package:base':
11#>
12#> intersect, setdiff, setequal, union
1
2## Downloading all FFI data (if not already)
3ffi_path <- tempdir()
4download_inventory("FFI", destination = ffi_path)
5#> ℹ Downloading FFI available data
6#> ℹ Unzipping downloaded data in '/tmp/RtmpySZ2h0'
7#> ✔ Done!
1
2## Get the plots
3loire_plots_2015 <- ffi_to_tibble(
4 "42",
5 years = 2015,
6 folder = ffi_path
7) |>
8 clean_empty(c("tree", "shrub", "regen")) |>
9 inventory_as_sf()
10#> Start
11#> ℹ Processing 1 year
12#> Getting ready to retrieve 113 plots for 2015
13#>
14#> Attaching package: 'purrr'
15#>
16#>
17#> The following object is masked from 'package:data.table':
18#>
19#> transpose
1
2## Explore the plots
3loire_plots_2015
4#> Simple feature collection with 50 features and 15 fields
5#> Geometry type: POINT
6#> Dimension: XY
7#> Bounding box: xmin: 3.70236 ymin: 45.27425 xmax: 4.739146 ymax: 46.20189
8#> Geodetic CRS: WGS 84
9#> # A tibble: 50 × 16
10#> crs id_unique_code year plot coord_sys_orig aspect slope country dep
11#> <dbl> <chr> <dbl> <chr> <chr> <dbl> <int> <chr> <chr>
12#> 1 4326 FR_42_1000969 2015 1000969 LAMBERT 342 12 FR 42
13#> 2 4326 FR_42_1002527 2015 1002527 LAMBERT 189 36 FR 42
14#> 3 4326 FR_42_1002664 2015 1002664 LAMBERT 54 26 FR 42
15#> 4 4326 FR_42_1003986 2015 1003986 LAMBERT 47.7 44 FR 42
16#> 5 4326 FR_42_1005427 2015 1005427 LAMBERT 153 7 FR 42
17#> 6 4326 FR_42_1005981 2015 1005981 LAMBERT 130. 25 FR 42
18#> 7 4326 FR_42_1006115 2015 1006115 LAMBERT 270 40 FR 42
19#> 8 4326 FR_42_1006386 2015 1006386 LAMBERT 324 22 FR 42
20#> 9 4326 FR_42_1006791 2015 1006791 LAMBERT 266. 45 FR 42
21#> 10 4326 FR_42_1006998 2015 1006998 LAMBERT NA 0 FR 42
22#> # ℹ 40 more rows
23#> # ℹ 7 more variables: dep_name <chr>, visite <int>, tree <list>,
24#> # understory <list>, regen <list>, geometry <POINT [°]>, crs_orig <dbl>