Skip to content

### Error Description: I am working with the learning environment of QSWAT+ and encounter a KeyError: 3 when trying to execute the CreateHRUs function. This occurs when I attempt to create the HRUs. The complete error message is as follows: #1

@loewche

Description

@loewche

Hi,

I start to learn QSWAT in QGIS, To do, so I received a error message creating an HRU.

Steps to Reproduce:
I loaded the learning environment and executed the "CreateHRUs" function.
After running it, I received the error message.
System Details:
Operating System: Windows 10
QGIS Version: 3.33.11 (LTR)
QSWAT+ Version: 1.0.0
Expected Behavior:
The HRUs should be created correctly without causing an error.

This is the Python error message:
2024-10-14T12:33:29 WARNING Traceback (most recent call last):
File "C:\PROGRA1/QGIS331.11/apps/qgis-ltr/./python/plugins\QSWATPlus\QSWATPlus\hrus.py", line 5530, in readFiles
self.CreateHRUs.printBasins(False, None)
File "C:\PROGRA1/QGIS331.11/apps/qgis-ltr/./python/plugins\QSWATPlus\QSWATPlus\hrus.py", line 3109, in printBasins
self.printBasinsDetails(basinHa, False, fw, None, fullHRUsLayer, horizLine)
File "C:\PROGRA1/QGIS331.11/apps/qgis-ltr/./python/plugins\QSWATPlus\QSWATPlus\hrus.py", line 3161, in printBasinsDetails
basinData = self.basins[basin]

KeyError: 3

Additional Information:
I also received the following error message: 
ID value 0 from inlets/outlets file D:/xxxxxx/R/Workspace/Flow Direction/Robit/robit/Watershed/Shapes/MainOutlet_snap.shp not found as DSNODEID in channels file D:/XXXXX/R/Workspace/Flow Direction/Robit/robit/Watershed/Shapes/srtm_30mchannel/srtm_30mchannel.shp.

Could it be that these two message are related to each other? How can I solve this error to continue the learning process. I followed and download the fiiles for exercise from here: 

https://www.youtube.com/watch?v=MqWyJ67gnr0&list=PLK7YBpqQP_ePv-EVoWqPl_Bt2CmORifad&index=2


Thanks in advance! And for your patience and help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions