data-raw/spreadsheettemplate.R

pathRoot <- "pathRootHere"
settings <- list(
  # OPTIONS #####
  "OPTIONS" = data.frame("variable" = c("TemperatureInKelvin", "gridSizeUserDefined",
                                        "calc_evaporation", "includeIrrigation",
                                        "includeWaterDemand", "usingAllocSegments",
                                        "limitAbstraction", "calc_environflow",
                                        "preferentialFlow", "CapillarRise",
                                        "includeRunoffConcentration", "includeRouting",
                                        "includeWaterBodies", "inflow",
                                        "writeNetcdfStack", "reportMap",
                                        "reportTss", "calcWaterBalance",
                                        "sumWaterBalance", "PCRaster"),
                         "value" = c(rep("True", 2), "False",
                                     "True", rep("False", 4),
                                     "False", "True",
                                     rep("True", 3), "False",
                                     rep("True", 3), rep("False", 3)),
                         "comment" = c("Is temperature stored in Kelvin?",
                                       "Do you use lat/lon?",
                                       "Should pot. Evaporation be used?",
                                       "Is irrgiation included?",
                                       "Is water demand included?",
                                       "",
                                       "Should water abstraction be limited to available groundwater?",
                                       "Environmental flow",
                                       "Should preferntial flow be used?",
                                       "Should capillary rise be included?",
                                       "",
                                       "Should kinematic wave routing be used?",
                                       "Should water bodies be included?",
                                       "Are there inflows from outside the model area?",
                                       rep("Reporting Options", 3),
                                       rep("Checking water balance (for dubugging)", 2),
                                       ""),
                         stringsAsFactors = FALSE),
  # FILE_PATHS #####
  "FILE_PATHS" = data.frame("variable" = c("PathRoot", "PathOut",
                                           "PathMaps", "PathMeteo"),
                            "value" = c(pathRoot,
                                        "C:/CWatM_output",
                                        "$(PathRoot)/cwatm_input30min",
                                        "$(PathRoot)/climate/rhine"),
                            "comment" = c(rep("", 4)),
                            stringsAsFactors = FALSE),
  # NETCDF_ATTRIBUTES #####
  "NETCDF_ATTRIBUTES" = data.frame("variable" = c("institution", "title", "metaNetcdfFile"),
                                   "value" = c("IIASA", "CWatM Settings File - cwatm4r",
                                               "$(FILE_PATHS:PathRoot)/metaNetcdf.xml"),
                                   "comment" = c(rep("", 3)),
                                   stringsAsFactors = FALSE),
  # MASK_OUTLET ####
  "MASK_OUTLET" = data.frame("variable" = c("MaskMap", "Gauges", "GaugesLocal"),
                             "value" = c("$(FILE_PATHS:PathRoot)/cwatm_input30min/areamaps/rhine30min.tif",
                                         "6.25 51.75 7.75 49.75",
                                         "True"),
                             "comment" = c(rep("Outlet coordinates and/or map file", 3)),
                             stringsAsFactors = FALSE),
  # TIME-RELATED_CONSTANTS #####
  "TIME-RELATED_CONSTANTS" = data.frame("variable" = c("StepStart" ,"SpinUp", "StepEnd"),
                                        "value" = c("1/1/1985", "1/01/1990", "31/12/1992"),
                                        "comment" = c("start date (mm/dd/yyyy)", "end of warm-up period (mm/dd/yyyy)", "end date (mm/dd/yyyy)"),
                                        stringsAsFactors = FALSE),
  # INITITIAL CONDITIONS #####
  "INITITIAL CONDITIONS" = data.frame("variable" = c("load_initial", "initLoad", "save_initial", "initSave", "StepInit"),
                                      "value" = c("False", "$(FILE_PATHS:PathRoot)/init/Rhine_19891231.nc", "False",
                                                  "$(FILE_PATHS:PathRoot)/init/Rhine",
                                                  "31/12/1989 31/12/2010"),
                                      "comment" = c(rep("", 5)),
                                      stringsAsFactors = FALSE),
  # CALIBRATION #####
  "CALIBRATION" = data.frame("variable" = c("SnowMeltCoef", "crop_correct", "soildepth_factor",
                                            "preferentialFlowConstant", "arnoBeta_add", "factor_interflow",
                                            "recessionCoeff_factor", "runoffConc_factor", "manningsN",
                                            "normalStorageLimit", "lakeAFactor", "lakeEvaFactor"),
                             "value" = c(0.0027, 1.11, 1.28, 4.5, 0.19, 2.8
                                         ,5.278, 0.1, 1.86, 0.44, 0.33, 1.52),
                             "comment" = c(rep("", 12)),
                             stringsAsFactors = FALSE),
  # TOPOGRAPHY #####
  "TOPOP" = data.frame("variable" = c("Ldd", "ElevationStD",
                                      "CellArea"),
                       "value" = c("$(FILE_PATHS:PathMaps)/routing/ldd.map",
                                   "$(FILE_PATHS:PathMaps)/landsurface/topo/elvstd.map",
                                   "$(FILE_PATHS:PathMaps)/routing/cellarea.map"),
                       "comment" = c("Local drain direction map (1-9)",
                                     "Elevation std. map for downscaling meteo maps",
                                     "Area of pixel [m2] (for lat/lon every cell has a different area)"),
                       stringsAsFactors = FALSE),
  # METEOROLOGY #####
  "METEO" = data.frame("variable" = c("PrecipitationMaps", "TavgMaps","E0Maps",
                                      "ETMaps", "precipitation_coversion" ,"evaporation_coversion"),
                       "value" = c("$(FILE_PATHS:PathMeteo)/pr_rhine*", "$(FILE_PATHS:PathMeteo)/tavg_rhine*",
                                   "$(FILE_PATHS:PathMeteo)/EWRef_rhine.nc", "$(FILE_PATHS:PathMeteo)/ETRef_rhine.nc",
                                   86.4, 1.00),
                       "comment" = c(rep("", 6)),
                       stringsAsFactors = FALSE),
  # EVAPORATION #####
  "EVAPORATION" = data.frame("variable" = c("albedo", "albedoMaps", "AlbedoSoil", "AlbedoWater", "AlbedoCanopy",
                                            "useHuss", "TminMaps", "TmaxMaps", "PSurfMaps", "RhsMaps", "WindMaps",
                                            "RSDSMaps", "RSDLMaps"),
                             "value" = c("True", "$(FILE_PATHS:PathMaps)/landsurface/albedo/albedo.nc",
                                         0.15, 0.05, 0.23, "False",
                                         "$(FILE_PATHS:PathMeteo)/tasmin*", "$(FILE_PATHS:PathMeteo)/tasmax*",
                                         "$(FILE_PATHS:PathMeteo)/ps*", "$(FILE_PATHS:PathMeteo)/hurs*",
                                         "$(FILE_PATHS:PathMeteo)/wind*", "$(FILE_PATHS:PathMeteo)/rsds*",
                                         "$(FILE_PATHS:PathMeteo)/rlds*"),
                             "comment" = c(rep("", 13)),
                             stringsAsFactors = FALSE),
  # SNOW #####
  "SNOW" = data.frame("variable" = c("NumberSnowLayers", "GlacierTransportZone", "TemperatureLapseRate",
                                     "SnowFactor", "SnowSeasonAdj", "TempMelt", "TempSnow", "IceMeltCoef"),
                      "value" = c(7, 3, 0.0065,
                                  1.0, 0.001, 1.0, 1.0,
                                  0.007),
                      "comment" = c(rep("", 8)),
                      stringsAsFactors = FALSE),
  # FROST #####
  "FROST" = data.frame("variable" = c("SnowWaterEquivalent", "Afrost",
                                      "Kfrost", "FrostIndexThreshold"),
                       "value" = c(0.45, 0.97, 0.57, 56.0),
                       "comment" = c(rep("", 4)),
                       stringsAsFactors = FALSE),
  # VEGETATION #####
  "VEGETATION" = data.frame("variable" = c("cropgroupnumber"),
                            "value" = c("$(FILE_PATHS:PathMaps)/soil/cropgrp.nc"),
                            "comment" = c(""),
                            stringsAsFactors = FALSE),
  # SOIL #####
  "SOIL" = data.frame("variable" = c("PathTopo", "PathSoil1", "tanslope",
                                     "slopeLength", "relativeElevation",
                                     "KSat1", "KSat2", "KSat3",
                                     "alpha1", "alpha2", "alpha3",
                                     "lambda1", "lambda2", "lambda3",
                                     "thetas1", "thetas2", "thetas3",
                                     "thetar1", "thetar2", "thetar3",
                                     "percolationImp", "maxGWCapRise",
                                     "minCropKC", "minTopWaterLayer",
                                     "StorDepth1", "StorDepth2"),
                      "value" = c("$(FILE_PATHS:PathMaps)/landsurface/topo",
                                  "$(FILE_PATHS:PathMaps)/soil",
                                  "$(PathTopo)/tanslope.map",
                                  "$(PathTopo)/slopeLength.map",
                                  "$(PathTopo)/dzRel_hydro1k.nc",
                                  "$(PathSoil)/ksat1.map",
                                  "$(PathSoil)/ksat2.map",
                                  "$(PathSoil)/ksat3.map",
                                  "$(PathSoil)/alpha1.map",
                                  "$(PathSoil)/alpha2.map",
                                  "$(PathSoil)/alpha3.map",
                                  "$(PathSoil)/lambda1.map",
                                  "$(PathSoil)/lambda2.map",
                                  "$(PathSoil)/lambda3.map",
                                  "$(PathSoil)/thetas1.map",
                                  "$(PathSoil1)/thetas2.map",
                                  "$(PathSoil/thetas3.map",
                                  "$(PathSoil)/thetar1.map",
                                  "$(PathSoil)/thetar2.map",
                                  "$(PathSoil)/thetar3.map",
                                  "$(PathSoil)/percolationImp.map",
                                  5.0, 0.2, 0.0,
                                  "$(PathSoil)/storageDepth1.map",
                                  "$(PathSoil)/storageDepth2.map"),
                      "comment" = c(rep("", 26)),
                      stringsAsFactors = FALSE),
  # LANDCOVER #####
  "LANDCOVER" = data.frame("variable" = c("PathLandcover", "coverTypes", "coverTypesShort",
                                          "fractionLandcover", "dynamicLandcover",
                                          "fixLandcoverYear"),

                           "value" = c("$(FILE_PATHS:PathMaps)/landsurface",
                                       "forest, grassland, irrPaddy, irrNonPaddy, sealed, water",
                                       "f, g, i, n, s, w",
                                       "$(PathLandcover)/fractionLandCover.nc",
                                       "True",
                                       1961.0),
                           "comment" = c(rep("", 6)),
                           stringsAsFactors = FALSE),
  # __forest #####
  "__forest" = data.frame("variable" = c("PathForest", "PathSoil1", "forest_arnoBeta",
                                         "forest_KSat1", "forest_KSat2", "forest_KSat3",
                                         "forest_alpha1", "forest_alpha2", "forest_alpha3",
                                         "forest_lambda1", "forest_lambda2", "forest_lambda3",
                                         "forest_thetas1", "forest_thetas2", "forest_thetas3",
                                         "forest_thetar1", "forest_thetar2", "forest_thetar3",
                                         "forest_minInterceptCap", "forest_cropDeplFactor",
                                         "forest_fracVegCover", "forest_rootFraction1",
                                         "forest_rootFraction2", "forest_maxRootDepth",
                                         "forest_minSoilDepthFrac", "forest_cropCoefficientNC",
                                         "forest_interceptCapNC"),
                          "value" = c("$(FILE_PATHS:PathMaps)/landcover/forest",
                                      "$(FILE_PATHS:PathMaps)/soil",
                                      0.2,
                                      "$(PathSoil)/forest_ksat1.map",
                                      "$(PathSoil)/forest_ksat2.map",
                                      "$(PathSoil)/ksat3.map",
                                      "$(PathSoil)/forest_alpha1.map",
                                      "$(PathSoil)/forest_alpha2.map",
                                      "$(PathSoil)/alpha3.map",
                                      "$(PathSoil)/forest_lambda1.map",
                                      "$(PathSoil)/forest_lambda2.map",
                                      "$(PathSoil)/lambda3.map",
                                      "$(PathSoil)/forest_thetas1.map",
                                      "$(PathSoil)/forest_thetas2.map",
                                      "$(PathSoil)/thetas3.map",
                                      "$(PathSoil)/forest_thetar1.map",
                                      "$(PathSoil)/forest_thetar2.map",
                                      "$(PathSoil)/thetar3.map",
                                      0.001, 0.0,
                                      "$(PathForest)/fracVegCover.map",
                                      "$(PathForest)/rootFraction1.map",
                                      "$(PathForest)/rootFraction2.map",
                                      "$(PathForest)/maxRootDepth.map",
                                      "$(PathForest)/minSoilDepthFrac.map",
                                      "$(PathForest)/cropCoefficientForest_10days.nc",
                                      "$(PathForest)/interceptCapForest_10days.nc"),
                          "comment" = c(rep("", 27)),
                          stringsAsFactors = FALSE),
  # __grassland #####
  "__grassland" = data.frame("variable" = c("PathGrassland", "grassland_arnoBeta", "grassland_minInterceptCap",
                                            "grassland_cropDeplFactor", "grassland_fracVegCover",
                                            "grassland_rootFraction1", "grassland_rootFraction2",
                                            "grassland_maxRootDepth", "grassland_minSoilDepthFrac",
                                            "grassland_cropCoefficientNC", "grassland_interceptCapNC"),
                             "value" = c("$(FILE_PATHS:PathMaps)/landcover/grassland", 0.0, 0.001, 0.0,
                                         "$(PathGrassland)/fracVegCover",
                                         "$(PathGrassland)/rootFraction1.map",
                                         "$(PathGrassland)/rootFraction3.map",
                                         "$(PathGrassland)/maxRootDepth.map",
                                         "$(PathGrassland)/minSoilDepthFrac.map",
                                         "$(PathGrassland)/cropCoefficientGrassland_10days.nc",
                                         "$(PathGrassland)/interceptCapGrassland_10days.nc"),
                             "comment" = c(rep("", 11)),
                             stringsAsFactors = FALSE),
  # __irrPaddy #####
  "__irrPaddy" = data.frame("variable" = c("PathIrrPaddy", "irrPaddy_arnoBeta", "irrPaddy_minInterceptCap",
                                           "irrPaddy_cropDeplFactor", "irrPaddy_fracVegCover", "irrPaddy_rootFraction1",
                                           "irrPaddy_rootFraction2", "irrPaddy_maxRootDepth",
                                           "irrPaddy_minSoilDepthFrac", "irrPaddy_cropCoefficientNC", "irrPaddy_maxtopwater"),
                            "value" = c("$(FILE_PATHS:PathMaps)/landcover/irrPaddy", 0.2, 0.001, 0.0,
                                        "$(PathIrrPaddy)/fracVegCover.map", "$(PathIrrPaddy)/rootFraction1.map",
                                        "$(PathIrrPaddy)/rootFraction2.map", "$(PathIrrPaddy)/maxRootDepth.map",
                                        "$(PathIrrPaddy)/minSoilDepthFrac.map", "$(PathIrrPaddy)/cropCoefficientirrPaddy_10days.nc",
                                        0.05),
                            "comment" = c(rep("", 11)),
                            stringsAsFactors = FALSE),
  # __irrNonPaddy #####
  "__irrNonPaddy" = data.frame("variable" = c("PathIrrNonPaddy", "irrNonPaddy_arnoBeta", "irrNonPaddy_minInterceptCap",
                                              "irrNonPaddy_cropDeplFactor", "irrNonPaddy_fracVegCover", "irrNonPaddy_rootFraction1",
                                              "irrNonPaddy_rootFraction2", "irrNonPaddy_maxRootDepth",
                                              "irrNonPaddy_minSoilDepthFrac", "irrNonPaddy_cropCoefficientNC"),
                               "value" = c("$(FILE_PATHS:PathMaps)/landcover/irrNonPaddy", 0.2, 0.001, 0.0,
                                           "$(PathIrrNonPaddy)/fracVegCover.map",
                                           "$(PathIrrNonPaddy)/rootFraction1.map",
                                           "$(PathIrrNonPaddy)/rootFraction2.map",
                                           "$(PathIrrNonPaddy)/maxRootDepth.map",
                                           "$(PathIrrNonPaddy)/minSoilDepthFrac.map",
                                           "$(PathIrrNonPaddy)/cropCoefficientirrNonPaddy_10days.nc"),
                               "comment" = c(rep("", 10)),
                               stringsAsFactors = FALSE),
  # __sealed #####
  "__sealed" = data.frame("variable" = c("PathSealed", "sealed_minInterceptCap"),
                          "value" = c("$(FILE_PATHS:PathMaps)/landcover/sealed", 0.001),
                          "comment" = c(rep("", 2)),
                          stringsAsFactors = FALSE),
  # __open_water #####
  "__open_water" = data.frame("variable" = c("PathWater", "water_minInterceptCap"),
                              "value" = c("$(FILE_PATHS:PathMaps)/landcover/water", 0.0),
                              "comment" = c(rep("", 2)),
                              stringsAsFactors = FALSE),
  # GROUNDWATER #####
  "GROUNDWATER" = data.frame("variable" = c("PathGroundwater", "recessionCoeff", "specificYield",
                                            "kSatAquifer"),
                             "value" = c("$(FILE_PATHS:PathMaps)/groundwater",
                                         "$(PathGroundwater)/recessionCoeff.map",
                                         "$(PathGroundwater)/specificYield.map",
                                         "$(PathGroundwater)/kSatAquifer.map"),
                             "comment" = c(rep("", 4)),
                             stringsAsFactors = FALSE),
  # WATERDEMAND #####
  "WATERDEMAND" = data.frame("variable" = c("PathWaterdemand", "allocSegments", "domesticWaterDemandFile", "industryWaterDemandFile",
                                            "irrNonPaddy_efficiency", "irrPaddy_efficiency", "use_environflow",
                                            "EnvironmentalFlowFile", "irrigation_returnfraction", "swAbstractionFrac",
                                            "averageDischarge", "averageBaseflow", "baseflowInM"),
                             "value" = c("$(FILE_PATHS:PathMaps)/landsurface/waterDemand",
                                         "$(PathWaterdemand)/catchx.nc",
                                         "$(PathWaterdemand)/domesticWaterDemand.nc",
                                         "$(PathWaterdemand)/industryWaterDemand.nc",
                                         "$(FILE_PATHS:PathMaps)/landsurface/waterDemand/efficiency.nc",
                                         "$(FILE_PATHS:PathMaps)/landsurface/waterDemand/efficiency.nc",
                                         "False", "$(FILE_PATHS:PathOut)/MQ90_12month.nc",
                                         0.5, 0.9,
                                         "$(FILE_PATHS:PathOut)/discharge_totalavg_rhine30min.nc",
                                         "$(FILE_PATHS:PathOut)/discharge_totalavg_rhine30min.nc",
                                         "True"),
                             "comment" = c(rep("", 13)),
                             stringsAsFactors = FALSE),
  # RUNOFF_CONCENTRATION #####
  "RUNOFF_CONCENTRATION" = data.frame("variable" = c("forest_runoff_peaktime",
                                                     "grassland_runoff_peaktime",
                                                     "irrPaddy_runoff_peaktime",
                                                     "irrNonPaddy_runoff_peaktime",
                                                     "sealed_runoff_peaktime",
                                                     "water_runoff_peaktime",
                                                     "interflow_runoff_peaktime",
                                                     "baseflow_runoff_peaktime"),
                                      "value" = c(1.0, 0.5, 0.5, 0.5,
                                                  0.15, 0.01, 1.0, 2.0),
                                      "comment" = c(rep("", 8)),
                                      stringsAsFactors = FALSE),
  # ROUTING #####
  "ROUTING" = data.frame("variable" = c("PathRouting", "NoRoutingSteps", "chanBeta",
                                        "chanGrad", "chanGradMin", "chanMan",
                                        "chanLength", "chanWidth", "chanDepth"),
                         "value" = c("$(FILE_PATHS:PathMaps)/routing", 10.0, 0.6,
                                     "$(PathRouting)/kinematic/changrad.map", 0.0001,
                                     "$(PathRouting)/kinematic/chanman.map",
                                     "$(PathRouting)/kinematic/chanleng.map",
                                     "$(PathRouting)/kinematic/chanbw.map",
                                     "$(PathRouting)/kinematic/chanbnkf.map"),
                         "comment" = c(rep("", 9)),
                         stringsAsFactors = FALSE),
  # LAKES_RESERVOIRS #####
  "LAKES_RESERVOIRS" = data.frame("variable" = c("PathLakesRes", "useResAndLakes", "dynamicLakesRes",
                                                 "fixLakesResYear", "waterBodyID", "waterBodyTyp",
                                                 "waterBodyDis", "waterBodyArea", "useSmallLakes",
                                                 "smallLakesRes", "smallwaterBodyDis", "waterBodyVolRes",
                                                 "waterBodyYear", "conservativeStorageLimit",
                                                 "floodStorageLimit", "adjust_Normal_Flood", "MinOutflowQ",
                                                 "NormalOutflowQ", "NonDamagingOutflowQ"),
                                  "value" = c("$(FILE_PATHS:PathMaps)/routing/lakesreservoirs",
                                              "True", "True", 1950,
                                              "$(PathLakesRes)/lakesResID.nc",
                                              "$(PathLakesRes)/lakesResType.nc",
                                              "$(PathLakesRes)/lakesResDis.nc",
                                              "$(PathLakesRes)/lakesResArea.nc",
                                              "True", "$(PathLakesRes)/smallLakesRes.nc",
                                              "$(PathLakesRes)/smalllakesresDis.nc",
                                              "$(PathLakesRes)/lakesResVolRes.nc",
                                              "$(PathLakesRes)/lakesResYear.nc",
                                              0.1, 0.9, 0.5, 0.2, 1.0, 4.0),
                                  "comment" = c(rep("", 19)),
                                  stringsAsFactors = FALSE),
  # INFLOW #####
  "INFLOW" = data.frame("variable" = c("In_Dir", "InflowPoints", "QInTS"),
                        "value" = c("$(FILE_PATHS:PathRoot)/in", "$(In_Dir)/in.map", "mm.tss"),
                        "comment" = c(rep("", 3)),
                        stringsAsFactors = FALSE),
  # ENVIRONMENTALFLOW #####
  "ENVIRONMENTALFLOW" = data.frame("variable" = c("calc_ef_after", "EFDis", "cut_ef_map"),
                                   "value" = c("True",
                                               "$(FILE_PATHS:PathOut)/discharge_rhine.nc",
                                               "False"),
                                   "comment" = c(rep("", 3)),
                                   stringsAsFactors = FALSE),
  # OUTPUT #####
  "OUTPUT" = data.frame("variable" = c("OUT_Dir",
                                       "OUT_TSS_Daily",
                                       "OUT_TSS_MonthAvg",
                                       "OUT_TSS_AnnualAvg",
                                       "OUT_Map_Daily",
                                       "OUT_Map_MonthAvg",
                                       "OUT_Map_AnnualAvg",
                                       "OUT_MAP_TotalAvg"),
                        "value" = c("$(FILE_PATHS:PathOut)",
                                    "discharge",
                                    "",
                                    "",
                                    "",
                                    "discharge, Precipitation, runoff",
                                    "discharge",
                                    ""),
                        "comment" = c(rep("", 8)),
                        stringsAsFactors = FALSE)
  #####
)

usethis::use_data(settings, internal = TRUE, overwrite = TRUE)
dof1985/cwatm4r documentation built on Nov. 8, 2022, 7:30 p.m.