Python error (KeyError: 5628) during loading existing project

56 views
Skip to first unread message

Валерий Осипов

unread,
Aug 10, 2021, 9:02:02 AM8/10/21
to QSWAT+

I have Python warning message when I start existing project. After these the project seems freezing. I see "Restarting project..." in QSWAT+ window.

I have QSWAT+ 2.0.6, QGIS 3.16.

2021-08-10T11:21:23     WARNING    Traceback (most recent call last):
              File "C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATPlus3_64\QSWATPlus.py", line 319, in existingProject
              self.setupProject(proj, False)
              File "C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATPlus3_64\QSWATPlus.py", line 350, in setupProject
              if self.demProcessed():
              File "C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATPlus3_64\QSWATPlus.py", line 692, in demProcessed
              if not self._gv.topo.setUp0(demLayer, chanLayer, snapLayer, ad8Layer, self._gv):
              File "C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATPlus3_64\QSWATTopology.py", line 310, in setUp0
              return self.saveOutletsAndSources(channelLayer, outletLayer, gv.useGridModel)
              File "C:/Users/User/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\QSWATPlus3_64\QSWATTopology.py", line 3960, in saveOutletsAndSources
              dsSubbasin = chLinkToSubbasin[dsChLink] if dsChLink >= 0 else -1
             KeyError: 5628

Chris George

unread,
Aug 10, 2021, 10:23:28 AM8/10/21
to Валерий Осипов, QSWAT+
Sorry you have a problem. You need to check that 5628 is a LINKNO value
in your channels shapefile. If it is not, but it is a DSLINKNO value
then your channels shapefile is inconsistent.

If you have a channel with LINKNO 5628, check that channel's BasinNo
value is a PolygonId value in your subbasins shapefile. If not, the
subbasins shapefile is not consistent with your channels shapefile.

If you cannot see any problem, send me your project folder and I will
investigate.

Chris
> --
> 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/c9396365-95c7-4755-b951-21431d6ee6c1n%40googlegroups.com
> <https://groups.google.com/d/msgid/qswatplus/c9396365-95c7-4755-b951-21431d6ee6c1n%40googlegroups.com?utm_medium=email&utm_source=footer>.

Валерий Осипов

unread,
Aug 13, 2021, 8:01:38 AM8/13/21
to QSWAT+
Thank for quick response! Yes, it was exactly like you said: 5628 was not in LINKNO, instead it was two 5627. I corrected that manually and the project started. So, I decided to re-run from 'Create Streams' step.

вторник, 10 августа 2021 г. в 17:23:28 UTC+3, Chris George:
Reply all
Reply to author
Forward
0 new messages