modisClean: Clean Modis files

Description Usage Arguments Details Value Author(s) References Examples

View source: R/modisClean.R

Description

Remove cloud cover, snow, permanent water and missing values from raw Modis files using the MODIS quality control flags. Requires the bitops package

Usage

1
modisClean(inpath, outformat="raster", tiles="all")

Arguments

inpath

path with modis files in Geotiff format

outformat

File format desired by user can either be "raster" (.grd) or "GTiff" (.tif).

tiles

vertical and horizontal tile number of MODIS, tiles should follow the format in the MODIS filename, e.g. "h29v07"

Details

Clouds, snow and permanent water are removed to avoid confusion when classifying rice areas. Modis state quality control flags are used to extract the pixels with clouds, snow and permanent water. Thresholds were used for identifying cloudy pixels that were not included in the cloud quality flag. Following Xiao's (2006) methodology, blue band reflectance >= 0.2 were masked as cloudy pixels. Missing values in bands 1-7 (i.e. -28762) were also removed.

Value

nothing. only the side effect of new files on disk

Author(s)

Sonia Asilo

References

Xiao, X., Boles, S., Frolking, S. et.al. 2006. Mapping paddy rice agriculture in Southeast Asia using multi-temporal MODIS images. Remote Sensing of Environment 100, pages, 95-113.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 
  require(bitops) 	
  setwd(dirname(system.file("external/.", package="RemoteSensing")))
  ## NIR band
  NIR <- raster("MOD09A1_b2.tif")
    
  ## Scaling
  NIRscaled <- NIR/10000
  
  ## quality control flags
  sqa <- raster("MOD09A1_sqa.tif")
      
 ## Extract cloudy and water pixels using the modis.sqa500f(internal cloud flag) 
 ## and modis.sqa500c(land/water flag)
 cloudmask <- calc(sqa, fun= modis.sqa500f) # where pixel values: 0 = no clouds, and 1 = with clouds
 cloudmask <- cloudmask==0      
 watermask <- calc(sqa, fun= modis.sqa500c) # where pixel values: 1 = land, and other values = water
 watermask <- watermask==1
 
 ## Water and clouds removed
 cleaned <- NIRscaled*cloudmask*watermask
 

RiceMap documentation built on May 2, 2019, 5:16 p.m.