Learn R Programming

spatialEco (version 2.0-2)

cgls_urls: Provide URL's for Copernicus Global Land Service datasets

Description

Returns URL's of a product/version/resolution

Usage

cgls_urls(
  dates = NULL,
  resolution = c(1000, 300),
  product = c("fapar", "fcover", "lai", "ndvi"),
  ver = c("newest", "v1", "v2", "v3")
)

Value

A vector of download URL's for the products

Arguments

dates

Dates to subset default is NULL, returns all products

resolution

The product resolution c("1km", "300m"),

product

Which product to query options are "fapar",

ver

Product version options are "newest", "v1", "v2", "v3"

Author

Jeffrey S. Evans jeffrey_evans@tnc.org

Details

Provides a query of the ESA's Copernicus Global Land Service global The query is performed on the manifest files and return URL's however, to download data you will need login credentials which, can be acquired from: http://land.copernicus.eu

If provided, dates need to be in a "YYYY-MM-DD" format. The dates are an explicit search string and can contain dates that are not in the imagery. As such, the user should generate a daily date string representing the range of the desired download as not to have to guess the available dates. Also note that multiple processing versions of a given image are retained in the manifest. This means that if you download a previous processing version, it could be an invalid image. It is highly recommended that you do not change the default ver="newest" argument unless there is a specific reason to.

Available products

  • fapar Fraction of photosynthetically active radiation absorbed by the vegetation

  • fcover Fraction of green vegetation cover

  • lai Leaf Area index

  • ndvi Normalized Difference Vegetation Index

Not yet implemented; Soil Water Index, Surface Soil Moisture, and Land Surface Temperature.

Examples

Run this code
# \donttest{
# Create date string for query
d <- seq(as.Date("2020/05/01"), as.Date("2020-09-01"), by="day")

# Search for 300m (333m) LAI within specified date range 
( dates.lai <- cgls_urls(dates = d, resolution = 300, 
                        product = "lai") )

# Return all 300m LAI 
all.lai <- cgls_urls(resolution = 300, product = "lai")
  nrow(all.lai)
# }

if (FALSE) {						 
# Example for downloading URL's
# You need to define your login credentials to download data
#   username = "xxxx"  
#   password = "xxxx" 
  
  for(i in 1:length(dates.lai)){
    if(i > 1){ Sys.sleep(3) }
    file.url <- paste0("https://", paste(username, password, sep=":"), "@", 
                       sub(".*//", "", dates.lai[i]))  
      download.file(file.url, file.path(tempdir(), 
                    basename(dates.lai[i])), mode = 'wb') 
  }
}

Run the code above in your browser using DataLab