If we want to train a model or predict with a trained model we will need input data. ForestForesight has created a lot of features that can be used as input. We will use the ff_sync option or Cyberduck to download.
Table of Contents | ||
---|---|---|
|
Method 1: Using ff_sync
To use the ff_sync function, you'll need to have R installed along with the ForestForesight package. Here's how to use it:
Code Block | ||
---|---|---|
| ||
# Set your download folderlibrary(ForestForesight)# this will load the FF library and the variables in the config.yml file # Make sure you have run ff_environment previously, # if not you have to set the parameter download_folder yourself download_folder <- "path/to/your/download/folder"Sys.getenv("FF_FOLDER") print(download_folder) #if the previous line returns empty it means your system environment variables were not set. You can then create a folder #somewhere in your file explorer and use the following line to select that folder: download_folder <- choose.dir() # Choose an identifier (country code, tile ID, or SpatVector). # ONLY RUN 1 OF THE FOLLOWING TWO LINES identifier <- "PER" # Example: Peru identifier <- shapevect(file.choose()) # Make sure this is a valid SpatVector object. # Call the ff_sync function Part 1: Download only predictions ff_sync( ff_folder = download_folder, identifier = identifier, download_data = FALSE, # Don't download input data download_groundtruth = FALSE, # Don't download ground truth download_predictions = TRUE, # Only download predictions date_start = "2023-01-01" # Only download data since 2023 ) # check the folder in your file explorer to see that in your download_folder there is now a download folder called predictions # which contains tif files for predictions for every month since the start date for the selected country or the countries # within the selected area # Part 2: Download complete dataset ff_sync( ff_folder = download_folder, identifier = identifier, features = "small model", # Download model-related features download_modeldata = TRUE, # Download input data download_datagroundtruth = TRUE, # Download ground truth download_predictions = FALSE, # Download predictions download_model = TRUE, verbose = TRUE ) # Download the model date_start = "2023-01-01" # Only download data since 2023 ) # check that now also a folder called preprocessed and a folder called models has been created. These contain # groundtruth data, preprocessed model input data and a pretrained model. # check all the other available options of ff_sync ?ff_sync |
For more information about the config file please refer to the configuration page here Open-Source Contribution .
This will download the preprocessed data, model, and predictions for Peru Laos or for the shape that you selected earlier in Loading the Area Of Interest (AOI) to the specified folder.
Method 2: Using Cyberduck
Cyberduck is a user-friendly FTP and cloud storage browser. Here's how to use it to download the ForestForesight data:
...
Download and install Cyberduck from The Cyberduck home page
...
Open Cyberduck and click on "Open Connection"
...
Choose "S3 (HTTPS)" from the dropdown menu
...
Enter the following details:
Server: http://s3.amazonaws.com
Access Key ID: (leave blank)
Secret Access Key: (leave blank)
More Options > Path: forestforesight-public
...
Click "Connect"
...
You should now see the ForestForesight bucket structure. Navigate to the folders you want:
For preprocessed data: /preprocessed/input/ and /preprocessed/groundtruth/
For models: /models/
For predictions: /predictions/
...
In the image below we explain the folder structure that was created.
...
Remember that the ForestForesight dataset is large (about 1GB per tile of 10x10 degrees and increasing over time), so downloading might take a while depending on your internet connection and how much data you're fetching.Both methods will allow you to download the preprocessed data, models, or predictions. The ff_sync
function is more programmatic and can be easily integrated into R workflows, while Cyberduck provides a user-friendly graphical interface for browsing and downloading files manually.