## Loading required package: raster
## Loading required package: sp
## Loading required package: openair
## Loading required package: knitr
## Loading required package: plyr
## Loading required package: dplyr
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:plyr':
## 
##     arrange, count, desc, failwith, id, mutate, rename, summarise,
##     summarize
## 
## The following objects are masked from 'package:raster':
## 
##     intersect, select, union
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union

Configuração ConfigIV

 comb <- expand.grid(t_prec,Ks,decay,GHc,umid,b,psi,thet)
 names(comb) <- c("Distr.Prec", "Cond.Hidr", "Decay", "Cond.Aqui", 
                  "Umid.Ini", "b.Campbell", "Pot.Mat", "Porosidade")
    comb
##   Distr.Prec Cond.Hidr Decay Cond.Aqui Umid.Ini b.Campbell Pot.Mat
## 1          3         3     0       2.5      0.5          4    0.12
## 2          3        30     0       2.5      0.5          4    0.12
## 3          3       300     0       2.5      0.5          4    0.12
##   Porosidade
## 1       0.39
## 2       0.39
## 3       0.39
 soilparam <-c(5467,0.3798980000,0.4713136307,0.0000009216,8.0804000000,0.0399043400,0.0700000003)
 #  
 configuracao <- expand.grid(t_prec,
                             round(Ks/3.6e6/soilparam[4],3),
                             decay,GHc,umid,
                             round(b/soilparam[5],3),
                             round(psi/soilparam[3],3),
                             round(thet/soilparam[2],3))
 write.table(configuracao,file = "../../rodadas", sep = " ",
             row.names = T, col.names = F,quote = F )
 count <- length(configuracao[,1])

Serão feitas 3 simulações

Organizando as simulações:

dir <- paste("../../", name, sep = "")
 
 stopifnot(dir.exists(dir))

    list.Simulacoes <- basename(list.dirs(path = dir,
                                          full.names = F,
                                          recursive = F))
    
    sims <- as.numeric(gsub(pattern = "_",
                            replacement = "",
                            x = substr(list.Simulacoes, 
                                       start = 1,
                                       stop = 2)))
    
     list.Simulacoes <- list.Simulacoes[order(sims)]
        list.Simulacoes
## [1] "1_3_0.904_0_2.5_0.5_0.495_0.255_1.027" 
## [2] "2_3_9.042_0_2.5_0.5_0.495_0.255_1.027" 
## [3] "3_3_90.422_0_2.5_0.5_0.495_0.255_1.027"
    basin <- raster(paste(dir,list.Simulacoes[1],"basin1.asc", sep = "/"))
## rgdal: version: 0.9-3, (SVN revision 530)
##  Geospatial Data Abstraction Library extensions to R successfully loaded
##  Loaded GDAL runtime: GDAL 1.10.1, released 2013/08/26
##  Path to GDAL shared files: /usr/share/gdal/1.10
##  Loaded PROJ.4 runtime: Rel. 4.8.0, 6 March 2012, [PJ_VERSION: 480]
##  Path to PROJ.4 shared files: (autodetected)
##  Linking to sp version: 1.1-0
    wsdem <- raster(paste(dir,list.Simulacoes[1],"wsdem_pauliceia.asc", sep = "/"))
    soil <- raster(paste(dir,list.Simulacoes[1],"soil_pauliceia.asc", sep = "/"))
    veg <- raster(paste(dir,list.Simulacoes[1],"sib2_pauliceia.asc", sep = "/"))
    geo.input <- mask(stack(basin, wsdem, soil, veg), wsdem)
        plot(geo.input)
    ks <- raster(paste(dir,list.Simulacoes[1],"Derive_D/K_s.asc", sep = "/"))
    bee <- raster(paste(dir,list.Simulacoes[1],"Derive_D/B_exp.asc", sep = "/"))
    psi <- raster(paste(dir,list.Simulacoes[1],"Derive_D/Psi_s.asc", sep = "/"))
    intervalos <- raster(paste(dir,list.Simulacoes[1],"Derive_D/interval.asc", sep = "/"))
      derive <- mask(stack(ks, bee, psi, intervalos), wsdem)
        plot(derive)
    start.date <- as.POSIXct("2009-01-01 00:00:00", tz = "GMT")
    end.date <- as.POSIXct("2014-12-31 23:00:00", tz = "GMT")
        date <- seq.POSIXt(start.date, end.date, by = "day")
        date.hour <- seq.POSIXt(start.date, end.date, by = "hour")
    vazao <- read.table(file = paste(dir,
                                     list.Simulacoes[1],
                                     "Exutorio_d.txt", sep = "/"), 
                        header = T,
                        na.strings = "-9999.0000000000000000")
     
    vazao <- data.frame(date, Qd_obv = vazao$Qd_obv)
     timePlot(vazao, "Qd_obv")
    vaza0 <- sapply(1:length(list.Simulacoes), 
                    function(i){
                        read.table(file = paste(dir, list.Simulacoes[i],
                                                "Exutorio_d.txt",
                                                sep = "/"),
                                   header = T,
                                   na.strings = "-9999.0000000000000000")[,4]    
                    })
    vaza0 <- as.data.frame(vaza0)
    names(vaza0) <- 1:length(list.Simulacoes)
     
    vazao <- cbind(vaza0, vazao)
    
    fator <- 24 * 3600 * 1000 / (11.94 *10e6)
    
    vazao.mm <- data.frame(vazao[,names(vazao)!="date"] * fator ,date)

    cumvazao.mm <- cumsum(vazao.mm[!is.na(vazao.mm$Qd_obv),names(vazao.mm)!="date"])
    
        cumvazao.mm$date <- date[!is.na(vazao.mm$Qd_obv)]
    kable(comb, row.names = T)
Distr.Prec Cond.Hidr Decay Cond.Aqui Umid.Ini b.Campbell Pot.Mat Porosidade
1 3 3 0 2.5 0.5 4 0.12 0.39
2 3 30 0 2.5 0.5 4 0.12 0.39
3 3 300 0 2.5 0.5 4 0.12 0.39
    timePlot(vazao.mm, c("Qd_obv",names(vazao.mm)[1:count]), 
             group = T, stack = F, lty = 1,
             name.pol =c("Observada",names(vazao.mm)[1:count]), 
             ylab = "mm", xlab = "Date", 
             main = "Vazão [mm]", log = T
             )
    timePlot(cumvazao.mm, c("Qd_obv", names(cumvazao.mm)[1:count]), 
             group = T, stack = F, lty = 1, lwd = 2,
             name.pol = c("Observada",names(cumvazao.mm)[1:count]), 
             ylab = "Vazão acumulada" , xlab = "Date",
             main = "Vazão acumulada [mm]"
             )
# Lendo os arquivos de umidade do solo. 
umidade <- sapply(1:length(list.Simulacoes), 
                  function(i){ # i = 12
                    www <- read.table(file = paste(dir,list.Simulacoes[i],
                                            "OutStn_www.txt", sep = "/"), 
                               header = F,skip = 1,
                               na.strings = "-9999.0000000000000000")[,c(5:6)] * 10
                    return(www[,1]+www[,2])
                    })
umidade <- as.data.frame(umidade)
umidade$date <- date.hour
umidade$obv <- umid1m$swc1m 
# str(umidade)

names(umidade) <- gsub("V", "",names(umidade))
kable(comb, row.names = T)
Distr.Prec Cond.Hidr Decay Cond.Aqui Umid.Ini b.Campbell Pot.Mat Porosidade
1 3 3 0 2.5 0.5 4 0.12 0.39
2 3 30 0 2.5 0.5 4 0.12 0.39
3 3 300 0 2.5 0.5 4 0.12 0.39
timePlot(umidade, c("obv",names(umidade)[1:count]), 
         group = T, lty = 1, 
        avg.time = "day", stack = F ,lwd = 1.5, 
        name.pol = c("Observada",names(umidade)[1:count]),
        ylab = "Conteúdo de agua no solo", xlab = "Data",
        main = "Conteúdo de água na camada 1 metro", 
        auto.text = T,key.columns = 4
        )

Grau de saturação por camadas

kable(comb, row.names = T)
Distr.Prec Cond.Hidr Decay Cond.Aqui Umid.Ini b.Campbell Pot.Mat Porosidade
1 3 3 0 2.5 0.5 4 0.12 0.39
2 3 30 0 2.5 0.5 4 0.12 0.39
3 3 300 0 2.5 0.5 4 0.12 0.39
    timePlot(sib2diag, c("www1","www2","www3") , type = "ID",
             group = T, stack = F, lty = 1, lwd = 2,
             layout = c(1,3),
             ylab = "Grau de saturação", xlab = "Data",
             main = "Grau de saturação, camadas",date.breaks =  20 )
   all.www1 <- data.frame(date = select(filter(sib2diag, ID == "S1"), date),
                          select(filter(sib2diag, ID == "S1"), www1),
                          select(filter(sib2diag, ID == "S2"), www1),
                          select(filter(sib2diag, ID == "S3"), www1))
         names(all.www1) <- c("date","S1", "S2", "S3")

    timePlot(all.www1, c("S1", "S2", "S3"), 
             lty = 1, lwd = 2,
             group = T, stack = F,
             ylab = "Umidade do solo", main = "Umidade do solo 1ra camada")
kable(comb, row.names = T)
Distr.Prec Cond.Hidr Decay Cond.Aqui Umid.Ini b.Campbell Pot.Mat Porosidade
1 3 3 0 2.5 0.5 4 0.12 0.39
2 3 30 0 2.5 0.5 4 0.12 0.39
3 3 300 0 2.5 0.5 4 0.12 0.39
   all.www2 <- data.frame(date = select(filter(sib2diag, ID == "S1"), date),
                          select(filter(sib2diag, ID == "S1"), www2),
                          select(filter(sib2diag, ID == "S2"), www2),
                          select(filter(sib2diag, ID == "S3"), www2))
         names(all.www2) <- c("date","S1", "S2", "S3")

    timePlot(all.www2, c("S1", "S2", "S3"), 
             lty = 1, lwd = 2,
             group = T, stack = F, 
             ylab = "Umidade do solo", main = "Umidade do solo 2da camada")
kable(comb, row.names = T)
Distr.Prec Cond.Hidr Decay Cond.Aqui Umid.Ini b.Campbell Pot.Mat Porosidade
1 3 3 0 2.5 0.5 4 0.12 0.39
2 3 30 0 2.5 0.5 4 0.12 0.39
3 3 300 0 2.5 0.5 4 0.12 0.39
   all.www3 <- data.frame(date = select(filter(sib2diag, ID == "S1"), date),
                          select(filter(sib2diag, ID == "S1"), www3),
                          select(filter(sib2diag, ID == "S2"), www3),
                          select(filter(sib2diag, ID == "S3"), www3))
         names(all.www3) <- c("date","S1", "S2", "S3")

    timePlot(all.www3, c("S1", "S2", "S3"), 
             lty = 1, lwd = 2,
             group = T, stack = F, 
             ylab = "Umidade do solo", main = "Umidade do solo 3ra camada")

Fluxos em superfície

kable(comb, row.names = T)
Distr.Prec Cond.Hidr Decay Cond.Aqui Umid.Ini b.Campbell Pot.Mat Porosidade
1 3 3 0 2.5 0.5 4 0.12 0.39
2 3 30 0 2.5 0.5 4 0.12 0.39
3 3 300 0 2.5 0.5 4 0.12 0.39
    timePlot(sib2diag, c("rn","LE","H", "G") , type = "ID",
             group = F, stack = F, lty = 1, lwd = 2,
             layout = c(1,3),
             ylab = "Fluxos [W/m²]", xlab = "Data",
             main = "Fluxos [W/m²]",date.breaks = 20 )

Evaporação desde o dosel e o solo

kable(comb, row.names = T)
Distr.Prec Cond.Hidr Decay Cond.Aqui Umid.Ini b.Campbell Pot.Mat Porosidade
1 3 3 0 2.5 0.5 4 0.12 0.39
2 3 30 0 2.5 0.5 4 0.12 0.39
3 3 300 0 2.5 0.5 4 0.12 0.39
    timePlot(sib2diag, c("ec","eg") , type = "ID",
             group = F, stack = F, lty = 1, lwd = 2,
             layout = c(1,3),
             ylab = "Evaporação [W/m²]", xlab = "Data",
             main = "Evaporação desde o dosel(ec) e a superfície do solo(eg) ",
             date.breaks =  20
             )
    timeProp(sib2diag, 
             pollutant = "LE", 
             proportion = "ec", 
             avg.time = "month", 
             type = "ID",
             layout = c(3,1))
 timeVariation(sib2diag, stati="median", poll="H", conf.int = c(0.75, 0.99),col = "firebrick")   
 
summaryPlot(sib2diag,pollutant = "www1" ,clip = TRUE, type = "density")

linearRelation(sib2diag, x = "LE", y = "H" )

scatterPlot(sib2diag, x = "G", y = "H", type = "season", hemisphere = "southern", key =FALSE)