R/modisHydro.R

Defines functions dvel ndwi7 flooded1 flooded2 flooded3 flooded4 persistentwater

# Author: Sonia Asilo, Robert Hijmans, Jorrel Khalil S. Aunario, Andy Nelson
# IRRI
# License GPL3
# Version 2, March 2009

dvel <- function(evi, lswi){
# DVEL: Difference in the Values of EVI and LSWI
    return(evi-lswi)
}

ndwi7 <- function(red, swir2){
	n7 <- rep(NA, length(red))
	n7 <- (red - swir2) / (red + swir2)
	return(n7)
}

flooded1 <- function(lswi, ndvi, evi) { 
#Xiao X., Boles S., Liu J., Zhuang D., Frokling S., Li C., Salas W., Moore III B. (2005). 
#Mapping paddy rice agriculture in southern China using multi-temporal MODIS images. 
#Remote Sensing of Environment 95:480-492.
	res <- (lswi+0.05 >= evi) | (lswi+0.05 >= ndvi) 
    return(res)
}

flooded2 <- function(evi, lswi){
#Yan-Er Yan, Zu-Tao Ouyangm Hai-Qiang Guo, Shu-Song Jin, Bin Zhao (2010)
#Detecting the spatiotemporal changes of tidal flood in the estuarine wetland by using MODIS time series data
#Journal of Hydrology 384:156-163
    flood <- rep(NA,length(evi))
    dvl <- dvel(evi,lswi)
    flood[evi>0.2] <- 0
    flood[!(evi<=0.2 & dvl<=0.05)] <- 0
    wrp <- which(evi<=0.2 & dvl<=0.05) #water-related points
    flood[wrp[evi[wrp]<=0.1]] <- 1
    flood[wrp[lswi[wrp]>0 & lswi[wrp]<0.2]] <- 0
    
    return(flood)
}

flooded3 <- function(evi,lswi){
    flood <- rep(NA, length(evi))
    dvl <- dvel(evi,lswi)
    flood[evi>0.3] <- 0
    flood[!(evi<=0.3 & dvl<=0.05)] <- 0
    wrp <- which((evi<=0.3 & dvl<=0.05)|(evi<=0.05 & lswi<=0)) #water-related points
    flood[wrp[evi[wrp]<=0.1]] <- 1
    return(flood)     
}

flooded4 <- function(ndwi7){
	return(ndwi7 > 0)	
}

# TODO verify ndvi > 0.10 or ndvi < 0.10
persistentwater <- function(ndvi,lswi){ 
#Xiao X., Boles S., Liu J., Zhuang D., Frokling S., Li C., Salas W., Moore III B. (2005). 
#Mapping paddy rice agriculture in southern China using multi-temporal MODIS images. 
#Remote Sensing of Environment 95:480-492.
    res <- rep(NA, length(ndvi))
    res <- (ndvi < 0.10) & (ndvi < lswi)	
	return(res)
}

#drought <- function(NDVI, NDWI) {
#	res <- ((NDVI < 0.5 & NDWI < 0.3)*2) + ((NDVI > 0.6 & NDWI > 0.4)*1)
#	return(res)
#}

Try the RiceMap package in your browser

Any scripts or data that you put into this service are public.

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