DrylandEcology / rSFSW2

rSFSW2: A R package to create soil water balance simulation experiment
GNU General Public License v3.0
8 stars 7 forks source link

Output water balance may not be closed #254

Closed dschlaep closed 6 years ago

dschlaep commented 6 years ago
with(x, plot(Evaporation_Total_mm_mean - (Evaporation_Soil_Total_mm_mean + Snowloss_mm_mean + Evaporation_InterceptedByVegetation_mm_mean + Evaporation_InterceptedByLitter_mm_mean), pch = 46, ylab = "E - (E(soil) + E(snow) + E(veg) + E(litter))", xlab = "days"))

Note: E(surface) is currently not outputted separately (see #253) -- It should be 0 for these simulations.

pastedgraphic-2

with(x, plot(AET_mm_mean- (Transpiration_Total_mm_mean + Evaporation_Total_mm_mean), pch = 46, ylab = "AET - (T + E)", xlab = "days"))

pastedgraphic-1

dschlaep commented 6 years ago

x-axes labels are Sites and y-axes are in units of mm year-1

dschlaep commented 6 years ago

This error got fixed with the fixes to DrylandEcology/SOILWAT2#133 and DrylandEcology/rSOILWAT2#99:

library("RSQLite")
con <- dbConnect(SQLite(), "tests/test_data/0_ReferenceOutput/dbTables_Test4_AllOverallAggregations_snow_v2.5.6.sqlite3")
x <- dbReadTable(con, "aggregation_overall_mean")

# Checks from this issue:
# Check: Etotal == (E(soil) + E(snow) + E(veg) + E(litter))
with(x, all.equal(Evaporation_Total_mm_mean, (Evaporation_Soil_Total_mm_mean + Snowloss_mm_mean + Evaporation_InterceptedByVegetation_mm_mean + Evaporation_InterceptedByLitter_mm_mean)))

# Check: AET == (Ttotal + Etotal)
with(x, all.equal(AET_mm_mean, (Transpiration_Total_mm_mean + Evaporation_Total_mm_mean)))

dbDisconnect(con)

TRUE TRUE