[GRASS-user] i.segment and i.segment.stats errors

Moritz Lennert mlennert at club.worldonline.be
Tue Oct 16 00:01:06 PDT 2018


On 15/10/18 21:00, Jamille Haarloo wrote:
> I did with neighborhood statistics and vector, and without.
> 
> with neighb. statistics & with vector
> i.segment.stats -n --overwrite map=SegW24IDM4DV4 at LUP1 
> rasters=DV2 at LUP1,DV4 at LUP1,IDM2 at LUP1,IDM4 at LUP1,W2 at LUP1,W4 at LUP1 
> raster_statistics=mean,stddev,variance,coeff_var,first_quart,median,third_quart,perc_90 
> area_measures=compact_circle 
> csvfile=C:\Users\haarlooj\Stats_SegW24IDM4DV4_15okt18 
> vectormap=vSegW24IDM4DV4 processes=3
> Calculating geometry statistics...
> Calculating statistics for raster maps...
> Calculating neighborhood statistics...
> Creating output vector map...
> DBMI-SQLite driver error:
> Error in sqlite3_prepare():
> near "IDM4_third_qu": syntax error
> ERROR: Error while executing: 'CREATE TABLE segmstat_tmp_vect_10260 (cat 
> int, compact_circle double precision, DV2_mean double precision, 
> DV2_stddev double precision, DV2_variance double precision, 
> DV2_coeff_var double precision, DV2_first_quart double precision, 
> DV2_median double precision, DV2_third_quart double precision, 
> DV2_perc_90 double precision, DV4_mean double precision, DV4_stddev 
[...]

This is not using the new version of i.segment.stats that I committed 
yesterday. I see that the version available at 
https://wingrass.fsv.cvut.cz/grass74/x86_64/addons/latest/ is still the 
one from before my changes.

Martin, any reason this has not been recreated since ?


> without neighb. statistics, but with vector
> (Mon Oct 15 10:54:02 2018)
> i.segment.stats --overwrite map=SegW24IDM4DV4 at LUP1 
> rasters=DV2 at LUP1,DV4 at LUP1,IDM2 at LUP1,IDM4 at LUP1,W2 at LUP1,W4 at LUP1 
> raster_statistics=mean,stddev,variance,coeff_var,first_quart,median,third_quart,perc_90 
> area_measures=compact_circle 
> csvfile=C:\Users\haarlooj\Stats_SegW24IDM4DV4_15okt18 
> vectormap=vSegW24IDM4DV4 processes=3
> Calculating geometry statistics...
> Calculating statistics for raster maps...
> Creating output vector map...
> DBMI-SQLite driver error:
> Error in sqlite3_prepare():
> no such column: nan
> DBMI-SQLite driver error:
> Error in sqlite3_prepare():
> no such column: nan
> ERROR: Error while executing: 'INSERT INTO segmstat_tmp_vect_3516 VALUES 
> (1244, 
> 1.128379,0.0694444477558136,0,0,0,0.0694444,0.0694444,0.0694444,0.0694444,0,0,0,nan,0,0,0,0,0.53125,0,0,0,0.53125,0.53125,0.53125,0.53125,1,0,0,0,1,1,1,1,3,0,0,0,3,3,3,3,1,0,0,0,1,1,1,1)'

Hmmm, not sure where this 'nan' comes from. If I see correctly it is 
from a coefficient of variation of DV4 at LUP1 for an object where both the 
mean and the stddev are 0, leading to a zero division.

I don't know what DV4 is. Is it normal that an object could have mean 
and stddev = 0 ? If yes, then the coefficient of variation might not be 
useful.

Anyhow, I just committed a fix (r73555) which should normally replace 
this 'nan' by its SQL equivalent 'NULL'.

> 
> without neighb. statistics & without vector
> (Mon Oct 15 14:58:40 2018)
> i.segment.stats --overwrite map=SegW24IDM4DV4 at LUP1 
> rasters=DV2 at LUP1,DV4 at LUP1,IDM2 at LUP1,IDM4 at LUP1,W2 at LUP1,W4 at LUP1 
> raster_statistics=mean,stddev,variance,coeff_var,first_quart,median,third_quart,perc_90 
> area_measures=compact_circle 
> csvfile=C:\Users\haarlooj\Stats_SegW24IDM4DV4_15okt18b processes=3
> Calculating geometry statistics...
> Calculating statistics for raster maps...
> (Mon Oct 15 15:15:18 2018) Command finished (16 min 38 sec)
> 
> with neighb. statistics, but without vector
> (Mon Oct 15 15:32:39 2018)
> i.segment.stats -n --overwrite map=SegW24IDM4DV4 at LUP1 
> rasters=DV2 at LUP1,DV4 at LUP1,IDM2 at LUP1,IDM4 at LUP1,W2 at LUP1,W4 at LUP1 
> raster_statistics=mean,stddev,variance,coeff_var,first_quart,median,third_quart,perc_90 
> area_measures=compact_circle 
> csvfile=C:\Users\haarlooj\Stats_SegW24IDM4DV4_15okt18c processes=3
> Calculating geometry statistics...
> Calculating statistics for raster maps...
> Calculating neighborhood statistics...
> (Mon Oct 15 15:50:25 2018) Command finished (17 min 46 sec)

These two are normal as your errors are all in the SQL that creates the 
attribute table of the vector. If you do not create a vector map, you 
obvisouly do not get the errors.

Does the content of the csv file look correct ?

Moritz


More information about the grass-user mailing list