SWAT+ Weather Data

328 views
Skip to first unread message

Obiazi Justine

unread,
Oct 10, 2023, 12:23:50 PM10/10/23
to SWAT+ Editor
 I am having trouble with running the weather data. This error keeps on popping up, I don't know how to resolve. Please help. I was reimporting my weather stations after making some adjustments. I deleted the stations so i can import them afresh then i get this error.
Traceback (most recent call last):
  File "peewee.py", line 3237, in execute_sql
sqlite3.IntegrityError: UNIQUE constraint failed: weather_sta_cli.name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "swatplus_api.py", line 99, in <module>
  File "actions\import_weather.py", line 124, in import_data
  File "actions\import_weather.py", line 224, in create_weather_stations
  File "database\lib.py", line 13, in bulk_insert
  File "peewee.py", line 1962, in inner
  File "peewee.py", line 2033, in execute
  File "peewee.py", line 2838, in _execute
  File "peewee.py", line 2551, in _execute
  File "peewee.py", line 3250, in execute
  File "peewee.py", line 3234, in execute_sql
  File "peewee.py", line 3010, in __exit__
  File "peewee.py", line 192, in reraise
  File "peewee.py", line 3237, in execute_sql
peewee.IntegrityError: UNIQUE constraint failed: weather_sta_cli.name
[39020] Failed to execute script 'swatplus_api' due to unhandled exception!

Maarten J. Waterloo

unread,
Oct 10, 2023, 4:30:39 PM10/10/23
to SWAT+ Editor
Hi Justine,

As many others in this group you have problems with the climate data. The error states that there is an integrity error in the sqlite database file, presumably in the name of one or more your climate stations. This could be because you have used spaces in the names, if so use underscores instead. If you send me some climate files as examples or the sqlite file, I can check if I can spot the error for you.

Regards,
Maarten Waterloo
Acacia Water

Maarten J. Waterloo

unread,
Oct 11, 2023, 3:20:15 AM10/11/23
to SWAT+ Editor
Hi Justin,

Thanks for the link to Google Drive. I see that you have four years of data, yet your input file nbyr states 48 years:

prism_station_7.pcp: Precipitation data - file written by SWAT+ editor 2023-09-13 17:30:25.915029
nbyr     tstep       lat       lon      elev
  48         0    39.0833    -85.5833  226.500
2018 1 0
2018 2 0
2018 3 0

With the temperature files I do have the following format for nbyr 30 years of daily data with minimum and max temperatures:

t2497.tmp: Temperature data - file written by SWAT+ editor 2019-08-10 13:37:29.221922
nbyr     tstep       lat       lon      elev
  30         0    50.500     6.530   505.000
1989    1    3.00000     4.00000  
1989    2    1.40000     5.00000  
1989    3   -0.10000     5.00000 

Whereas you have for four years of data and only one temperature entry:

prismtemperature7.tmp: Temperature data - file written by SWAT+ editor 2023-09-13 17:30:25.915029
nbyr     tstep       lat       lon      elev
  48         0    39.0833    -85.5833  226.500
2018 1 -9.3890
2018 2 -12.3460
2018 3 -7.8550

Please check your climate input files, that's probably where the errors are.

My input data format for rainfall data from 1/1/1989 in file p2479.txt:

19890101
0.6
0
0
3.3
9.6
1.4
0.3
0.2

And for temperature input t2497.txt (Tmin,Tmax):

19890101
3,4
1.4,5
-0.1,5
0.5,4
1,2.7
1,7.3

Hope that you can solve the errors now
Regards,
Maarten

Obiazi Justine

unread,
Oct 13, 2023, 5:43:13 PM10/13/23
to Maarten J. Waterloo, SWAT+ Editor
Hello Maarten, 

After doing every suggestion you gave. The error is still there, i have been struggling to find the root of this error

Regards,

--
You received this message because you are subscribed to the Google Groups "SWAT+ Editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swatplus-edit...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/swatplus-editor/b06fc7ed-7226-4e13-9021-310815e9cba4n%40googlegroups.com.

Nancy B. Sammons

unread,
Oct 17, 2023, 7:35:19 AM10/17/23
to Obiazi Justine, Maarten J. Waterloo, SWAT+ Editor

Obiazi:  I may have missed some emails, so perhaps this has been resolved.  If not, you have the temperature file entered as min/max and it should be max/min.  If you are still having issues after reviewing this problem, please send me your current txtinout (in a compressed format) and I will take a look at this for you.

Nancy

 

 

From: swatplu...@googlegroups.com <swatplu...@googlegroups.com> On Behalf Of Obiazi Justine
Sent: Friday, October 13, 2023 4:43 PM
To: Maarten J. Waterloo <maarten....@acaciawater.com>
Cc: SWAT+ Editor <swatplu...@googlegroups.com>
Subject: Re: [SWAT+ Editor User Group] Re: SWAT+ Weather Data

 

You don't often get email from justin...@gmail.com. Learn why this is important

Reply all
Reply to author
Forward
0 new messages