[GRASS-dev] [GRASS GIS] #3866: i.spec.unmix: endmember pixels do not sum up to 100%

GRASS GIS trac at osgeo.org
Fri Jul 5 08:55:58 PDT 2019


#3866: i.spec.unmix: endmember pixels do not sum up to 100%
--------------------------+-------------------------
 Reporter:  neteler       |      Owner:  grass-dev@…
     Type:  defect        |     Status:  new
 Priority:  normal        |  Milestone:
Component:  Imagery       |    Version:  unspecified
 Keywords:  i.spec.unmix  |        CPU:  Unspecified
 Platform:  Unspecified   |
--------------------------+-------------------------
 While the endmember maps of i.pysptools.unmix sum up to 100%, those of
 i.spec.unmix apparently don't.

 {{{
 GRASS 7.7.dev (nc_spm_08_grass7):~ >

 g.region raster=lsat7_2002_10 -p

 # requires https://github.com/OSGeo/grass/pull/39
 g.extension i.pysptools.unmix
 g.extension i.spec.unmix

 # auto-generate endmember matrix and endmember maps
 i.pysptools.unmix input=lsat_2002 endmembers=endmembers endmember_n=5 \
    output=spectrum.txt prefix=lsat_spectra --v

 # check data range (here: not reflectance), e.g.
 r.info -r lsat7_2002_10
 min=42
 max=255

 r.info -r lsat7_2002_40
 min=1
 max=255

 # check created spectrum.txt
 cat spectrum.txt
 # Channels: lsat7_2002_10 lsat7_2002_20 lsat7_2002_30 lsat7_2002_40
 lsat7_2002_50 lsat7_2002_70 lsat7_2002_80
 # Wrote 5 spectra line wise.
 #
 Matrix: 5 by 7
 row0: 68.0      44.0    30.0    2.0     1.0     4.0     13.0
 row1: 73.0      64.0    37.0    182.0   92.0    34.0    117.0
 row2: 133.0     123.0   140.0   79.0    250.0   255.0   161.0
 row3: 255.0     239.0   255.0   141.0   156.0   98.0    250.0
 row4: 255.0     255.0   255.0   221.0   255.0   214.0   22.0

 # derive endmember maps from spectrum.txt
 # hypothesis: endmember maps should be similar to those generated by
 i.pysptools.unmix
 i.spec.unmix group=lsat_2002 matrix=spectrum.txt result=lsat7_2002_unmix \
    error=lsat7_2002_unmix_err iter=lsat7_2002_unmix_iterations

 # hypothesis: sum of all endmember maps should sum up to 100 (%):
 r.mapcalc "all_unmix = lsat7_2002_unmix.1 + lsat7_2002_unmix.2 +
 lsat7_2002_unmix.3 + lsat7_2002_unmix.4 + lsat7_2002_unmix.5 -
 lsat7_2002_unmix_err"

 r.univar -e -g all_unmix
 ...
 min=-100
 max=71
 range=171
 mean=21.3971956456606
 ...
 first_quartile=18
 median=22
 third_quartile=25
 percentile_90=28
 }}}

 ... indeed, the sum is far from the expectation of SUM(endmembers) = 100%.

 The addon i.spec.unmix is relevant because it expects known endmembers as
 input which is important for a defined analysis (while i.pysptools.unmix
 apparently always auto-generates the endmembers which are not necessarily
 the best or those the user wants).

 I suspect a bug in i.spec.unmix (maybe just a scaling issue internally?).

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3866>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list