Error in -check : invalid argument to unary operator

37 views
Skip to first unread message

Simir birihan

unread,
Feb 20, 2024, 6:30:27 AMFeb 20
to R-SWAT
Dear all
I am trying to calibrate discharge using SWAT+ in R, but when I load swat+ parameter it provides error massage {Error in -check : invalid argument to unary operator}
SWATParamFile <- file.path(swatPlusTxtInOut, "cal_parms.cal")
SWATParam <-loadSwatParam(SWATParamFile) Error in -check : invalid argument to unary operator  
please solve this error?

Tam Nguyen

unread,
Feb 20, 2024, 6:34:42 AMFeb 20
to R-SWAT
I checked (example R code below) and didn't see any thing wrong.  Could you share your cal_parms.cal file here?

library(RSWAT)
 
# Let's say this is an example swatPlusTxtInOut
swatPlusTxtInOut <- "C:/example"

# Create example SWAT+ txtinout
extracExampleData(exampleData, "swatPlusTxtInOut", swatPlusTxtInOut)


SWATParamFile <- file.path(swatPlusTxtInOut, "cal_parms.cal")

SWATParam <-loadSwatParam(SWATParamFile)

Simir birihan

unread,
Feb 28, 2024, 8:59:21 AMFeb 28
to R-SWAT
thank you,
I get the error miss connection of cal_parms.cal folder.
thank you, it works now.
however still there is question to calibrate the streamflow, when we calibrate in SUFI2 we provide intial value of the parameter and obsrved data to optimize the simulated flow in a given objective function. here I didn't understand the calibration prosses of # LHS sampling
par_cal_100 <- sample_lhs(par_bound, 100)
qsim_cal <- run_swatplus(project_path = path_plus,
                         output = list(q = define_output(file = 'channel_sd_day',
                                                         variable = 'flo_out',
                                                         unit = 1)),
                         parameter = par_cal_100,
                         start_date = cal_start,
                         end_date = cal_end,
                         start_date_print = cal_start_print,
                         n_thread = 4)
the above script is with cant connect with observed data. this is like hard calibration.

Tam Nguyen

unread,
Feb 28, 2024, 9:17:36 AMFeb 28
to R-SWAT
sorry this is not the code from RSWAT, I cannot help
Reply all
Reply to author
Forward
0 new messages