convert_qf_copernicus: Convert bit values from a QFLAG COPERNICUS product

Description Usage Arguments Value Author(s) References Examples

Description

Convert a Raster* object representing QFLAG bit values to a Raster* with two categories representing flagged and non-flagged pixels

Usage

1
convert_qf_copernicus(r,qf,cl = NULL, filename=rasterTmpFile(),...)

Arguments

r

A Raster-class object

qf

Quality Flag to be extracted. Can be more than one of these: 'sea','snow','suspect','aero_status_mixed','aero_source_climato','input_invalid','lai_invalid','fapar_invalid','fcover_invalid','b2_saturation','b3_saturation','filtered','gap_filled','ndvi_invalid'

cl

cluster object for parallel processing. Default is NULL

filename

Character vector giving the name of the output raster to save. Default is created through rasterTmpFile

...

arguments passed to writeRaster

Value

A Raster-class object with two values (1,0), representing respectively pixels that are flagged by at least one of the give qf, and pixels that are not flagged in any of the given qf

Author(s)

Antoine Stevens

References

Baret et al. 2010. BioPar Product User Manual. Geoland2: Towards an Operational GMES Land Monitoring Core Service, p. 27

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 
# Don't forget to provide in copernicus_options() your user and password details
# for COPERNICUS data portal before running this
# First, get data: NDVI_1kmV1, for JAN 2009
fn <- get_copernicus(product = 'NDVI_1kmV1', begin = '2009-01-01', end = '2009-31-01',
                     tileH = 19, tileV = 4)
fn # downloaded file names
# extract layers 3 (QFLAG) of the downladed file. Store images in the 'H19V4' folder
f <- extract_copernicus(fnames = fn,job = 'H19V4',layers = 3)
# f is the h5 file name(s)
# for each layer, the function append its name to the saved file name
# so we can change the name of the file(s) accordingly
f <- sub('\\.h5','_NDVI-QFLAG.tif',f)
# Create a rasterStack with QF bit values
library(raster)
QF <- stack(f)
# Find pixels flagged as being covered by snow
snow <- convert_qf_copernicus(QF,'snow')
plot(snow)
# Find pixels flagged as 'sea'
sea <- convert_qf_copernicus(QF,'sea')
plot(sea)
# flags can be combined
# Find pixels flagged as being suspect and with aerosol status mixed
bad <- convert_qf_copernicus(QF,c('suspect','aero_status_mixed'))
plot(bad)

## End(Not run)

antoinestevens/copernicus documentation built on May 10, 2019, 12:23 p.m.