updating soil query code

This commit is contained in:
Zoltan BARCZA 2023-02-08 14:06:12 +01:00
parent 57cf5db372
commit a19c14a6b8
4 changed files with 9 additions and 74 deletions

View File

@ -10,11 +10,9 @@ colorText <- function(text,color){
RMuso_version <- 7
cat(sprintf('This is RBBGCMuso version 1.0\nDefault Biome-BGCMuSo version: %d\n',
RMuso_version))
cat('Thanks for using RBBGCMuso!\n')
cat('For quick tutorial visit https://github.com/hollorol/RBBGCMuso\n')
cat(sprintf('For quick tutorial visit %s\n', colorText('https://github.com/hollorol/RBBGCMuso',104)))
cat(sprintf('For help, issue the command: %s\n',colorText('help(package="RBBGCMuso")',104)))
cat('In order to get a sample simulation package use the copyMusoExample() command\n')
cat(sprintf('In order to get a sample simulation package use the %s command\n',colorText('copyMusoExample()',104)))
RMuso_constMatrix <- list(epc=NULL,soil=NULL)
RMuso_varTable <- list()
#___________________________

View File

@ -1,63 +0,0 @@
SOILPROP FILE - lat: 60, lon: 50, created in: Mon Apr 20 10:44:56 2020
----------------------------------------------------------------------------------------
NITROGEN AND DECOMPOSITION PARAMETERS
0.1 (prop.) denitrification rate per g of CO2 respiration of SOM
0.2 (prop.) nitrification coefficient 1
0.07 (prop.) nitrification coefficient 2
0.02 (prop.) coefficient of N2O emission of nitrification
0.1 (prop.) NH4 mobilen proportion
1.0 (prop.) NO3 mobilen proportion
10 (m) e-folding depth of decomposition rate's depth scalar
0.002 (prop.) fraction of dissolved part of SOIL1 organic matter
0.002 (prop.) fraction of dissolved part of SOIL2 organic matter
0.002 (prop.) fraction of dissolved part of SOIL3 organic matter
0.002 (prop.) fraction of dissolved part of SOIL4 organic matter
0.1 (prop.) minimum WFPS for scalar of nitrification calculation
0.45 (prop.) lower optimum WFPS for scalar of nitrification calculation
0.55 (prop.) higher optimum WFPS for scalar of nitrification calculation
0.2 (prop.) minimum value for saturated WFPS scalar of nitrification calculation
10 (ppm) critical value of dissolved N and C in bottom (inactive layer)
----------------------------------------------------------------------------------------
RATE SCALARS
0.35 (prop) respiration fractions for fluxes between compartments (l1s1)
0.50 (prop) respiration fractions for fluxes between compartments (l2s2)
0.26 (prop) respiration fractions for fluxes between compartments (l4s3)
0.25 (prop) respiration fractions for fluxes between compartments (s1s2)
0.41 (prop) respiration fractions for fluxes between compartments (s2s3)
0.50 (prop) respiration fractions for fluxes between compartments (s3s4)
0.7 (1/day) rate constant scalar of labile litter pool
0.07 (1/day) rate constant scalar of cellulose litter pool
0.014 (1/day) rate constant scalar of lignin litter pool
0.07 (1/day) rate constant scalar of fast microbial recycling pool
0.014 (1/day) rate constant scalar of medium microbial recycling pool
0.0014 (1/day) rate constant scalar of slow microbial recycling pool
0.0001 (1/day) rate constant scalar of recalcitrant SOM (humus) pool
0.001 (1/day) rate constant scalar of physical fragmentation of coarse woody debris
----------------------------------------------------------------------------------------
CH4 PARAMETERS
212.5 (DIM) soil CH4 emission bulk density dependence parameter1
1.81 (DIM) soil CH4 emission bulk density dependence parameter2
-1.353 (DIM) soil CH4 emission soil water content dependence parameter1
0.2 (DIM) soil CH4 emission soil water content dependence parameter2
2 (DIM) soil CH4 emission soil water content dependence parameter3
6.786 (DIM) soil CH4 emission soil water content dependence parameter4
0.010 (DIM) soil CH4 emission soil temperature dependence parameter1
----------------------------------------------------------------------------------------
SOIL PARAMETERS
2 (m) depth of soil
6 (mm)42 42 43 47 48 49 49 49 51 51 limit of first stage evaporation
20.00 (mm) maximum height of pond water
1 (dimless) curvature of soil stress function
-9999 (dimless) measured runoff curve number (-9999: no measured data, model estimation)
----------------------------------------------------------------------------------------
SOIL COMPOSITION AND CHARACTERISTIC VALUES (-9999: no measured data)
30.0 30.0 30.0 30.0 30.0 30.0 30.0 30.0 30.0 30.0 (%) sand percentage by volume in rock-free soil
50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 50.0 (%) silt percentage by volume in rock-free soil
7.0 7.0 7.0 7.0 7.0 7.0 7.0 7.0 7.0 7.0 (dimless) soil pH (dimless) measured runoff curve number
-9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 (g/cm3) bulk density
-9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 (m3/m3) SWC at saturation
-9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 (m3/m3) SWC at field capacity
-9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 (m3/m3) SWC at wilting point
-9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 (m3/m3) SWC at hygroscopic water content
-9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 (dimless) drainage coefficient
-9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 -9999 (cm/day) hydraulic condictivity at saturation

View File

@ -9,7 +9,7 @@
getSoilDataFull <- function(lat, lon, apiURL) {
if(missing(apiURL)){
apiURL <- "https://81.169.232.36"
apiURL <- "https://rest.isric.org/soilgrids/v2.0/properties"
}
apiString <- glue("{apiURL}/query?lon={lon}&lat={lat}")
soilREST <- #with_config(config(ssl_verifypeer=0L, ssl_verifyhost=0L),
@ -31,9 +31,9 @@ getSoilDataFull <- function(lat, lon, apiURL) {
createSoilFile <- function(lat,lon,
outputFile="recent.soi",
method="constant",apiURL,
template=system.file("examples/hhs/hhs.soi",package="RBBGCMuso")) {
template=system.file("examples/hhs/hhs_MuSo7.soi",package="RBBGCMuso")) {
if(missing(apiURL)){
apiURL <- "https://rest.soilgrids.org/soilgrids/v2.0/properties"
apiURL <- "https://rest.isric.org/soilgrids/v2.0/properties"
}
outFile <- suppressWarnings(readLines(template))
outFile[1] <- sprintf("SOILPROP FILE - lat: %s, lon: %s, created in: %s",lat,lon,date())
@ -50,11 +50,11 @@ createSoilFile <- function(lat,lon,
}
soilDepth <- tryCatch(getMeanSoil(rest,"bdod")/100,error=function(e){stop("There is no data for the given coordinates")})
outFile[55] <- sprintf("%s (%%) percentage of sand by volume in rock free soil",
outFile[90] <- sprintf("%s (%%) percentage of sand by volume in rock free soil",
paste(createMusoLayers(getMeanSoil(rest,"sand")/10), collapse="\t"))
outFile[56] <- sprintf("%s (%%) percentage of silt by volume in rock free soil",
outFile[91] <- sprintf("%s (%%) percentage of silt by volume in rock free soil",
paste(createMusoLayers(getMeanSoil(rest,"silt")/10), collapse="\t"))
outFile[57] <- sprintf("%s (dimless) soil PH",
outFile[92] <- sprintf("%s (dimless) soil PH",
paste(createMusoLayers(getMeanSoil(rest,"phh2o")/10), collapse="\t"))
# outFile[58] <- sprintf("%s (%%) bulk density",paste(createMusoLayers(soilDepth),collapse="\t"))
writeLines(outFile,outputFile)

View File

@ -1,6 +1,6 @@
#' tuneMusoUI
#'
#' This is a simple parameter tuner function which works great in a flat directory systemj
#' This is a simple parameter tuner function which works great in a flat directory system
#'
#' @param parameterFile optional, the parameter csv file
#' @importFrom plotly plotlyOutput