CNOP relative adjustment error "index was outside the bounds of the array"

327 views
Skip to first unread message

Aaron Ruesch

unread,
Mar 10, 2015, 2:16:29 PM3/10/15
to swat...@googlegroups.com, David Evans, Laura Rozumalski
Hello SWAT-CUP users and Karim,

We are trying to calibrate curve number on a model with a complex operation schedule that represents a generic dairy rotation in Wisconsin. A dairy rotation in Wisconsin plants CORN, CSIL, and ALFA. We are trying to calibrate CNOP using the following statement in par_inf.txt:

r__CNOP{[],1}.mgt    -0.05   0.05

That is, for planting operations only, for all rotation numbers, adjust up and down by 5% of the original CNOP.

Running SWAT-CUP (v. 5.1.6.2) returns the error in the attached image, "index was outside the bounds of the array." Previous threads suggest that this error is due to a parameter adjustment outside of the absolute SWAT values for that parameter. However, that does not appear to be the case given the operation schedule copied below (copied from 000010005.mgt where the error was thrown) where CNOPs are highlighted in pink and planting operations are highlighted in green in the order of CORN, CSIL, ALFA (tillage and harvest/kill are shown in orange and yellow):

Operation Schedule:
  1  1          11    4             1.00000 100.00   500.00000 2.00   1.00
  4 29           3   44          5582.00000   0.00
  5  1           6   58            83.00000
  5 15           3   55           168.00000   0.00
  5 15           1   19          1052.72009   0.00     0.00000 0.00   0.00 77.00
 11  1           5                  0.00000
                17
  1  1          11    4             1.00000 100.00   500.00000 2.00   1.00
  4 29           3   44          5582.00000   0.00
  5  1           6   58            83.00000
  5 15           3   55           168.00000   0.00
  5 15           1   20          1800.00000   0.00     0.00000 0.00   0.00 77.00
  9 15           5                  0.00000
                17
  1  1          11    4             1.00000 100.00   500.00000 2.00   1.00
  4 14           3   44          1675.00000   0.00
  4 17           6   58            83.00000
  4 25           1   52          1469.37476   0.00     0.00000 0.00   0.00 59.00
  8 10           7        0         0.00000   0.00
                17
  1  1          11    4             1.00000 100.00   500.00000 2.00   1.00
  6 25           7        0         0.00000   0.00
  8 10           7        0         0.00000   0.00
  9 10           7        0         0.00000   0.00
                17
  1  1          11    4             1.00000 100.00   500.00000 2.00   1.00
  6 25           7        0         0.00000   0.00
  8 10           7        0         0.00000   0.00
  9 10           7        0         0.00000   0.00
                17
  1  1          11    4             1.00000 100.00   500.00000 2.00   1.00
  6 25           7        0         0.00000   0.00
  8 10           7        0         0.00000   0.00
  9 10           7        0         0.00000   0.00
 10 14           8
 10 15           6   58            83.00000
                17

Ranges of parameters for CNOPs of 77 and 59 would be 73--80 and 56--62 respectively, given the bounds of the relative adjustment, which is well within the range of SWAT absolute values. To further test the hypothesis that the parameter ranges are outside SWAT absolute values, I tested a relative adjustment from zero to zero---that is, only multiplying CNOP by 1---same error (attached).

I have tried a number of alternative parameterizations, such as explicitly stating rotation numbers, testing only one land use or only one PLANT_ID, and changing the zero values for harvest/kill operations (ArcSWAT default) to something non-zero (in the case that the parameterization was attempting to adjust operations other than plantings). Every test has resulted in the same error.

Has anyone encountered a similar issue with CNOP? Am I doing something wrong that I seem to be missing?

This is an important factor in our model, and it is critical that we are able to adjust it. Many thanks for your help!

Regards,

Aaron Ruesch
swat_cup_cnop_error1.png

Jim Almendinger

unread,
Mar 10, 2015, 6:32:30 PM3/10/15
to SWAT-CUP, David Evans, Laura Rozumalski
I received the same error in trying to change CNOPs for a simple CORN-SOYB rotation.  I had presumed that this type of error occurs when the program reading the text file encounters something it doesn't expect, or it can't find what it's looking for and some loop in the program exceeds a hard-coded maximum that allows the program to abort gracefully, rather than hang and loop infinitely.  In any case, it could be that the input text file isn't quite formatted as SWAT-CUP expects, due to some minor change in how ArcSWAT writes these files.  
Well -- if there is something we did to somehow corrupt the .mgt files, then hopefully Karim will be able to spot it.  Otherwise his team will have to diagnose why SWAT-CUP is having trouble reading the .mgt files that ArcSWAT has written.  (Well -- perhaps it's actually SwatEditor that does the text file writing in this case, rather than ArcSWAT.) 

In my case, I used SWAT-CUP to help me choose the best CN2 adjustment, and then I went back to my original project data base and applied this adjustment to all the CN2 values (in mgt1) and CNOP values (in mgt2) by using update queries.  Seemed to work fine. 

Best,
-- Jim



From: "Aaron Ruesch" <asru...@gmail.com>
To: "SWAT-CUP" <swat...@googlegroups.com>
Cc: "David Evans" <evans.dav...@gmail.com>, "Laura Rozumalski" <laura.ro...@gmail.com>
Sent: Tuesday, March 10, 2015 1:16:29 PM
Subject: CNOP relative adjustment error "index was outside the bounds of the array"

--
You received this message because you are subscribed to the Google Groups "SWAT-CUP" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swat-cup+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
Dr. James E. Almendinger
St. Croix Watershed Research Station
Science Museum of Minnesota
16910 152nd St N
Marine on St. Croix, MN  55047
tel: 651-433-5953 ext 19

Karim Abbaspour

unread,
Mar 10, 2015, 9:57:21 PM3/10/15
to swat...@googlegroups.com, David Evans, Laura Rozumalski
make sure you are running the latest version of swatcup. I can run it without a problem...
Best, Karim

Aaron Ruesch

unread,
Mar 11, 2015, 12:25:06 PM3/11/15
to swat...@googlegroups.com, David Evans, Laura Rozumalski

Thanks Jim and Karim,

 

Jim, that seems like a reasonable workaround to me. If we can't find a solution, I suspect we'll end up using your method. I appreciate your suggestion.

 

Regarding versioning, I mentioned in the original post that we are using the latest version of SWAT-CUP (v. 5.1.6.2)--sorry, kind of a long post. I should also mention that we are using the latest version of SWATeditor (2012.10_2.15) for building our model.

 

I noticed that SWAT-CUP seems to handle CNOP values for our first 4 HRUs just fine, which have far less complex operation schedules. When it reaches the 5th HRU, the first complex operation schedule, then it throws an error. Karim, did you test the operation schedule copied in the message? Or are you saying that you simply haven't had trouble with CNOP in the past?

 

At this point, we are nearing a deadline on completing the calibration and validation of our model, and having purchased the parallel processing module associated with it we are invested in moving forward using SWAT-CUP, so we would greatly appreciate a solution if one existed.

 

Many thanks for looking into it.

 

Aaron Ruesch




--
You received this message because you are subscribed to a topic in the Google Groups "SWAT-CUP" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swat-cup/yniRLy1bbHE/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swat-cup+u...@googlegroups.com.

Aaron Ruesch

unread,
Jul 7, 2015, 3:35:13 PM7/7/15
to swat...@googlegroups.com
Jim and Karim,

I had some insight into potentially why CNOP is not working for me in SWAT-CUP. I found that I get this same error when my NROT does not match the number of rotations in my operation schedule (I found this out from an unrelated error in our operations). If I am attempting to adjust CNOP for plantings during my 6-year rotation, I am wondering if perhaps SWAT-CUP looks for 6 plantings. The reason I ask is because we often have 3 years of alfalfa in dairy rotations where we harvest only on a couple years, meaning there are no plantings the year following. That is, in our dairy rotations we only have 3 plantings. Could the error be stemming from the discrepancy between NROT (6) and the number of plantings in my operation schedule (3)?

For the time being, we went with your suggestion, Jim, and the resulting CN2 relative calibrations result in similar accuracies as the same relative adjustment applied manually to CNOPs.

Thanks Karim for looking into it.

Aaron 

Xuyang Zhang

unread,
Oct 28, 2016, 1:07:27 PM10/28/16
to SWAT-CUP
Hi Aaron,

I also encounter the same problems with crop rotation.  Have you found a solution to the problem other than work around it?  Any suggestions are appreciated.

Thanks.

Xuyang

Minjeong Kim

unread,
Nov 21, 2016, 9:53:44 AM11/21/16
to SWAT-CUP
Dear Aaron and SWAT-CUP users,

I've also met the same error. In my model, I have 3 years of planting and NROT is 3 as well. Therefore, I think there would be other reasons to make the error.
I don't know how swat_edit.exe changes the CNOP, but there might be an inconsistency of formats between the executable file  and management inputs.
I've attached one of management inputs for you to see whether there's any problem of it. 
Please answer me if you have solution or potential reason for it.
Thank you!

Sincerely,
Minjeong


2015년 7월 7일 화요일 오후 9시 35분 13초 UTC+2, Aaron Ruesch 님의 말:
000010029.mgt

Abbaspour, Karim

unread,
Nov 21, 2016, 10:18:34 AM11/21/16
to swat...@googlegroups.com

How do you write the parameter in the par_inf file?

Karim

Minjeong Kim

unread,
Nov 21, 2016, 11:34:39 AM11/21/16
to SWAT-CUP
++ I've tested options of parameter input, and I found one didn't bring the error for me. 
r__CNOT{1,1}.mgt  >> no error, and it modified CNOPs of plantings in all rotations.
r__CNOT{[],1}.mgt, r__CNOT{2,1}.mgt, r__CNOT{3,1}.mgt >> error.

Have I misunderstood the concept of a rotation? 
I expected only one CNOP at the first year of three years (NROT=3) will be changed in case of  r__CNOT{1,1}.mgt. 

Sincerely,
Minjeong

2016년 11월 21일 월요일 오후 3시 53분 44초 UTC+1, Minjeong Kim 님의 말:

Abbaspour, Karim

unread,
Nov 21, 2016, 12:17:21 PM11/21/16
to swat...@googlegroups.com

Inside the bracket is the rotation number. If left empty, it applied the change to all rotations. But I see that there is a bug in the program and it gives an error. But if you put a 1, then it will change CNOP for all rotations.

 

r__CNOP{[],1}.mgt

 

I will fix the bug as soon as I can.

Karim

 

 

 

From: swat...@googlegroups.com [mailto:swat...@googlegroups.com] On Behalf Of Minjeong Kim


Sent: Monday, November 21, 2016 5:35 PM
To: SWAT-CUP

alex

unread,
Aug 6, 2018, 9:42:24 AM8/6/18
to SWAT-CUP
Hi,
I'm having this exact problem. Any updates on the SWAT_edit without bugs?
Regards
Alex 
Reply all
Reply to author
Forward
0 new messages