R/rvn_watershedmeb_read.R
rvn_watershedmeb_read.Rd
Used to read in the WatershedMassEnergyBalance.csv file produced by the modelling Framework Raven.
rvn_watershedmeb_read(ff = NA, tzone = "UTC")
full file path to the WatershedMassEnergyBalance.csv file
string indicating the timezone of the data in ff
data frame from the file with standardized names
vector corresponding to units of each column
vector of the 'from' compartments in file
vector of the 'to' compartments in file
Expects a full file path to the WatershedMassEnergyBalance.csv file, then reads in the file using read.csv. The main advantage of this function is renaming the columns to nicer names and extracting the units into something much easier to read. The from and to rows are also properly handled, which is not as straightforward as some of the other Raven files.
ff is the full file path of the WatershedMassEnergyBalance.csv file. If the file is located in the current working directory, then simply the name of the file is sufficient.
The timezone is provided by the tzone argument as "UTC" by default, and should be adjusted by the user to the local time zone as needed, based on the model run.
rvn_watershed_read
for reading in the
WatershedStorage.csv file
# locate RavenR Watershed Mass Energy Balance storage file
ff <- system.file("extdata","run1_WatershedMassEnergyBalance.csv", package="RavenR")
# read in file
mywshdmeb <- rvn_watershedmeb_read(ff)
# view mass energy balance time series
head(mywshdmeb$watershedmeb)
#> Snow.Refreeze.mm. Precipitation.mm. Precipitation.mm
#> 2002-10-01 0 0 0
#> 2002-10-02 0 0 0
#> 2002-10-03 0 0 0
#> 2002-10-04 0 0 0
#> 2002-10-05 0 0 0
#> 2002-10-06 0 0 0
#> Precipitation.mm Precipitation.mm Precipitation.mm Precipitation.mm
#> 2002-10-01 0 0.00000 0 0
#> 2002-10-02 0 3.43998 0 0
#> 2002-10-03 0 4.61950 0 0
#> 2002-10-04 0 6.68329 0 0
#> 2002-10-05 0 13.09980 0 0
#> 2002-10-06 0 13.22450 0 0
#> Precipitation.mm Precipitation.mm Precipitation.mm Precipitation.mm
#> 2002-10-01 0 0 0 0.0000000
#> 2002-10-02 0 0 0 0.0287100
#> 2002-10-03 0 0 0 0.0383652
#> 2002-10-04 0 0 0 0.0578384
#> 2002-10-05 0 0 0 0.1156140
#> 2002-10-06 0 0 0 0.1164830
#> Precipitation.mm Canopy.Evaporation.mm. Canopy.Snow.Evaporation.mm.
#> 2002-10-01 0 0.0000000 0
#> 2002-10-02 0 0.0287100 0
#> 2002-10-03 0 0.0383652 0
#> 2002-10-04 0 0.0578384 0
#> 2002-10-05 0 0.1156140 0
#> 2002-10-06 0 0.1164830 0
#> Snow.Melt Overflow.mm. Infiltration.mm. Infiltration.mm Flush.mm.
#> 2002-10-01 0 0 0.00000 0.00000 0.00000
#> 2002-10-02 0 0 1.82396 1.61602 1.61602
#> 2002-10-03 0 0 2.52532 2.09418 2.09418
#> 2002-10-04 0 0 4.10150 2.58179 2.58179
#> 2002-10-05 0 0 8.64665 4.45318 4.45318
#> 2002-10-06 0 0 8.74725 4.47729 4.47729
#> Soil.Evaporation.mm. Capillary.Rise.mm. Soil.Evaporation.mm
#> 2002-10-01 0.00000 0.000000 0.00000
#> 2002-10-02 2.81385 0.854061 2.81385
#> 2002-10-03 5.09440 1.813210 5.08951
#> 2002-10-04 6.39129 2.803150 6.38844
#> 2002-10-05 9.30426 3.753800 9.30097
#> 2002-10-06 10.74590 4.667320 10.54110
#> Percolation.mm. Baseflow.mm. Baseflow.mm
#> 2002-10-01 0.00000 0.00000 0.000000
#> 2002-10-02 1.44600 2.76691 0.503647
#> 2002-10-03 2.89200 3.48391 1.048760
#> 2002-10-04 4.33800 3.61924 1.633510
#> 2002-10-05 5.78400 3.71538 2.256160
#> 2002-10-06 5.99471 3.72349 2.860690
# view 'from' dataframe
mywshdmeb$from
#> Snow.Refreeze.mm. Precipitation.mm. Precipitation.mm..1 Precipitation.mm..2
#> 1 SNOW_LIQ ATMOS_PRECIP ATMOS_PRECIP ATMOS_PRECIP
#> Precipitation.mm..3 Precipitation.mm..4 Precipitation.mm..5
#> 1 ATMOS_PRECIP ATMOS_PRECIP ATMOS_PRECIP
#> Precipitation.mm..6 Precipitation.mm..7 Precipitation.mm..8
#> 1 ATMOS_PRECIP ATMOS_PRECIP ATMOS_PRECIP
#> Precipitation.mm..9 Precipitation.mm..10 Canopy.Evaporation.mm.
#> 1 ATMOS_PRECIP ATMOS_PRECIP CANOPY
#> Canopy.Snow.Evaporation.mm. Snow.Melt...Refreeze.mm. Overflow.mm.
#> 1 CANOPY_SNOW SNOW SNOW_LIQ
#> Infiltration.mm. Infiltration.mm..1 Flush.mm. Soil.Evaporation.mm.
#> 1 PONDED_WATER PONDED_WATER SURFACE_WATER SOIL[0]
#> Capillary.Rise.mm. Soil.Evaporation.mm..1 Percolation.mm. Baseflow.mm.
#> 1 SOIL[1] SOIL[0] SOIL[1] SOIL[1]
#> Baseflow.mm..1
#> 1 SOIL[2]