Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • airGRiwrm airGRiwrm
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 25
    • Issues 25
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 1
    • Merge requests 1
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • IN-WOP
  • airGRiwrmairGRiwrm
  • Issues
  • #64
Closed
Open
Issue created Dec 09, 2021 by Dorchies David@david.dorchiesOwner

`CreateGRiwrm` crashes when keeping all columns and rename some

See example below:

text = "id_amont	lambert2.x	lambert2.y	area	nom	id_aval	distance_aval	model
H8100021	537912.994	2455749.314	64420.94	La Seine à Vernon	NA	NA	RunModel_CemaNeigeGR4J
H7900010	578113	2437649	61642.28	La Seine à Poissy	H8100021	76.28	RunModel_CemaNeigeGR4J
H5920010	602213	2427449	43824.66	La Seine à Paris [Austerlitz après création lacs]	H7900010	82.26	RunModel_CemaNeigeGR4J"

BS_reseau <- read.csv(text = text, sep = "\t")

library(airGRiwrm)
> griwrm <- CreateGRiwrm(BS_reseau, 
                         cols = list(id = "id_amont",
                                     down = "id_aval",
                                     length = "distance_aval"),
                         keep_all = TRUE)

which leads to this error:

Error in if (typeof(df[[x]]) != coltypes[[x]]) { : 
argument is of length zero
4.
FUN(X[[i]], ...)
3.
lapply(names(df), function(x) {
if (typeof(df[[x]]) != coltypes[[x]]) {
stop(sprintf("The '%s' column is of type %s, a column of type %s is required", 
x, typeof(df[[x]]), coltypes[[x]])) ... at CreateGRiwrm.R#95
2.
CheckColumnTypes(db, list(id = "character", down = "character", 
length = "double", model = "character", area = "double")) at CreateGRiwrm.R#69
1.
CreateGRiwrm(BS_reseau, cols = list(id = "id_amont", down = "id_aval", 
length = "distance_aval"), keep_all = TRUE)
Assignee
Assign to
Time tracking