Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New issue with calibrate_sim #273

Open
fanxian1998 opened this issue Dec 8, 2021 · 7 comments
Open

New issue with calibrate_sim #273

fanxian1998 opened this issue Dec 8, 2021 · 7 comments

Comments

@fanxian1998
Copy link

The following is part of the code of R language Lanmei :

calib_setup <- setup <- data.frame('pars' = as.character(c('wind_factor','lw_factor','ch','sed_temp_mean','sed_temp_mean',
'coef_mix_hyp','Kw')),
'lb' = c(0.7,0.7,5e-4,3,8,0.6,0.05),
'ub' = c(2,2,0.002,8,20,0.4,0.5),
'x0' = c(1,1,0.0013,5,15,0.5,0.1))
print(calib_setup)
glmcmd = NULL
first.attempt = TRUE
period = get_calib_periods(nml_file,ratio = 2)
period
scaling = TRUE
method = 'CMA-ES'
metric = 'RMSE'
target.fit = 1.5
target.iter = 100
plotting = TRUE
output = out_file
field_file = field_data
calibrate_sim(var, path, field_file, nml_file, calib_setup, glmcmd, first.attempt, period,
scaling, method, metric, target.fit, target.iter, plotting, output, verbose = FALSE)

When running to calibrate_sim, an error occurred, as shown below :
Calibration functions are under development, and are likley to change with future package updates.
[1] "RMSE 4.926"
[1] "RMSE 6.963"
Error in approx(x = elevs_re, y = temps_re, xout = elevs_out) :
need at least two non-NA values to interpolate
In addition: There were 33 warnings (use warnings() to see them)

I want to ask what is causing this and how to solve the problem, I hope someone can answer it, or contact me by email .my mail box :[email protected]

@fanxian1998
Copy link
Author

I hope teachers will give suggestions .thank you all !

@jordansread
Copy link
Member

@robertladwig can you respond to this ☝️

@fanxian1998
Copy link
Author

@robertladwig Hello, do you have any good suggestions? I tried to modify it for a long time, but this problem still can't be solved .

@robertladwig
Copy link
Member

that error means that a parameter combination of the calibration algorithm resulted in a GLM run with NaN's meaning that the simulation probably did crash. A cause could be that your lower boundary value (lb) of coef_mix_hyp is higher than your upper boundary value (ub), 0.6 to 0.4

@fanxian1998
Copy link
Author

@robertladwig .After reading your reply, I adjusted it as soon as possible, but the same error still appeared. I reorganized it and found a warning. Could it be that it caused the error. The specific warnings are as follows:

period = get_calib_periods(nml_file, ratio = 2) # define a period for the calibration,
Warning messages:
1: In buildVal(textLine, lineNum = j, blckName):
NAs introduced by coercion
2: In buildVal(textLine, lineNum = j, blckName):
NAs introduced by coercion

@fanxian1998
Copy link
Author

Hello, teachers. In my continuous attempts, I found that when running the model, this error seems to appear randomly. Whenever there is need at least two non-NA values to interpolate, I open the Lake.csv file obtained by running and it will There are many values such as -nan(ind), and then I run the model once. When there is no error, the Lake.csv file obtained by the model is correct again. However, adjusting the parameters requires the model to run repeatedly, and -nan may appear once. (ind) This situation leads to an error. I don’t know if the situation I saw is helpful to solve the error. I would like to hear your opinions. Looking forward to your reply!

@fanxian1998
Copy link
Author

Two teachers, the problem has been solved, it turned out to be a version problem .thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants