Calibration problem in R

440 views
Skip to first unread message

Feiyan Xiao

unread,
Jun 7, 2021, 10:51:32 AM6/7/21
to SWAT+
Hello all,
I'm doing calibration in SWATPlusR, but the result seems to be wrong. The following is my operation process:
A. Creat a parameter in SWAT+ Editor (like figure 1), then run the editor  ;
B. Change the file.cio like figure 2;
C. Copy the "rev60.5.2_64rel.exe" from path "C:\SWAT\SWATPlus\SWATPlusEditor\resources\app.asar.unpacked\swat_exe" to my own TxtInOut.
D. Then I try to calibration one parameter in SWATPlusR, and the settings are as figure 3 shows. But the result is very different with the original simulation results (figure 4 is the original simulation results from SWAT+ Editor, and figure 5 is the result from R).
Figure1.pngFigure2.pngFigure3.pngFigure4.pngFigure5.png
I have also changed the range of cn2 or add other parameters, such as esco.hru and awc.hru, the same problem still exist. Could anyone help me? Thanks very much!
Feiyan 


Mamad

unread,
Jun 8, 2021, 4:03:37 AM6/8/21
to SWAT+
Hi,

As it is visible in the last figure, all of your runs have the same output.

I think you have selected the wrong output, in "line 24". 

The monthly output of runoff "flo_out" is located in channel_sdmorph_mon.txt


Best,
Mohammad

Christoph Schürz

unread,
Jun 9, 2021, 3:31:25 AM6/9/21
to SWAT+
Hi,

I think your setup should be fine. It is also correct to read from channel_sd, because in SWATplusR you cannot access channel_sdmorph. The flo_out outputs should however be identical.
The issue might be that you sample percentage changes in a range of +- 0.2%, which is almost no change. You could replace the pctchg with relchg or change the values from +-0.2 to +-20 and give it another try.

Best
Christoph

Mamad

unread,
Jun 9, 2021, 5:37:03 AM6/9/21
to SWAT+
Dear Christoph,

Thanks for your response.

Which one should be used for calibration?  flo_out (m3/s) in channel_sd_* or channel_sdmorph_*?

I have used channel_sdmorph_* (but not in SWATplusR) and I was able to calibrate.


Thanks,
Mamad

Christoph Schürz

unread,
Jun 9, 2021, 10:42:51 AM6/9/21
to SWAT+
Hi Mamad,

from my experience the outputs in both files should be identical. Thus the calibration should work the same way with both files.

Best
Christoph

Mamad

unread,
Jun 9, 2021, 2:36:26 PM6/9/21
to SWAT+
Dear Christoph,

I asked this question from developers and their reply (from Dr. Arnold) is here:

""I have many users who want the outputs in different units – it can also get confusing. In channel_sdmorph files, I output in average daily m3/s and in the channel_sd I simply sum the m3/s every day. If you look at channel_sd_aa.txt and channel_sdmorph_aa.txt, find flo_in for a channel in both files. If you divide the channel_sd_aa by 365 (or 366 in a leap year) you should get the average daily value of flo_in in the channel_sdmorph_aa file.""

Best,
Mamad


Somsubhra Chattopadhyay

unread,
Jun 15, 2021, 7:05:35 AM6/15/21
to Christoph Schürz, SWAT+
Hi Christoph,

At the moment I am trying to calibrate the model with SWAT Plus R and have the following error message, could you suggest what should I do?

Building 4 threads in 'D:\j1\Scenarios\dailytrialnew\TxtInOut/.model_run':
 Completed 4 threads in 12M 49S                                            
Error in rethrow_call(c_processx_exec, command, c(command, args), pty,  :
  Command 'swat_exe' not found @win/processx.c:982 (processx_exec)


Additionally, I have trouble with the sensitivity analysis too, when I try to run the FAST routine. I am wondering is it because the FAST package is no longer available in the CRAN repository?

Error in fast_parameters(minimum = c(-15, 0.5, 10, -50, -50, 0, 0), maximum = c(10,  :
  could not find function "fast_parameters"


Many thanks
Som

--
You received this message because you are subscribed to the Google Groups "SWAT+" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swatplus+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swatplus/74584ffc-307e-4922-8dbf-f8716672dccan%40googlegroups.com.


--
Somsubhra Chattopadhyay, Ph.D
Postdoctoral Research Associate
Civil Engineering Department 
Warsaw University of Life Sciences, Poland

Christoph Schürz

unread,
Jun 23, 2021, 8:36:59 AM6/23/21
to SWAT+
Hi all,

I realized that my last post here dissapeared. Strange but it happened already in another thread. I hope this one now stays...
@Mamad thanks for the info that you received from Jeff. Yes I did not check if the outputs are in the same units. I will look into that.
@Som the first error looks strange and new to me. I will have a look into that. Maybe you could provide me your model setup to look into it. The second error is that the fast R package is not available on CRAN anymore and you have to get it from the CRAN archive https://cran.r-project.org/src/contrib/Archive/fast/fast_0.64.tar.gz

Best
Christoph

Christoph Schürz

unread,
Jul 12, 2021, 4:22:40 AM7/12/21
to SWAT+
Dear all,

just a quick follow up to what Mamad posted above. I checked and you are correct, that channel_sd and channels_sdmorph differ for aggregated time intervals (e.g. average annual). The reason why this never crossed my mind is, because I always use daily simulated channel outputs and do the aggregation to any time interval in post-processing. On a daily time interval channel_sd and channel_sdmorph are indeed the same. This is in general good practice I think, as when the simulations are performed on a daily time step, I want to keep the entire information for the analysis and do the aggregation only if necessary.

Best
Christoph
Reply all
Reply to author
Forward
0 new messages