hzambran / hydroPSO

Model-Independent Particle Swarm Optimisation for Environmental Models
https://cran.r-project.org/package=hydroPSO
GNU General Public License v2.0
36 stars 18 forks source link

"invalid connection" error while "write2disk=TRUE" #30

Open Vinit-Sehgal opened 3 years ago

Vinit-Sehgal commented 3 years ago

I am working on inverting SWAP model (http://www.swap.alterra.nl) using satellite soil moisture to upscale soil hydraulic parameters and want to use hydroPSO for model inversion.

I have developed a wrapper function in R for updating and running the SWAP parameters and use the "hydromodInR" option to link with hydroPSO. However, when I use the option "write2disk=TRUE" the optimization stops at the next iteration and I receive the following error (no parameters are saved on disk).

Error in writeLines(as.character(c(iter, j, formatC(GoF, format = "E", : invalid connection The code otherwise works fine if I use "write2disk=FALSE". How can I save the optimized parameters for each iteration to extract 95% CI of the optimized params?