Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

It is important to note that ff_prep will take the last previous date for every month for every feature, as illustrated below.

...

Exercises

  1. Basic Usage:
    Create a simple call to ff_prep for a specific country and date range.

Code Block
languager
library(ForestForesight)

prepared_data <- ff_prep(
  datafolder = "/path/to/your/data",
  country = "BRASUR",
  dates = ForestForesight::daterange("20222023-01-01", "20222023-1206-3101"),
  sample_size = 0.2
)

print(names(prepared_data))
print(head(prepared_data$data_matrix$features))

...

Code Block
languager
library(terra)

# Create a simple polygon
custom_shape <- vect("POLYGON((-60 -1072.8 2.5, -55 -1072.3 2.5, -55 -572.3 2.8, -60 -572.8 2.8, -60 -1072.8 2.5))", crs="EPSG:4326")

prepared_data <- ff_prep(
  datafolder = "/path/to/your/data",
  shape = custom_shape,
  dates = "2023-01-01",
  fltr_features = "initialforestcover",
  fltr_condition = ">0"
)

print(prepared_data$features)

...

Code Block
languager
prepared_data <- ff_prep(
  datafolder = "/path/to/your/data",
  country = "PERSUR",
  dates = cForestForesight::daterange("20222023-0601-01", "20222023-1206-01"),
  inc_features = c("slope", "elevation", "precipitation"),
  exc_features = "temperature"
)

print(prepared_data$features)

...

Code Block
languager
prepared_data <- ff_prep(
  datafolder = "/path/to/your/data",
  country = "COLSUR",
  dates = ForestForesight::daterange("2023-01-01", "2023-1206-3101"),
  sample_size = 0.5,
  validation_sample = 0.2
)

print(dim(prepared_data$data_matrix$features))
print(dim(prepared_data$validation_matrix$features))

...

Code Block
languager
prepared_data <- ff_prep(
  datafolder = "/path/to/your/data",
  country = "IDNSUR",
  dates = "2023-01-01",
  fltr_features = c("elevation", "slope"),
  fltr_condition = c(">100", "<30")
)

print(nrow(prepared_data$data_matrix$features))

...