# NOT RUN {
dem_path <- system.file("extdata", "nc", "elev_ned_30m.tif", package = "openSTARS")
if(.Platform$OS.type == "windows"){
grass_program_path = "c:/Program Files/GRASS GIS 7.6"
} else {
grass_program_path = "/usr/lib/grass78/"
}
setup_grass_environment(dem = dem_path,
gisBase = grass_program_path,
remove_GISRC = TRUE,
override = TRUE
)
gmeta()
# Load files into GRASS
dem_path <- system.file("extdata", "nc", "elev_ned_30m.tif", package = "openSTARS")
sites_path <- system.file("extdata", "nc", "sites_nc.shp", package = "openSTARS")
import_data(dem = dem_path, sites = sites_path)
# Derive streams from DEM
derive_streams(burn = 0, accum_threshold = 700, condition = TRUE, clean = TRUE)
# Check and correct complex junctions (there are no complex confluences in this
# example date set)
cj <- check_compl_confluences()
if(cj){
correct_compl_confluences()
}
# Prepare edges
calc_edges()
# Prepare site
calc_sites()
merge_sites_measurements(measurements = system.file(
"extdata", "nc", "obs_data.csv", package = "openSTARS"),
site_id = "site_id", sep = ",", dec = ".")
# note the dublicated rows, and the new columns at the end
sites <- readVECT("sites", ignore.stderr = TRUE)
head(sites@data, n = 6)
# }
Run the code above in your browser using DataLab