Package 'RCGLS'

Title: Download and Open Data Provided by the Copernicus Global Land Service
Description: Download and open manifest files provided by the Copernicus Global Land Service data <https://land.copernicus.eu/global/>. The manifest files are available at: <https://land.copernicus.vgt.vito.be/manifest/>. Also see: <https://land.copernicus.eu/global/access/>. Before you can download the data, you will first need to register to create a username and password.
Authors: Willemijn Vroege [aut, cre] , Tim Jacobs [ctb], Xavier Rottlan Puig [ctb], Uwe Schmitt [ctb], ETH Zurich [cph]
Maintainer: Willemijn Vroege <[email protected]>
License: MIT + file LICENSE
Version: 1.0.3
Built: 2025-02-13 05:28:41 UTC
Source: https://github.com/cran/RCGLS

Help Index


Download CGLS data

Description

Downloads manifest files of the Copernicus Global Land Service. Registration at https://land.copernicus.eu/global/ is required.

Usage

download_CGLS_data(username, password, timeframe, product, resolution, version)

Arguments

username

Register at https://land.copernicus.eu/global/

password

Register at https://land.copernicus.eu/global/

timeframe

Time frame of interest, for example June 2019

product

Product name: fapar, fcover, lai, ndvi, ss, swi, lst, ...

resolution

1km, 300m or 100m

version

Version number: v1, v2, v3,...

Details

Check https://land.copernicus.eu/global/products/ for a product overview and product details. Check https://land.copernicus.vgt.vito.be/manifest/ for an overview for data availability in the manifest.

Value

CGLS data Data saved locally in chosen folder.

Examples

## Not run: 
#library(RCurl)
UN   <- "Willemijn" 
PW   <- "Testthis"
TF   <- seq(as.Date("2019-06-01"), as.Date("2019-06-15"), by="days")
PROD <- "fapar" #Product name: fapar, fcover, lai, ndvi,  ss, swi, lst, ...
RES  <- "1km" #1km, 300m or 100m
V    <- "v1" #Version number: v1, v2, v3, ...

download_CGLS_data(username=UN, password=PW, timeframe=TF, product=PROD, resolution=RES, version=V) 

## End(Not run)

Open netcdf CGLS data

Description

Opens single orginal data files/layers of Copernicus Global as netCDF filesLand Service as netCDF files without adjusting coordinates. Coordinate adjustment is necessary as R uses upper left corner as pixel reference and Copernicus uses pixel centre. Also see: https://land.copernicus.eu/global/products/.

Usage

nc_open_CGLS(date, product, resolution, version)

Arguments

date

Date of interest, for example for 13 june 2019: 2019-06-13

product

Product name: fapar, fcover, lai, ndvi, ss, swi, lst, ...

resolution

1km, 300m or 100m

version

Version number: v1, v2, v3,...

Details

Adjusting coordinates is a necessary step to use the data because Copernicus nc files have lat/long belonging to the centre of the pixel, and R uses upper/left corner. This function opens the data without any corrections.

Value

CGLS data Opens single netcdf file in environment

Note

Coordinates are shifted and need to be adjusted, for example by: if(resolution == "300m") lon <- lon - (1/336)/2 lat <- lat + (1/336)/2 if(resolution == "1km") lon <- lon - (1/112)/2 lat <- lat + (1/112)/2

Examples

## Not run: 
library(ncdf4)
DATE       <- "2019-06-13" #Date of interest, for example for 13 june 2019: 2019-06-13
PROD    <- "fapar" #Product name: fapar, fcover, lai, ndvi,  ss, swi, lst, ...
RES  <- "1km" #1km, 300m or 100m
V    <- "v1" #Version number: v1, v2, v3, ...

nc      <- nc_open_CGLS   (date=DATE, product=PROD, resolution=RES, version=V)

## End(Not run)

Read netcdf CGLS data

Description

Read single layers of Copernicus Global Land Service (CGLS) data and adjusts coordinates for R.

Usage

ncvar_get_CGSL(date, product, resolution, version, variable)

Arguments

date

Date of interest, for example for 13 june 2019: 2019-06-13

product

Product name: fapar, fcover, lai, ndvi, ss, swi, lst, ...

resolution

1km, 300m or 100m

version

Version number: v1, v2, v3,...

variable

FAPAR_ERR, FAPAR_QFLAG... Also see https://land.copernicus.eu/global/products/

Details

Adjusting coordinates is a necessary step to use the data because Copernicus nc files have lat/long belonging to the centre of the pixel, and R uses upper/left corner. This function opens the data without any corrections.

Value

CGLS data Large matrix of a specific variable in environment, coordinates adjusted.

Examples

## Not run: 
#' library(ncdf4)
DATE <- "2019-06-13" #Date of interest, for example for 13 june 2019: 2019-06-13
PROD <- "fapar" #Product name: fapar, fcover, lai, ndvi,  ss, swi, lst, ...
RES  <- "1km" #1km, 300m or 100m
V    <- "v1" #Version number: v1, v2, v3, ...
VAR  <- "FAPAR" #FAPAR_ERR, FAPAR_QFLAG... Also see https://land.copernicus.eu/global/products/

nc_data <- ncvar_get_CGSL (date=DATE, product=PROD, resolution=RES, version=V, variable=VAR)

## End(Not run)

stack CGLS data

Description

Read all downloaded files from Copernicus Global Land Service within a timeframe as Raster Stack and adjusts coordinates for R.

Usage

stack_CGLS (timeframe, product, resolution, version, variable)

Arguments

timeframe

Time frame of interest, for example June 2019

product

Product name: fapar, fcover, lai, ndvi, ss, swi, lst, ...

resolution

1km, 300m or 100m

version

Version number: v1, v2, v3,...

variable

Variable name: FAPAR_ERR, FAPAR_QFLAG... Also see https://land.copernicus.eu/global/products/

Details

Adjusting coordinates is a necessary step to use the data because Copernicus nc files have lat/long belonging to the centre of the pixel, and R uses upper/left corner.

Value

CGLS data Raster Stack

Examples

## Not run: 
library(raster)
TF    <- seq(as.Date("2019-06-01"), as.Date("2019-06-31"), by="days")
PROD  <- "fapar" #Product name: fapar, fcover, lai, ndvi,  ss, swi, lst, ...
RES   <- "1km" #1km, 300m or 100m
V     <- "v1" #Version number: v1, v2, v3, ...
VAR   <- "FAPAR" #FAPAR_ERR, FAPAR_QFLAG... Also see https://land.copernicus.eu/global/products/
data  <- stack_CGLS(timeframe=TF, product=PROD, resolution=RES, version=V, variable=VAR)

## End(Not run)