na0607 / jgrasstools

Automatically exported from code.google.com/p/jgrasstools
0 stars 0 forks source link

Matrix is singular exception #42

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Call interpolate method of our Kriging class Kriging 
http://pastie.org/private/njnqcqbyga7jhuw9fhdoka (the same is attached)
2. Executing of kriging.executeKriging(); on 128 line of this class causes the 
error:
Matrix is singular.. Stacktrace follows:
Message: Matrix is singular.
3. The exception is thrown at 214 line of 
http://grepcode.com/file/repo1.maven.org/maven2/org.jgrasstools/jgt-jgrassgears/
0.7.2/org/jgrasstools/gears/utils/math/matrixes/LinearSystem.java

What is the expected output? What do you see instead?
Instead of interpolation result I see  MatrixException(MatrixException.SINGULAR)

What version of the product are you using? On what operating system?
0.7.3 jgrass tools and 8.1 geotools, windows or linux - doesn`t matter

Please provide any additional information below.

Please, give me any advice on the issue.

Thanks in advance.

Original issue reported on code.google.com by dementie...@gmail.com on 23 Feb 2013 at 2:43

Attachments:

GoogleCodeExporter commented 8 years ago
Hi Dmitry, is it possible you are having two stations in a same location? We 
had that problem in the past for such cases.

How are you using the Kriging? Running directly from the code? Inside uDig? Are 
you able to provide a testcase that reproduces the error?

Original comment by andrea.a...@gmail.com on 23 Feb 2013 at 2:55

GoogleCodeExporter commented 8 years ago
Hi Andrea,

Thank you for the answer. 
We run it directly inside the code without uDig.
Here is attached testcase. 
Incoming shapes are in the archive test_case_shapes.zip(you should unpack it 
near java class). All the dependencies in pom.xml.

Original comment by dementie...@gmail.com on 24 Feb 2013 at 11:15

Attachments:

GoogleCodeExporter commented 8 years ago
One more moment, we checked that there are no two stations in a same location. 
Will be waiting for any ideas. Thank you one more time!

Original comment by dementie...@gmail.com on 24 Feb 2013 at 11:18

GoogleCodeExporter commented 8 years ago
Hi Andrea, was you able to run the test case? How can I help you with it? 

Original comment by dementie...@gmail.com on 2 Mar 2013 at 10:57

GoogleCodeExporter commented 8 years ago
Hi Dmitry, sorry, I am preparing for a job abraod and had no time to look into 
thsi yet. I was hoping the original author would jump in. Let me ping him in 
the jgrasstools mailinglist [0]. If he doesn't I will not have time to look at 
it properly before another week when I am back. 

[0] http://groups.google.com/group/jgrasstools

Original comment by andrea.a...@gmail.com on 3 Mar 2013 at 9:10

GoogleCodeExporter commented 8 years ago
Ok, Thank you very much for the help!

Original comment by dementie...@gmail.com on 3 Mar 2013 at 1:21

GoogleCodeExporter commented 8 years ago
Hi Dmitry, i had a look to your files. Two comments:
1) is missing the .shp file for the sourcePoints
2) I saw the interpolated points and it seems to me a sort of raster map. You 
can use the raster map as input of the kriging.
3) Could you please also attach the data you want interpolate.

Thanks 

giuseppe

Original comment by formeppe@gmail.com on 3 Mar 2013 at 8:12

GoogleCodeExporter commented 8 years ago
Hi Giuseppe,
1) sourcePoints shapefile is in the attached test_case_shapes.zip 
2) we don`t have any raster data here, only the data extracted from shapefiles.
3) Data that we want to interpolate is in  the sourcePoints.shp & 
sourcePoints.dbf. We extract them in TestKriging.java 

Regards, Dmitry.

Original comment by dementie...@gmail.com on 3 Mar 2013 at 8:59

GoogleCodeExporter commented 8 years ago
Hi Dimitry, I also gave a look at your data. In fact the source and 
to-interpolate datasets are both there. Since I am used to have few source 
datasets (usually rainfall stations), I also felt a bit strange about the 
source dataset. In fact it seems to be a regular grid of sources. I could 
reproduce your error with the testcase on the current development version. I 
would be tempted to try that out removing some of the points to see which 
points make a mess.

It would be good to take this discussion to the mailinglist, so that a few 
others that worked with the Kriging could interact. Would it be ok for you 
Dimitry? I am not sure if you are subscribed. Thanks.

Original comment by andrea.a...@gmail.com on 3 Mar 2013 at 9:12

GoogleCodeExporter commented 8 years ago
Dear Dmitri, is there any reason for which you are using the default parameter 
for Integral scale ecc, ecc? Looking at your distances the default value are 
too big. I reduced them:

kriging.pIntegralscale = new double[]{10, 1, 1};

and now it runs. 

I did not wait for the end of the simulation. I suggest you to estimate 
relaible value for the semivariogram parameters based on your data.
Best regards
giuseppe

Original comment by formeppe@gmail.com on 4 Mar 2013 at 3:05

GoogleCodeExporter commented 8 years ago
Nice catch Giuseppe. Is there a check we could do inside the code to give a 
suggestion in the code to the user instead of throwing simply the singular 
matrix exception? 

Original comment by andrea.a...@gmail.com on 4 Mar 2013 at 6:30

GoogleCodeExporter commented 8 years ago
Andrea, I implemented OMS3 components for the semivariogram estimate but it is 
still not ready for the commit. The problem is that the suggestion will depend 
on the data user so, i do not think we can make it general.Anyway i will think 
about that.

Best regards

giuseppe 

Original comment by formeppe@gmail.com on 4 Mar 2013 at 2:25

GoogleCodeExporter commented 8 years ago
I am talking about even very simple checks, if available. In the case here, it 
looks as if it would be possible to check the dataset size against some of the 
variables. If there are checks or warnings we can give to the user, let's do so.

Original comment by andrea.a...@gmail.com on 4 Mar 2013 at 5:43

GoogleCodeExporter commented 8 years ago
Giuseppe and Andrea,

Thank you for your time and help. Now it works for us with pIntegralscale as 
{1,1,1}.

Best regards,
Dmitry 

Original comment by dementie...@gmail.com on 6 Mar 2013 at 10:32