ccrook / QGIS-Contour-Plugin

Contour plugin for QGIS - uses python matplotlib to generate contours of data on vector point data.
43 stars 13 forks source link

"Exception Struck: 735" Issues with larger datasets #7

Closed allenbondurant closed 9 years ago

allenbondurant commented 10 years ago

When working with datasets of only ~500 points, the plugin works great. I'm having trouble when importing data consisting of over ~1000 points. I get the exception struck error, then:

An error has occured while executing Python code:

Traceback (most recent call last): File "C:/Users/WRCAdmin/.qgis2/python/plugins\contour\contour.py", line 369, in accept self.makeContours() File "C:/Users/WRCAdmin/.qgis2/python/plugins\contour\contour.py", line 579, in makeContours lines = self.computeContours() File "C:/Users/WRCAdmin/.qgis2/python/plugins\contour\contour.py", line 623, in computeContours cs = plt.tricontour(x, y, z, levels, extend=extend) File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\pyplot.py", line 3242, in tricontour ret = ax.tricontour(_args, _kwargs) File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\axes.py", line 9185, in tricontour return mtri.tricontour(self, _args, _kwargs) File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\tri\tricontour.py", line 280, in tricontour return TriContourSet(ax, _args, _kwargs) File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\tri\tricontour.py", line 36, in init ContourSet.init(self, ax, _args, _kwargs) File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\contour.py", line 860, in init self._process_args(_args, _kwargs) File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\tri\tricontour.py", line 47, in _process_args tri, z = self._contour_args(args, kwargs) File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\tri\tricontour.py", line 82, in _contour_args Triangulation.get_from_args_and_kwargs(_args, _kwargs) File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\tri\triangulation.py", line 168, in get_from_args_and_kwargs triangulation = Triangulation(x, y, triangles, mask) File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\tri\triangulation.py", line 55, in init dt = delaunay.Triangulation(self.x, self.y) File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\delaunay\triangulate.py", line 124, in init self.hull = self._compute_convex_hull() File "C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\matplotlib\delaunay\triangulate.py", line 160, in _compute_convex_hull hull.append(edges.pop(hull[-1])) KeyError: 735

Python version: 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)]

QGIS version: 2.2.0-Valmiera Valmiera, c3a2817

Python path: ['C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins\processing', 'C:/PROGRA~1/QGISVA~1/apps/qgis/./python', u'C:/Users/WRCAdmin/.qgis2/python', u'C:/Users/WRCAdmin/.qgis2/python/plugins', 'C:/PROGRA~1/QGISVA~1/apps/qgis/./python/plugins', 'C:\PROGRA~1\QGISVA~1\bin\python27.zip', 'C:\PROGRA~1\QGISVA~1\apps\Python27\DLLs', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\plat-win', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\lib-tk', 'C:\PROGRA~1\QGISVA~1\bin', 'C:\PROGRA~1\QGISVA~1\apps\Python27', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\PIL', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\win32', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\win32\lib', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\Pythonwin', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\Shapely-1.2.18-py2.7-win-amd64.egg', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\six-1.3.0-py2.7.egg', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\wx-2.8-msw-unicode', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\xlrd-0.9.2-py2.7.egg', 'C:\PROGRA~1\QGISVA~1\apps\Python27\lib\site-packages\xlwt-0.7.5-py2.7.egg', 'C:\PROGRA~1\QGISVA~1\apps\qgis\python\plugins\fTools\tools']

chadw17 commented 10 years ago

I am also having this same problem. If i delete points until I have under 500 then it starts to work again.

ccrook commented 10 years ago

I suspect that the problem is with the specific set of points your are looking at, rather than simply the number. When you reduced the number then some condition was changed and the exception was not triggered. The exception itself is within the matplotlib library, so may be hard to identify, and even harder to fix! However if you can can send the dataset that causes the issue then I could see if I can work out what the problem is, and possibly a way of filtering the data before it hits matplotlib...

chadw17 commented 10 years ago

Thanks for taking the time I will get the csv data over to you soon. I know when I delete points at random and check if it will work I still get the exception just each times is a different number until I get under 500. On Jun 29, 2014 12:44 AM, "Chris Crook" notifications@github.com wrote:

I suspect that the problem is with the specific set of points your are looking at, rather than simply the number. When you reduced the number then some condition was changed and the exception was not triggered. The exception itself is within the matplotlib library, so may be hard to identify, and even harder to fix! However if you can can send the dataset that causes the issue then I could see if I can work out what the problem is, and possibly a way of filtering the data before it hits matplotlib...

— Reply to this email directly or view it on GitHub https://github.com/ccrook/QGIS-Contour-Plugin/issues/7#issuecomment-47446500 .

chadw17 commented 10 years ago

Here is the data that I am working with. Thanks again for taking a look at this.

On Sun, Jun 29, 2014 at 12:44 AM, Chris Crook notifications@github.com wrote:

I suspect that the problem is with the specific set of points your are looking at, rather than simply the number. When you reduced the number then some condition was changed and the exception was not triggered. The exception itself is within the matplotlib library, so may be hard to identify, and even harder to fix! However if you can can send the dataset that causes the issue then I could see if I can work out what the problem is, and possibly a way of filtering the data before it hits matplotlib...

— Reply to this email directly or view it on GitHub https://github.com/ccrook/QGIS-Contour-Plugin/issues/7#issuecomment-47446500 .

Chad Washington Fisheries Biologist

MS Dept. of Wildlife, Fisheries, and Parks662-822-7072

ccrook commented 10 years ago

Hi Chad

Not sure why, but I don't seem to be able to find this data either in this message or on github?

Cheers Chris


From: chadw17 [notifications@github.com] Sent: 01 July 2014 00:19 To: ccrook/QGIS-Contour-Plugin Cc: Chris Crook Subject: Re: [QGIS-Contour-Plugin] "Exception Struck: 735" Issues with larger datasets (#7)

Here is the data that I am working with. Thanks again for taking a look at this.

On Sun, Jun 29, 2014 at 12:44 AM, Chris Crook notifications@github.com wrote:

I suspect that the problem is with the specific set of points your are looking at, rather than simply the number. When you reduced the number then some condition was changed and the exception was not triggered. The exception itself is within the matplotlib library, so may be hard to identify, and even harder to fix! However if you can can send the dataset that causes the issue then I could see if I can work out what the problem is, and possibly a way of filtering the data before it hits matplotlib...

— Reply to this email directly or view it on GitHub https://github.com/ccrook/QGIS-Contour-Plugin/issues/7#issuecomment-47446500 .

Chad Washington Fisheries Biologist

MS Dept. of Wildlife, Fisheries, and Parks662-822-7072

— Reply to this email directly or view it on GitHubhttps://github.com/ccrook/QGIS-Contour-Plugin/issues/7#issuecomment-47524649.

This message contains information, which may be in confidence and may be subject to legal privilege. If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info@linz.govt.nz) and destroy the original message. LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ. Thank You.

chadw17 commented 10 years ago

I attached it to the email. Not sure how to upload the file on here or if I can. I sent you another email though.

ccrook commented 10 years ago

Still not getting the file. Looks like the only files that can be uploaded to github issues are images :-( Can you put the data somewhere like dropbox and include a link in the issue?


From: chadw17 [notifications@github.com] Sent: 02 July 2014 04:55 To: ccrook/QGIS-Contour-Plugin Cc: Chris Crook Subject: Re: [QGIS-Contour-Plugin] "Exception Struck: 735" Issues with larger datasets (#7)

I attached it to the email. Not sure how to upload the file on here or if I can. I sent you another email though.

— Reply to this email directly or view it on GitHubhttps://github.com/ccrook/QGIS-Contour-Plugin/issues/7#issuecomment-47681612.

This message contains information, which may be in confidence and may be subject to legal privilege. If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info@linz.govt.nz) and destroy the original message. LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ. Thank You.

chadw17 commented 10 years ago

Sorry its taken so long to get back to you. Here is a link to my data. https://drive.google.com/file/d/0B_nIx9ys7j2Xa3owd3VsbVQ1dWc/edit?usp=sharing

ccrook commented 10 years ago

Hi

The problem is that the data includes points that are either duplicated or very close together. This doesn't work well with the contouring algorithm. I've added an option to thin the points before contouring - I was able to contour your data using this. You'll need to upload the new version (1.1.0), then you should be able to contour the data...

Cheers Chris


From: chadw17 [notifications@github.com] Sent: 26 July 2014 01:55 To: ccrook/QGIS-Contour-Plugin Cc: Chris Crook Subject: Re: [QGIS-Contour-Plugin] "Exception Struck: 735" Issues with larger datasets (#7)

Sorry its taken so long to get back to you. Here is a link to my data. https://drive.google.com/file/d/0B_nIx9ys7j2Xa3owd3VsbVQ1dWc/edit?usp=sharing

— Reply to this email directly or view it on GitHubhttps://github.com/ccrook/QGIS-Contour-Plugin/issues/7#issuecomment-50152069.

This message contains information, which may be in confidence and may be subject to legal privilege. If you are not the intended recipient, you must not peruse, use, disseminate, distribute or copy this message. If you have received this message in error, please notify us immediately (Phone 0800 665 463 or info@linz.govt.nz) and destroy the original message. LINZ accepts no responsibility for changes to this email, or for any attachments, after its transmission from LINZ. Thank You.

allenbondurant commented 9 years ago

Hi Chris,

I'm the original author of this problem and wanted to say thanks for adding the point radius thinning option in the newest version!