Error while creating HRUs with existing watershed

92 views
Skip to first unread message

Nicolas Grieco

unread,
Jul 19, 2023, 9:05:25 AM7/19/23
to QSWAT+
Dear all,

I am currently working on a SWAT+ project in which I need to use an existing watershed for the setup.

In step 1, I needed to manually add a column "PolygonID" in the attribute table of the file subbasins.shp,  and also a column "BasinNo" in the attribute table of the file rivers.shp . I put the same value as the "subbasins" column for each row. Then, I was able to complete step 1 without any errors, with the 153 subbasins I was expecting from the shapefile I used.

But, when I try to create the HRUs, I get the following python error at the end of the "read" process : 

Traceback (most recent call last):
  File "C:\Users/NGO/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATPlus3_9\QSWATPlus\hrus.py", line 5461, in readFiles
    self.CreateHRUs.printBasins(False, None)
  File "C:\Users/NGO/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATPlus3_9\QSWATPlus\hrus.py", line 3004, in printBasins
    self.printBasinsDetails(basinHa, False, fw, None, fullHRUsLayer, horizLine)
  File "C:\Users/NGO/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATPlus3_9\QSWATPlus\hrus.py", line 3056, in printBasinsDetails
    basinData = self.basins[basin]

KeyError: 4 

At the same time, I can see on my QGIS project that there are some subbasins that don't have any HRUs, as you can see on the screenshot attached.

So far, I've already tried to change the hru.py file as mentionned in another post from the dicussion group ( "Failed to generate aquifers shapefile" (google.com) ), but it dind't work out for me.

I would be grateful if you could help me. Thank you in advance.

Nicolas GRIECO.
Capture.PNG

George, Christopher

unread,
Jul 19, 2023, 9:53:03 AM7/19/23
to Nicolas Grieco, QSWAT+
You need to check carefully that the BasinNo values in the channels shapefile correspond geographically to the corresponding (by PolygonId) subbasins in the subbasins shapefile.  Check the holes in your map particularly carefully.  Check the WSNO values in the channels shapefile  correspond geographically to the corresponding (by PolygonId) shapes in the watershed shapefile.  Again look carefully where you have holes.

If you cannot see the problems send me your project folder and I will investigate.

Chris


From: qswa...@googlegroups.com <qswa...@googlegroups.com> on behalf of Nicolas Grieco <nicolasg...@gmail.com>
Sent: 17 July 2023 15:46
To: QSWAT+ <qswa...@googlegroups.com>
Subject: [QSWAT+ User Group] Error while creating HRUs with existing watershed
 
Caution: This email may have originated from outside the organization. Please exercise additional caution with any links and attachments.

--
You received this message because you are subscribed to the Google Groups "QSWAT+" group.
To unsubscribe from this group and stop receiving emails from it, send an email to qswatplus+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/qswatplus/e69fcd04-d819-479f-af59-be5d6c9064fdn%40googlegroups.com.

Farid Gholamin

unread,
Jun 25, 2024, 2:51:32 PM (5 days ago) Jun 25
to QSWAT+
Dear Chris,

I have the same problem. What do you mean by "check the holes on the map"?

regards,
Farid

Chris George

unread,
Jun 26, 2024, 7:34:48 AM (4 days ago) Jun 26
to Farid Gholamin, QSWAT+
I don't remember what the problem was in the map he sent. What exactly
is your problem?

Chris

On 6/25/2024 3:06 PM, Farid Gholamin wrote:
> Dear Chris, I have the same problem. What do you mean by "check the
> holes on the map"? regards, Farid On Wednesday, July 19, 2023 at 3: 53:
>  03 PM UTC+2 George, Christopher wrote: You need to check carefully that
> the BasinNo values in the channels
> ZjQcmQRYFpfptBannerStart
> This Message Is From an External Sender
> This message came from outside your organization.
> ZjQcmQRYFpfptBannerEnd
> Dear Chris,
>
> I have the same problem. What do you mean by "check the holes on the map"?
>
> regards,
> Farid
>
> On Wednesday, July 19, 2023 at 3:53:03 PM UTC+2 George, Christopher wrote:
>
> You need to check carefully that the BasinNo values in the channels
> shapefile correspond geographically to the corresponding (by
> PolygonId) subbasins in the subbasins shapefile.  Check the holes in
> your map particularly carefully.  Check the WSNO values in the
> channels shapefile  correspond geographically to the corresponding
> (by PolygonId) shapes in the watershed shapefile.  Again look
> carefully where you have holes.
>
> If you cannot see the problems send me your project folder and I
> will investigate.
>
> Chris
>
> ------------------------------------------------------------------------
> *From:* qswa...@googlegroups.com <qswa...@googlegroups.com> on
> behalf of Nicolas Grieco <nicolasg...@gmail.com>
> *Sent:* 17 July 2023 15:46
> *To:* QSWAT+ <qswa...@googlegroups.com>
> *Subject:* [QSWAT+ User Group] Error while creating HRUs with
> <https://urldefense.com/v3/__https://groups.google.com/g/qswatplus/c/Z5AGrC_Wfq0/m/7YefEAajBQAJ__;!!KwNVnqRv!HYPD_D2nzkelIUnDT3wRdsiCwHzBbheJE9m4PgfLc2EMmcJRO5oXfMnw7jviKMLnSgcq-LjAkvByujMo$> ), but it dind't work out for me.
>
> I would be grateful if you could help me. Thank you in advance.
>
> Nicolas GRIECO.
>
> --
> You received this message because you are subscribed to the Google
> Groups "QSWAT+" group.
> To unsubscribe from this group and stop receiving emails from it,
> send an email to qswatplus+...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/qswatplus/e69fcd04-d819-479f-af59-be5d6c9064fdn%40googlegroups.com <https://urldefense.com/v3/__https://groups.google.com/d/msgid/qswatplus/e69fcd04-d819-479f-af59-be5d6c9064fdn*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!KwNVnqRv!HYPD_D2nzkelIUnDT3wRdsiCwHzBbheJE9m4PgfLc2EMmcJRO5oXfMnw7jviKMLnSgcq-LjAklQj-mu2$>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "QSWAT+" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to qswatplus+...@googlegroups.com
> <mailto:qswatplus+...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/qswatplus/7227b2c3-5a55-4f3c-b210-2fd13ad73b37n%40googlegroups.com <https://urldefense.com/v3/__https://groups.google.com/d/msgid/qswatplus/7227b2c3-5a55-4f3c-b210-2fd13ad73b37n*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!KwNVnqRv!HYPD_D2nzkelIUnDT3wRdsiCwHzBbheJE9m4PgfLc2EMmcJRO5oXfMnw7jviKMLnSgcq-LjAkrGPsYbt$>.
Reply all
Reply to author
Forward
0 new messages