Load HYPEtools Package and Import Files
# Load Package
library(HYPEtools)
# Get Path to HYPEtools Model Example Files
model_path <- system.file("demo_model", package = "HYPEtools")
# Import HYPE Model Files
gd <- ReadGeoData(file.path(model_path, "GeoData.txt"))
gcl <- ReadGeoClass(file.path(model_path, "GeoClass.txt"))
prf <- ReadPar(file.path(model_path, "par.txt"), encoding = "latin1")# Exaimine parameter structure
str(prf)
#> List of 111
#> $ !! : chr "======================================================================================================="
#> $ !! : chr "GENERAL PARAMETERS"
#> $ !! : chr "__________"
#> $ cevpam : num 0.25
#> $ cevpph : num 67.5
#> $ damp : num 0.5
#> $ deepmem : num 1000
#> $ epotdist : num 3
#> $ gldepi : num 3.6
#> $ grata : num 0.6
#> $ gratk : num 0.283
#> $ gratp : num 2
#> $ lp : num 0.95
#> $ qmean : num 200
#> $ rcgrw : num 0
#> $ rivvel : num 1
#> $ rrcs3 : num 2e-04
#> $ sdnsnew : num 0.09
#> $ sdnsmax : num 0.5
#> $ sdnsrate : num 0.015
#> $ sdnsradd : num 0.026
#> $ tcalt : num 0.6
#> $ ttpi : num 3
#> $ pcelevth : num 500
#> $ pcelevadd : num 0.04
#> $ pcelevmax : num 0.04
#> $ !! : chr "======================================================================================================="
#> $ !! : chr "LANDUSE"
#> $ !! : chr "__________"
#> $ !! : chr "Landuse Classes: 1=Water 2=Coniferous forest 3=Agricultural land"
#> $ cevp : num [1:3] 0.175 0.22 0.215
#> $ cmlt : num [1:3] 2.8 1.9 3.5
#> $ frost : num [1:3] 2 2 2
#> $ srrcs : num [1:3] 0.4 0.2 0.3
#> $ surfmem : num [1:3] 17.8 5.15 5.15
#> $ ttmp : num [1:3] 0.2 0.3 0.2
#> $ !! : chr "======================================================================================================="
#> $ !! : chr "SOILS"
#> $ !! : chr "__________"
#> $ !! : chr "Soil Classes: 1=Fine soil 2=Coarse soil"
#> $ mperc1 : num [1:2] 20 25
#> $ mperc2 : num [1:2] 20 25
#> $ rrcs1 : num [1:2] 0.6 0.1
#> $ rrcs2 : num [1:2] 0.04 0.03
#> $ sfrost : num [1:2] 1 1
#> $ srrate : num [1:2] 0.05 0.025
#> $ trrcs : num [1:2] 0.3 0.15
#> $ wcep : num [1:2] 0.01 0.07
#> $ wcfc : num [1:2] 0.15 0.15
#> $ wcwp : num [1:2] 0.15 0.05
#> $ !! : chr "======================================================================================================="
#> $ !! : chr "WATER TEMPERATURE"
#> $ !! : chr "__________"
#> $ upper2deep: num 2.5
#> $ tcfriver : num 30
#> $ scfriver : num 0.3
#> $ ccfriver : num -0.3
#> $ lcfriver : num -0.1
#> $ tcflake : num 40
#> $ scflake : num 0.7
#> $ ccflake : num 0
#> $ lcflake : num 0
#> $ stbcorr1 : num 0.4
#> $ stbcorr2 : num 0.25
#> $ stbcorr3 : num 0
#> $ !! : chr "======================================================================================================="
#> $ !! : chr "LAKE AND RIVER ICE"
#> $ !! : chr "__________"
#> $ licewme : num 0.1
#> $ licetf : num 0
#> $ licesndens: num 0.0024
#> $ licekika : num 10
#> $ licekexp : num 1.88
#> $ licetmelt : num 1.25
#> $ licewcorr : num 0.5
#> $ !! : chr "__________"
#> $ ricewme : num 0.2
#> $ ricetf : num 0
#> $ ricesndens: num 0.0024
#> $ ricekika : num 10
#> $ ricekexp : num 1.88
#> $ ricetmelt : num 1.25
#> $ !! : chr "======================================================================================================="
#> $ !! : chr "TRACERS:"
#> $ !! : chr "____________________________________"
#> $ !! : chr "GENERAL PARAMETERS"
#> $ !! : num(0)
#> $ !! : chr "Initial concentrations in soil and water"
#> $ init1 : num 0
#> $ init1sw : num 0
#> $ !! : chr "Evaporation, proportion of the tracer that follows evaporating water"
#> $ t1evap : num 0
#> $ !! : chr "____________________________________"
#> $ !! : chr "Exponential decay, half life of the tracer in days"
#> $ t1expdec : num 0
#> $ !! : chr "____________________________________"
#> $ !! : chr "Adsorption/desorption to/from soil; equilibrium concentration coefficients"
#> $ !! : chr "(\"unit\" adsorbed to 1 kg of soil in one liter of soil water, U/kg soil)"
#> $ t1freuc : num 0
#> [list output truncated]
# Display without the comment items
prf[sapply(prf, function(x) is.numeric(x) & length(x) > 0)]
#> $cevpam
#> [1] 0.25
#>
#> $cevpph
#> [1] 67.5
#>
#> $damp
#> [1] 0.5
#>
#> $deepmem
#> [1] 1000
#>
#> $epotdist
#> [1] 3
#>
#> $gldepi
#> [1] 3.6
#>
#> $grata
#> [1] 0.6
#>
#> $gratk
#> [1] 0.283
#>
#> $gratp
#> [1] 2
#>
#> $lp
#> [1] 0.95
#>
#> $qmean
#> [1] 200
#>
#> $rcgrw
#> [1] 0
#>
#> $rivvel
#> [1] 1
#>
#> $rrcs3
#> [1] 2e-04
#>
#> $sdnsnew
#> [1] 0.09
#>
#> $sdnsmax
#> [1] 0.5
#>
#> $sdnsrate
#> [1] 0.015
#>
#> $sdnsradd
#> [1] 0.026
#>
#> $tcalt
#> [1] 0.6
#>
#> $ttpi
#> [1] 3
#>
#> $pcelevth
#> [1] 500
#>
#> $pcelevadd
#> [1] 0.04
#>
#> $pcelevmax
#> [1] 0.04
#>
#> $cevp
#> [1] 0.175 0.220 0.215
#>
#> $cmlt
#> [1] 2.8 1.9 3.5
#>
#> $frost
#> [1] 2 2 2
#>
#> $srrcs
#> [1] 0.4 0.2 0.3
#>
#> $surfmem
#> [1] 17.80 5.15 5.15
#>
#> $ttmp
#> [1] 0.2 0.3 0.2
#>
#> $mperc1
#> [1] 20 25
#>
#> $mperc2
#> [1] 20 25
#>
#> $rrcs1
#> [1] 0.6 0.1
#>
#> $rrcs2
#> [1] 0.04 0.03
#>
#> $sfrost
#> [1] 1 1
#>
#> $srrate
#> [1] 0.050 0.025
#>
#> $trrcs
#> [1] 0.30 0.15
#>
#> $wcep
#> [1] 0.01 0.07
#>
#> $wcfc
#> [1] 0.15 0.15
#>
#> $wcwp
#> [1] 0.15 0.05
#>
#> $upper2deep
#> [1] 2.5
#>
#> $tcfriver
#> [1] 30
#>
#> $scfriver
#> [1] 0.3
#>
#> $ccfriver
#> [1] -0.3
#>
#> $lcfriver
#> [1] -0.1
#>
#> $tcflake
#> [1] 40
#>
#> $scflake
#> [1] 0.7
#>
#> $ccflake
#> [1] 0
#>
#> $lcflake
#> [1] 0
#>
#> $stbcorr1
#> [1] 0.4
#>
#> $stbcorr2
#> [1] 0.25
#>
#> $stbcorr3
#> [1] 0
#>
#> $licewme
#> [1] 0.1
#>
#> $licetf
#> [1] 0
#>
#> $licesndens
#> [1] 0.0024
#>
#> $licekika
#> [1] 10
#>
#> $licekexp
#> [1] 1.88
#>
#> $licetmelt
#> [1] 1.25
#>
#> $licewcorr
#> [1] 0.5
#>
#> $ricewme
#> [1] 0.2
#>
#> $ricetf
#> [1] 0
#>
#> $ricesndens
#> [1] 0.0024
#>
#> $ricekika
#> [1] 10
#>
#> $ricekexp
#> [1] 1.88
#>
#> $ricetmelt
#> [1] 1.25
#>
#> $init1
#> [1] 0
#>
#> $init1sw
#> [1] 0
#>
#> $t1evap
#> [1] 0
#>
#> $t1expdec
#> [1] 0
#>
#> $t1freuc
#> [1] 0
#>
#> $t1sedvel
#> [1] 0
#>
#> $preccorr
#> [1] -0.24
#>
#> $cevpcorr
#> [1] -0.29
#>
#> $tempcorr
#> [1] -0.4
#>
#> $ratcorr
#> [1] -0.813
#>
#> $rrcscorr
#> [1] -0.79
# Show values for a parameter "rrcs1" - Note it has 2 values, i.e. it is soil-dependent
prf$rrcs1
#> [1] 0.6 0.1Here we increase the “cmlt” parameter by 50% (i.e. multiply the original value by 1.5)
# Fraction by which the original value will by multiplied
mult <- 1.5
# Display the current values (3, i.e. landuse-dependent)
prf$cmlt
#> [1] 2.8 1.9 3.5
# Create a new paramater list
prf.150 <- prf
# Multiply by a specified fraction and display again
prf.150$cmlt <- prf$cmlt * mult
prf.150$cmlt
#> [1] 4.20 2.85 5.25Here we increase the “cmlt” parameter by 50%, but only for SLCs with “Forest” as a land use.
# Forest is Land Use Class 2
comment(gcl)
#> [1] "!Landuses: 1=Water; 2=Coniferous forest; 3=Agricultural land\t\t\t\t\t\t\t\t\t\t\t\t\t"
#> [2] "!Soils: 1=Fine soil; 2=Coarse soil\t\t\t\t\t\t\t\t\t\t\t\t\t"
#> [3] "!Combination\tLanduse\tSoil\tCropid-main\tCropid-2nd\tRotation\tVegetationstyp\tSpecial-class\tTile-depth\tDrain-depth\t#Soil-layers\tDepth1\tDepth2\tDepth3"
# Specify multiplication factors
mult <- c(1, 1.5, 1)
# Create a new parameter list
prf.150.for <- prf
# Multiply values for the selected landuse by a specified fraction and display again
prf.150.for$cmlt <- prf$cmlt * mult
prf.150.for$cmlt
#> [1] 2.80 2.85 3.50
# See a ratio of the new vs. the original parameters
prf.150.for$cmlt / prf$cmlt
#> [1] 1.0 1.5 1.0