Calculate objective function ERROR

189 views
Skip to first unread message

ZY Harifidy

unread,
Aug 2, 2023, 10:50:37 PM8/2/23
to R-SWAT
Dear Dr. Tam and R-SWAT users, 
 
I use SWAT+ and I got the following error message when I tried to calculate the objective function. Could you help me out, please? 
I have other questions. I would like to conduct multi-gauge calibration (12 gauge stations) but when I tried to upload the observed data, only two observed variables out of twelve were uploaded.  Do you have any idea why this happened? I have to mention that the available time period for each gauge station is different. Do you have any suggestions on how to prepare the observed data for multi-gauge calibration? 
I really appreciate your help. 

Best regards,
Zy

Capture.PNG
[1] " Error: length of observed data # length of the extracted variable" [1] "C:\\Users\\zy\\Documents\\PHD project 2022-2024\\SWAT+ project\\R-SWAT-master\\Working folder/Output/Core_1/out_var_1.txt" [1] " Please load the corrected observed data and rerun this step" [1] " Error: length of observed data # length of the extracted variable" [1] "C:\\Users\\zy\\Documents\\PHD project 2022-2024\\SWAT+ project\\R-SWAT-master\\Working folder/Output/Core_2/out_var_1.txt" [1] " Please load the corrected observed data and rerun this step" [1] " Error: length of observed data # length of the extracted variable" [1] "C:\\Users\\zy\\Documents\\PHD project 2022-2024\\SWAT+ project\\R-SWAT-master\\Working folder/Output/Core_3/out_var_1.txt" [1] " Please load the corrected observed data and rerun this step" [1] " Error: length of observed data # length of the extracted variable" [1] "C:\\Users\\zy\\Documents\\PHD project 2022-2024\\SWAT+ project\\R-SWAT-master\\Working folder/Output/Core_4/out_var_1.txt" [1] " Please load the corrected observed data and rerun this step" [1] " Error: length of observed data # length of the extracted variable" [1] "C:\\Users\\zy\\Documents\\PHD project 2022-2024\\SWAT+ project\\R-SWAT-master\\Working folder/Output/Core_5/out_var_1.txt" [1] " Please load the corrected observed data and rerun this step" [1] " Error: length of observed data # length of the extracted variable" [1] "C:\\Users\\zy\\Documents\\PHD project 2022-2024\\SWAT+ project\\R-SWAT-master\\Working folder/Output/Core_6/out_var_1.txt" [1] " Please load the corrected observed data and rerun this step" [1] " Error: length of observed data # length of the extracted variable" [1] "C:\\Users\\zy\\Documents\\PHD project 2022-2024\\SWAT+ project\\R-SWAT-master\\Working folder/Output/Core_7/out_var_1.txt" [1] " Please load the corrected observed data and rerun this step" [1] " Error: length of observed data # length of the extracted variable" [1] "C:\\Users\\zy\\Documents\\PHD project 2022-2024\\SWAT+ project\\R-SWAT-master\\Working folder/Output/Core_8/out_var_1.txt" [1] " Please load the corrected observed data and rerun this step" [1] " Error: length of observed data # length of the extracted variable" [1] "C:\\Users\\zy\\Documents\\PHD project 2022-2024\\SWAT+ project\\R-SWAT-master\\Working folder/Output/Core_9/out_var_1.txt" [1] " Please load the corrected observed data and rerun this step" [1] " Error: length of observed data # length of the extracted variable" [1] "C:\\Users\\zy\\Documents\\PHD project 2022-2024\\SWAT+ project\\R-SWAT-master\\Working folder/Output/Core_10/out_var_1.txt" [1] " Please load the corrected observed data and rerun this step"
obs_var_1.txt

Tam Nguyen

unread,
Aug 3, 2023, 7:58:20 AM8/3/23
to R-SWAT
Hi,

1. First, your observed data file is not continues, there are missing data from 6/1985 to 12/1985: just NA values during this period in the observed file as shown in this figure
Capture.PNG
2. For multi-gauge calibration, please see this video


hope it helps

ZY Harifidy

unread,
Aug 3, 2023, 11:27:34 PM8/3/23
to R-SWAT
Dear Dr. Tam,

Thank you for your prompt reply. 
 Your support is greatly appreciated. I solved the problem.

Best regards,
Zy

ZY Harifidy

unread,
Aug 8, 2023, 3:01:02 AM8/8/23
to R-SWAT
  Dear Dr. Tam and R-SWAT users, 

I cannot display the plot of objective function values after calculating the objective function. In addition, I noticed that my objective function is constant for all simulations. I have included calibration.cal into the file.cio in line 22 column 3. I have also edited the print.prt to make sure that the channel_sd was printed monthly. 
I cannot conduct sensitivity analysis and manual calibration.
Thank you in advance for your support. 

Best regards,
Zy
Capture1.PNG
Capture5.PNG
Capture4.PNG
Capture2.PNG
Capture3.PNG

Wayana Dolan

unread,
Apr 30, 2025, 4:40:09 AMApr 30
to R-SWAT
Hi Zy,

Did you ever figure out why the plots were blank (in Capture1.PNG)? I am running into the same issue.

Thanks,
Wayana

Tam Nguyen

unread,
May 12, 2025, 4:50:17 AMMay 12
to R-SWAT
Hi Harifidy, could you try to run SWAT+ in different folder created by RSWAT to see if the output files were updated and the values inside these output files are the same. If they are the same, meaning that SWAT+ does not take the parameters generated by RSWAT when running these simulation => then need to tell SWAT+ to use these parameter files.
Reply all
Reply to author
Forward
0 new messages