db_fill: Fill parameter database

View source: R/db_fill.R

db_fillR Documentation

Fill parameter database

Description

Function to write parameter values relevant for modelling application with the WASA hydrological model into an existing database, preferably created with db_create.

Usage

db_fill(dbname, tables = c("r_subbas_contains_lu", "subbasins",
  "landscape_units", "r_lu_contains_tc", "terrain_components",
  "r_tc_contains_svc", "vegetation", "soils", "horizons",
  "soil_veg_components", "particle_classes", "r_soil_contains_particles",
  "rainy_season", "reservoirs_strategic", "reservoirs_small",
  "r_subbas_contains_reservoirs_small"), dat_files, dat_dir,
  overwrite = FALSE, verbose = TRUE)

Arguments

dbname

Name of the data source (DSN) registered at ODBC. See Details of db_create.

tables

vector with name(s) of the table(s) in the database that should be filled with data. Order must correspond to the order of dat_files. By default all tables are specified (see Usage for order of dat_files). See Details for more information.

dat_files

vector with name(s) of the file(s) containing the data that should be written into the database. Order must correspond to the order of tables. See Details for information on file strcuture.

dat_dir

string giving the path to the directory containing dat_files.

overwrite

logical. Should Existing data be overwritten? If FALSE existing values will be kept und the table expanded. Default: FALSE.

verbose

logical. Should detailed information during execution be printed? Default: TRUE.

Details

For each table a single file has to be prepared manually and/or using functions of lumpR. All files have to be tabulator-separated textfiles, the top-line being the header. Column names have to be identical to column names of the respective tables in the database. All columns of a table have to exist in the respective data file. If a certain column is not needed for your purpose or contains missing values set values to NA. However, additional columns may exist and will be omitted during database import and the order of the columns may be freely chosen. Commentary lines are allowed and will be omitted during data import; these have to begin with #. Duplicate entries or entries in the input file which are already in the database table (unless you set overwrite=T) are not allowed and produce an error.

r_subbas_contains_lu
Table referncing subbasins and corresponding landscape units inclunding their areal fraction. lu_ofile produced by lump_grass_post can be used. Columns:

subbas_id
integer. Subbasin ID.

lu_id
integer. Landscape Unit ID.

fraction
double. Areal fraction of landscape unit within subbasin [-].

subbasins
Subbasin parameters. sub_ofile produced by lump_grass_post can be used. Columns:

pid
integer. Subbasin identifier.

description
character. Short subbasin name or description.

lat
double. Latitude of subbasin centroid in decimal degrees (negative values for southern hemisphere).

lon
double. Longitude of subbasin centroid in decimal degrees west of Greenwhich, e.g. Greenwich: 0°, New York: 75°, Berlin: 345°.

elev
double. Average elevation above sea level of subbasin m.

drains_to
integer. Pid of subbasin the current subbasin drains to. The outlet subbasin has to be labelled by one of c(9999,-9999,999,-999).

area
double. Subbasin area in km^2.

a_stream_order
integer. Stream order. Set to NA. Calculated during WASA input file creation.

lag_time
double. Time in days a runoff signal in the current subbasin needs to be directed from the subbasin input to the outlet.

retention
double. Maximum time period in days over which a runoff signal is distributed by the routing process.

chan_len
double. Subbasin's main channel length in m.

landscape_units
Landscape Unit parameters. Information can be obtained from luoutfile created by prof_class (column 'x_length' which is identical to 'slopelength') and lupar_ofile created by lump_grass_post (all other information). Merge information by hand. Columns:

pid
integer. Landscape Unit ID.

description
character. Short name or description.

kf_bedrock
double. Hydraulic conductivity of bedrock in mm/d.

slopelength
double. Mean slope length in landscape unit in m. Meant is the length in x-direction, not the hypotenuse of the hillslope profile triangle.

soil_depth
double. Mean maximum depth of soil zone in mm.

allu_depth
double. Mean maximum depth of alluvial soil zone in mm.

riverbed_depth
double. Depth of river bed below terrain component in mm.

gw_flag
integer. Groundwater flag; 0: no groundwater, 1: with groundwater.

gw_dist
double. Initial depth of groundwater below surface in mm.

frgw_delay
double. Storage coefficient for groundwater outflow in days.

sdr_lu
double. Sediment delivery ratio on LU-scale. For erosion modelling, only.

r_lu_contains_tc
Table referncing landscape units and corresponding terrain components inclunding their areal fraction and hillslope position. lucontainstcoutfile created by prof_class can be used directly. Columns:

lu_id
integer. Landscape unit ID.

tc_id
integer. Terrain component ID.

fraction
double. Areal fraction of TC within LU [-].

position
integer. Hillslope position of TC in LU (counting from hillslope bottom).

terrain_components
Terrain component specific parameters. Information from terraincomponentsoutfile created by prof_class can be used. Columns:

pid
integer. Terrain component ID.

description
character. Short name or description.

slope
double. Slope of terrain component in %.

frac_rocky
double. Fraction of impermeable (rock) area [-].

beta_fac
double. Ratio of rill/interrill erosion (for computation of the L-factor see Renard et al., 1997, pp.101). For erosion modelling, only.

sdr
double. Sediment delivery ratio on TC-scale. For erosion modelling, only.

r_tc_contains_svc
Table referncing terrain components and corresponding soil-vegetation components inclunding their areal fraction. tccontainssvcoutfile created by prof_class can be used directly. Columns:

tc_id
integer. Terrain component ID.

svc_id
integer. Soil-vegetation component ID.

fraction
double. Areal fraction of SVC within TC [-].

vegetation
Vegetation parameters. Columns:

pid
integer. Vegetation type ID.

description
character. Short name or description.

stomat_r
double. Stomata resistance without water stress in s/m.

min_suction
double. Suction threshold for water stress effect on resistance: Begin of stomata closure. In hPa.

max_suction
double. Suction threshold for water stress effect on resistance: Total closure of stomata, wilting point. In hPa.

height1
double. Average height of vegetation canopy before rainy season in m.

height2
double. Average height of vegetation canopy at the beginning of rainy season in m.

height3
double. Average height of vegetation canopy at the end of rainy season in m.

height4
double. Average height of vegetation canopy after rainy season in m.

root_depth1
double. Rooting depth of vegetation before rainy season in m.

root_depth2
double. Rooting depth of vegetation at the beginning of rainy season in m.

root_depth3
double. Rooting depth of vegetation at the end of rainy season in m.

root_depth4
double. Rooting depth of vegetation after rainy season in m.

lai1
double. Leaf area index of vegetation cover before rainy season [-].

lai2
double. Leaf area index of vegetation cover at the beginning of rainy season [-].

lai3
double. Leaf area index of vegetation cover at the end of rainy season [-].

lai4
double. Leaf area index of vegetation cover after rainy season [-].

alb1
double. Surface albedo before rainy season [-].

alb2
double. Surface albedo at the beginning of rainy season [-].

alb3
double. Surface albedo at the end of rainy season [-].

alb4
double. Surface albedo after rainy season [-].

c_manning_n
double. Optional for Erosion modelling.

c_musle_c1
double. Optional for Erosion modelling.

c_musle_c2
double. Optional for Erosion modelling.

c_musle_c3
double. Optional for Erosion modelling.

c_musle_c4
double. Optional for Erosion modelling.

intfc
double. Interception capacity per unit LAI in m. For ECHSE's WASA engine only.

crop_makk
double. Crop-factor for calculation of pot. evapotransp. after Makkink (optional) [-].

crop_faoref
double. Crop-factor for calculation of pot. evapotransp. after FAO reference method (optional) [-].

par_stressHum
double. Parameter to calculate water vapour deficit stomatal conductance stress factor. In WASA it was a hard-coded parameter of value 0.03 [1/hPa].

glo_half
double. Solar radiation at which stomatal conductance is half of its maximum [W/m2].

soils
General soil parameters (horizon-specific parameters see below). Columns:

pid
integer. Soil type ID.

description
character. Short name or description.

bedrock_flag
integer. Bedrock below deepest horizon: 0: not considered, 1: considered.

alluvial_flag
integer. Soil type is alluvial soil: 0: no, 1: yes.

b_om
double. Topsoil organic matter content (mass fraction) [-].

a_musle_k
double. Used for internal calculations, set NA.

a_clay
double. Used for internal calculations, set NA.

a_silt
double. Used for internal calculations, set NA.

a_sand
double. Used for internal calculations, set NA.

a_f_csand
double. Used for internal calculations, set NA.

a_f_cl_si
double. Used for internal calculations, set NA.

a_f_orgc
double. Used for internal calculations, set NA.

a_f_hisand
double. Used for internal calculations, set NA.

Phil_s
double. Infiltration: Philip parameter: Sorptivity; calculated internally in ECHSE if set to NA value ms^(-1/2).

Phil_a
double. Infiltration: Philip parameter: second term parameter; calculated internally if set to NA value m/s.

Hort_ini
double. Infiltration: Horton parameter: initial infiltration rate m/s.

Hort_end
double. Infiltration: Horton parameter: final infiltration rate m/s.

Hort_k
double. Infiltration: Horton parameter: decay constant 1/s.

horizons
Horizon specific soil parameters. Columns:

pid
integer. Horizon ID.

description
character. Short name or description.

soil_id
integer. Soil type ID.

position
integer. Position of soil type specific horizon counting from surface.

theta_r
double. Residual volumetric soil water content [-].

theta_pwp
double. Volumetric soil water content at permanent wilting point [-].

fk
double. Volumetric soil water content at field capacity (316 hPa / pF=2.6) [-].

fk63
double. Volumetric soil water content at field capacity (63 hPa / pF=1.8) [-].

nfk
double. Usable field capacity in terms of volumetric soil water content [-].

theta_s
double. Saturated volumetric soil water content [-].

thickness
double. Thickness of soil horizon in mm.

ks
double. Saturated hydraulic conductivity in mm/day.

suction
double. Suction at the wetting front in mm.

pore_size_i
double. Pore size index.

bubb_pres
double. Bubble pressure in cm.

coarse_frag
double. Volumetric fraction of coarse fragments [-].

shrinks
integer. Flag for soil structure, currently not used, set to 0 (not NA!).

soil_dens
double. Bulk density in kg/m3.

soil_veg_components
Parameters specific for soil-vegetation components. svc_ofile created by lump_grass_prep can be used directly. Columns:

pid
integer. Soil-vegetation component ID.

description
character. Short name or description.

soil_id
integer. Soil type ID.

veg_id
integer. Vegetation type ID.

musle_k
double. MUSLE K-factor [(ton acre hr)/(acre ft-ton inch)].

musle_p
double. MUSLE P-factor.

coarse_frac
double. Fraction of coarse fragments in %.

special_area
integer. Flag for special areas: 1: water, 2: impervious, 0: ordinary SVC.

manning_n
double. Mannings n roughness coefficient for overland flow.

musle_c1
double. Optional for Erosion modelling.

musle_c2
double. Optional for Erosion modelling.

musle_c3
double. Optional for Erosion modelling.

musle_c4
double. Optional for Erosion modelling.

particle_classes
Definition of particle size classes. Columns:

class_id
integer. Particle class ID.

description
character. Short name or description.

upper_limit
double. Upper size limit of particles in mm.

r_soil_contains_particles
Table referncing soil types and corresponding particle size classes including their specific shares. Columns:

soil_id
integer. Soil type ID.

class_id
integer. Particle class ID.

fraction
double. Mass-fraction that falls into the respective particle size class [-].

rainy_season
Fill in output of rainy_season. You can define separate seasonalities for different vegetation types if you want (i.e. 'growing season' instead of 'rainy season'). In this case the rainy/growing season starts and ends differently for the respective vegetation types. This, however, is not respected by function rainy_season which determines seasonalities based on precipitation only. You can use the wildcard value '-1' for all (remaining) vegetation types. Columns:

pid
integer. Dataset ID.

subbas_id
integer. Id of subbasin or '-1' as wildcard for all (remaining) subbasins.

veg_id
integer. Id of vegetation type or '-1' as wildcard for all (remaining) vegetation types.

yearm
integer. Current year or '-1' as wildcard for all (remaining) years.

node1
integer. Start day of year (DOY) of rainy/growing season.

node2
integer. DOY when climax of vegetation is reached.

node3
integer. DOY of end of rainy/growing season (begin of vegetation degradation).

node4
integer. DOY of end of main phase of vegetation degradation.

reservoirs_strategic
Strategic reservoir parameters. Fill in output of reservoir_strategic.

pid
ID of the corresponding subbasin.

res_id
Unique numeric reservoir identifier (if res_file is given, it also needs to be defined in the vector file's attribute table!).

name
OPTIONAL: name of the reservoir. Will be filled with <NA> if not given.

minlevel
Initial minimum level in the reservoir [m]. Value varies because of sediment accumulation.

maxlevel
Maximum water level in the reservoir [m].

vol0
Initial volume of the reservoir [10^3 m^3]. Value varies because of sediment accumulation. Set to '-999' if information is not available.

storecap
Initial storage capacity of the reservoir [10^3 m^3]. Value varies because of sediment accumulation.

damflow
Target outflow discharge of the reservoir (90 % reliability) [m^3/s].

damq_frac
Fraction of Q90 released from the reservoir in regular years [-].

withdrawal
Water withdrawal discharge from the reservoir to supply the water use sectors [m^3/s]. Outflow discharge through the dam is not considered.

damyear
Year of construction of the dam (YYYY).

maxdamarea
Initial maximum area of the reservoir [ha]. Value varies because of sediment accumulation.

damdead
Initial dead volume of the reservoir [10^3 m^3]. Value varies because of sediment accumulation.

damalert
Initial alert volume of the reservoir [10^3 m^3]. Value varies because of sediment accumulation.

dama, damb
Parameters of the area-volume relationship in the reservoir: area = dama * Vol^damb [-]. Values of reservoir area and volume are expressed in m^2 and m^3, respectively.

q_outlet
Maximum outflow discharge released through the bottom outlets of the reservoir [m^3/s].

fvol_botm
Fraction of storage capacity that indicates the minimum storage volume for sediment release through the bottom outlets of the reservoir [-].

fvol_over
Fraction of storage capacity that indicates the minimum storage volume for water release through the spillway of the reservoir [-].

damc, damd
Parameters of the spillway rating curve of the reservoir: Qout = damc * Hv^damd [-]. Values of water height over the spillway and overflow discharges are expressed in m and m^3/s, respectively.

elevbottom
Bottom outlet elevation of the reservoir [m].

reservoirs_small_classes
Small reservoir parameters. Fill in output of reservoir_lumped (reservoirs_small_classes.dat). pid
reservoir class ID name
optional name tag. Leave empty if not used. maxlake0
Upper limit of reservoir size class in terms of volume [m^3] lake_vol0_factor
Fraction of storage capacity that indicates the initial water volume in the reservoir size classes [-] lake_change
Factor that indicates yearly variation in the number of reservoirs of the size classes [-] alpha_Molle
Parameters of the area-volume relationship in the reservoir size classes (Area=alpha.k.(Vol/k)alpha/(alpha-1)) [-]. Values of reservoir area and volume are expressed in m² and m³, respectively k_Molle
Parameters of the area-volume relationship in the reservoir size classes (Area=alpha.k.(Vol/k)alpha/(alpha-1)) [-]. Values of reservoir area and volume are expressed in m² and m³, respectively damc
Parameters of the spillway rating curve in the reservoir size classes (Qout=damc.Hv^damd) [-]. Values of water height over the spillway and overflow discharges are expressed in m and m³/s, respectively damd
Parameters of the spillway rating curve in the reservoir size classes (Qout=damc.Hv^damd) [-]. Values of water height over the spillway and overflow discharges are expressed in m and m³/s, respectively

r_subbas_contains_reservoirs_small
Small reservoir distribution in subbasins. Fill in output of reservoir_lumped (r_subbas_contains_reservoirs_small.dat). subbas_id
foreign key to subbas', res_class_id
foreign key to reservoirs_small_classes', n_reservoirs
number of reservoirs [-]', maxlake
Mean value of initial storage capacity of the hypothetical representative reservoirs of the size classes [m^3]',

Author(s)

Tobias Pilz tpilz@uni-potsdam.de, Till Francke francke@uni-potsdam.de

References

lumpR paper
Pilz, T.; Francke, T.; Bronstert, A. (2017): lumpR 2.0.0: an R package facilitating landscape discretisation for hillslope-based hydrological models. Geosci. Model Dev., 10, 3001-3023, doi: 10.5194/gmd-10-3001-2017

Theory of lumpR
Francke, T.; Guentner, A.; Mamede, G.; Mueller, E. N. and Bronstert, A (2008): Automated catena-based discretization of landscapes for the derivation of hydrological modelling units. International Journal of Geographical Information Science, Informa UK Limited, 22(2), 111-132, DOI: 10.1080/13658810701300873

Information on WASA and parameters
Guentner, A. (2002): Large-scale hydrological modelling in the semi-arid North-East of Brazil. PIK Report 77, Potsdam Institute for Climate Impact Research, Potsdam, Germany.

More information on subbasin parameters
Bronstert, A., Guentner, A., Jaeger, A., Krol, M. & Krywkow, J. (1999): Grossraeumige hydrologische Parametrisierung und Modellierung als Teil der integrierten Modellierung. In: Fohrer, N. & Doell, P. (Eds.): Modellierung des Wasser- und Stofftransports in grossen Einzugsgebieten. Kassel University Press, Kassel, Germany, 31-40.


tpilz/LUMP documentation built on Aug. 5, 2023, 1:31 a.m.