From 66dcb213de288f812c20fb840f5ad8170516e39c Mon Sep 17 00:00:00 2001 From: midraed Date: Tue, 3 May 2016 11:37:01 -0300 Subject: [PATCH] Updates for water 0.3.2 --- R/water_netRadiation.G.R | 2 +- R/water_sensibleHeatFlux.R | 4 ++-- man/LAI.Rd | 2 +- man/calcAnchors.Rd | 4 ++-- vignettes/METRIC_advanced.R | 14 +++++++------- vignettes/METRIC_advanced.Rmd | 14 +++++++------- vignettes/METRIC_advanced.html | 34 +++++++++++++++++----------------- 7 files changed, 37 insertions(+), 37 deletions(-) diff --git a/R/water_netRadiation.G.R b/R/water_netRadiation.G.R index 11ffc1f..67511b8 100644 --- a/R/water_netRadiation.G.R +++ b/R/water_netRadiation.G.R @@ -455,7 +455,7 @@ albedo <- function(image.SR, aoi, coeff="Tasumi"){ #' Johnson, L. F. (2003). Temporal Stability of the NDVI-LAI Relationship in a Napa Valley Vineyard, 96-101. http://doi.org/10.1111/j.1755-0238.2003.tb00258.x #' @export ## Cite Pocas work for LAI from METRIC2010 -LAI <- function(method="metric2010", image, sat="auto", ESPA=F,aoi, L=0.1){ +LAI <- function(method="metric2010", image, aoi, L=0.1){ if(method=="metric" | method=="metric2010" | method=="vineyard" | method=="MCB"){ toa.4.5 <- stack(image[[3]], image[[4]])} if(method=="turner"){ diff --git a/R/water_sensibleHeatFlux.R b/R/water_sensibleHeatFlux.R index 746d4d8..ff25e2b 100644 --- a/R/water_sensibleHeatFlux.R +++ b/R/water_sensibleHeatFlux.R @@ -70,8 +70,8 @@ momentumRoughnessLength <- function(method="short.crops", LAI, NDVI, #' CITRA y MCB (com pers) #' @export calcAnchors <- function(image, Ts, LAI, albedo, Z.om, n=1, aoi, - anchors.method= "CITRA-MCB", sat="auto", - ESPA=F, plots=TRUE, deltaTemp=5, verbose=FALSE) { + anchors.method= "CITRA-MCB", + plots=TRUE, deltaTemp=5, verbose=FALSE) { path=getwd() ### Some values used later sr.4.5 <- stack(image[[3]], image[[4]]) diff --git a/man/LAI.Rd b/man/LAI.Rd index 2bb0348..5027d99 100644 --- a/man/LAI.Rd +++ b/man/LAI.Rd @@ -4,7 +4,7 @@ \alias{LAI} \title{Estimate LAI from Landsat Data} \usage{ -LAI(method = "metric2010", image, sat = "auto", ESPA = F, aoi, L = 0.1) +LAI(method = "metric2010", image, aoi, L = 0.1) } \arguments{ \item{method}{Method used to estimate LAI from spectral data.} diff --git a/man/calcAnchors.Rd b/man/calcAnchors.Rd index 278af22..05d223e 100644 --- a/man/calcAnchors.Rd +++ b/man/calcAnchors.Rd @@ -5,8 +5,8 @@ \title{Select anchors pixels for H function} \usage{ calcAnchors(image, Ts, LAI, albedo, Z.om, n = 1, aoi, - anchors.method = "CITRA-MCB", sat = "auto", ESPA = F, plots = TRUE, - deltaTemp = 5, verbose = FALSE) + anchors.method = "CITRA-MCB", plots = TRUE, deltaTemp = 5, + verbose = FALSE) } \arguments{ \item{image}{top-of-atmosphere landsat reflectance image} diff --git a/vignettes/METRIC_advanced.R b/vignettes/METRIC_advanced.R index c50fd85..f6a49db 100644 --- a/vignettes/METRIC_advanced.R +++ b/vignettes/METRIC_advanced.R @@ -14,9 +14,9 @@ WeatherStation <- read.WSdata(WSdata = csvfile, date.format = "%d/%m/%Y", MTL = MTLfile) ## ---- fig.width = 5------------------------------------------------------ -print(WeatherStation) +print(WeatherStation, hourly=FALSE) -plot(WeatherStation, alldata=FALSE) +plot(WeatherStation, hourly=TRUE) ## ---- fig.width = 5------------------------------------------------------ image.DN <- L7_Talca[[c(1:5,7)]] @@ -49,10 +49,10 @@ image.SR <- calcSR(image.TOAr=image.TOAr, sat = "L7", incidence.hor = solar.angles.r$incidence.hor, WeatherStation=WeatherStation, ESPA = F) -albedo <- albedo(image.SR = image.SR, coeff="Tasumi", sat = "L7") +albedo <- albedo(image.SR = image.SR, coeff="Tasumi") ## ---- fig.width = 5------------------------------------------------------ -LAI <- LAI(method = "metric2010", image = image.TOAr, L=0.1, sat = "L7") +LAI <- LAI(method = "metric2010", image = image.TOAr, L=0.1) plot(LAI) @@ -72,7 +72,7 @@ plot(Rn) ## ---- fig.width = 5------------------------------------------------------ G <- soilHeatFlux(image = image.SR, Ts=Ts,albedo=albedo, - Rn=Rn, LAI=LAI, sat = "L7") + Rn=Rn, LAI=LAI) plot(G) @@ -83,11 +83,11 @@ Z.om <- momentumRoughnessLength(LAI=LAI, mountainous = TRUE, hot.and.cold <- calcAnchors(image = image.TOAr, Ts = Ts, LAI = LAI, plots = F, albedo = albedo, Z.om = Z.om, n = 1, - anchors.method = "CITRA-MCB", sat = "L7", + anchors.method = "CITRA-MCB", deltaTemp = 5, verbose = FALSE) H <- calcH(anchors = hot.and.cold, Ts = Ts, Z.om = Z.om, - WeatherStation = WeatherStation, ETp.coef = 1.05, sat = "L7", + WeatherStation = WeatherStation, ETp.coef = 1.05, Z.om.ws = 0.0018, DEM = DEM, Rn = Rn, G = G, verbose = FALSE) ## ------------------------------------------------------------------------ diff --git a/vignettes/METRIC_advanced.Rmd b/vignettes/METRIC_advanced.Rmd index 4669a19..8d4ddef 100644 --- a/vignettes/METRIC_advanced.Rmd +++ b/vignettes/METRIC_advanced.Rmd @@ -71,9 +71,9 @@ WeatherStation <- read.WSdata(WSdata = csvfile, date.format = "%d/%m/%Y", We can visualize our weather station data as: ```{r, fig.width = 5} -print(WeatherStation) +print(WeatherStation, hourly=FALSE) -plot(WeatherStation, alldata=FALSE) +plot(WeatherStation, hourly=TRUE) ``` @@ -128,13 +128,13 @@ image.SR <- calcSR(image.TOAr=image.TOAr, sat = "L7", incidence.hor = solar.angles.r$incidence.hor, WeatherStation=WeatherStation, ESPA = F) -albedo <- albedo(image.SR = image.SR, coeff="Tasumi", sat = "L7") +albedo <- albedo(image.SR = image.SR, coeff="Tasumi") ``` Later on, we calculate the *Leaf Area Index* (LAI) using the satellite data, and we plot it. In this step, we can choose diferents methods able in literature to estimate LAI from Landsat data (see package Help for more info.). In this vignette we are going to use the *METRIC 2010* method: ```{r, fig.width = 5} -LAI <- LAI(method = "metric2010", image = image.TOAr, L=0.1, sat = "L7") +LAI <- LAI(method = "metric2010", image = image.TOAr, L=0.1) plot(LAI) ``` @@ -166,7 +166,7 @@ We estimate the soil heat flux using as an input data the *Net radiation*, *surf ```{r, fig.width = 5} G <- soilHeatFlux(image = image.SR, Ts=Ts,albedo=albedo, - Rn=Rn, LAI=LAI, sat = "L7") + Rn=Rn, LAI=LAI) plot(G) ``` @@ -185,11 +185,11 @@ Z.om <- momentumRoughnessLength(LAI=LAI, mountainous = TRUE, hot.and.cold <- calcAnchors(image = image.TOAr, Ts = Ts, LAI = LAI, plots = F, albedo = albedo, Z.om = Z.om, n = 1, - anchors.method = "CITRA-MCB", sat = "L7", + anchors.method = "CITRA-MCB", deltaTemp = 5, verbose = FALSE) H <- calcH(anchors = hot.and.cold, Ts = Ts, Z.om = Z.om, - WeatherStation = WeatherStation, ETp.coef = 1.05, sat = "L7", + WeatherStation = WeatherStation, ETp.coef = 1.05, Z.om.ws = 0.0018, DEM = DEM, Rn = Rn, G = G, verbose = FALSE) ``` diff --git a/vignettes/METRIC_advanced.html b/vignettes/METRIC_advanced.html index 7eca279..c7c5aed 100644 --- a/vignettes/METRIC_advanced.html +++ b/vignettes/METRIC_advanced.html @@ -10,7 +10,7 @@ - + Surface Energy Balance using METRIC model and water package: 2. advanced procedure @@ -72,7 +72,7 @@ @@ -117,8 +117,8 @@

Base data preparation

lat=-35.42222, long= -71.38639, elev=201, height= 2.2, MTL = MTLfile)

We can visualize our weather station data as:

-
print(WeatherStation)
-
## Weather Station at lat: -35.42 long: -35.42 elev: 201 
+
print(WeatherStation, hourly=FALSE)
+
## Weather Station at lat: -35.42 long: -71.39 elev: 201 
 ## Summary:
 ##    radiation           wind              RH              ea        
 ##  Min.   :  0.00   Min.   : 0.000   Min.   :17.39   Min.   :0.7455  
@@ -138,8 +138,8 @@ 

Base data preparation

## Conditions at satellite flyby: ## datetime radiation wind RH ea temp ## 47 2013-02-15 11:30:40 752.92 1.1 68.86 1.89 22.59
-
plot(WeatherStation, alldata=FALSE)
-

+
plot(WeatherStation, hourly=TRUE)
+

After that, we load the Landast satellite image. Usually, using water we can use the function called loadImage to load a Landsat image from .TIF files were downloaded directly from Earth Explorer. In this vignette we are going to use some Landsat 7 as example data which, by the way comes with water package as a demo.

image.DN <- L7_Talca[[c(1:5,7)]]
 B6 <- L7_Talca[[6]]
@@ -161,7 +161,7 @@

Net Radiation (R_n) estimation

WeatherStation = WeatherStation, MTL = MTLfile) plot(solar.angles.r)
-

+

Rs.inc <- incSWradiation(surface.model = surface.model, 
                          solar.angles = solar.angles.r, 
                          WeatherStation = WeatherStation)
@@ -174,12 +174,12 @@

Net Radiation (R_n) estimation

incidence.hor = solar.angles.r$incidence.hor, WeatherStation=WeatherStation, ESPA = F) -albedo <- albedo(image.SR = image.SR, coeff="Tasumi", sat = "L7") +albedo <- albedo(image.SR = image.SR, coeff="Tasumi")

Later on, we calculate the Leaf Area Index (LAI) using the satellite data, and we plot it. In this step, we can choose diferents methods able in literature to estimate LAI from Landsat data (see package Help for more info.). In this vignette we are going to use the METRIC 2010 method:

-
LAI <- LAI(method = "metric2010", image = image.TOAr, L=0.1, sat = "L7")
+
LAI <- LAI(method = "metric2010", image = image.TOAr, L=0.1)
 
 plot(LAI)
-

+

Then we estimate land surface temperature (Ts), using computed LAI in order to estimate consequently the surface emissivity, and brightness temperature from landsat`s thermal band (TIR). Then we use this information to compute the incoming and outgoing long-wave radiation as:

Ts <- surfaceTemperature(LAI=LAI, sat = "L7", thermalband = B6,
                          WeatherStation = WeatherStation)
@@ -192,16 +192,16 @@ 

Net Radiation (R_n) estimation

Rn <- netRadiation(LAI, albedo, Rs.inc, Rl.inc, Rl.out)
 
 plot(Rn)
-

+

Soil Heat Flux (G) estimation

We estimate the soil heat flux using as an input data the Net radiation, surface reflectance, surface temperature, leaf area index and albedo. In this vignette we are going to use the original METRIC (2007) baded-method, which is:

G <- soilHeatFlux(image = image.SR, Ts=Ts,albedo=albedo, 
-                  Rn=Rn, LAI=LAI, sat = "L7")
+                  Rn=Rn, LAI=LAI)
 
 plot(G)
-

+

Sensible Heat Flux (H) estimation

@@ -214,13 +214,13 @@

Sensible Heat Flux (H) estimation

hot.and.cold <- calcAnchors(image = image.TOAr, Ts = Ts, LAI = LAI, plots = F, albedo = albedo, Z.om = Z.om, n = 1, - anchors.method = "CITRA-MCB", sat = "L7", + anchors.method = "CITRA-MCB", deltaTemp = 5, verbose = FALSE) H <- calcH(anchors = hot.and.cold, Ts = Ts, Z.om = Z.om, - WeatherStation = WeatherStation, ETp.coef = 1.05, sat = "L7", + WeatherStation = WeatherStation, ETp.coef = 1.05, Z.om.ws = 0.0018, DEM = DEM, Rn = Rn, G = G, verbose = FALSE)
-

+

Daily Crop Evapotranspiration (ET_24) estimation

@@ -228,7 +228,7 @@

Daily Crop Evapotranspiration (ET_24) estimation

ET_WS <- dailyET(WeatherStation = WeatherStation)

And finally, we can estimate daily crop ET pixel by pixel:

ET.24 <- ET24h(Rn, G, H$H, Ts, WeatherStation = WeatherStation, ETr.daily=ET_WS)
-

+

References