[GRASS-SVN] r71237 - grass-addons/grass7/imagery/i.spec.unmix

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jul 3 01:53:21 PDT 2017


Author: neteler
Date: 2017-07-03 01:53:21 -0700 (Mon, 03 Jul 2017)
New Revision: 71237

Modified:
   grass-addons/grass7/imagery/i.spec.unmix/i.spec.unmix.html
Log:
i.spec.unmix addon: example updated

Modified: grass-addons/grass7/imagery/i.spec.unmix/i.spec.unmix.html
===================================================================
--- grass-addons/grass7/imagery/i.spec.unmix/i.spec.unmix.html	2017-06-30 11:13:58 UTC (rev 71236)
+++ grass-addons/grass7/imagery/i.spec.unmix/i.spec.unmix.html	2017-07-03 08:53:21 UTC (rev 71237)
@@ -13,23 +13,85 @@
 
 <!-- see sample/run.sh, update to NC sample data set -->
 
+This example is based on the North Carolina Sample dataset.
+<p>
+Prior to spectral unmixing the pixel values (DN) of the Landsat scene need
+to be converted to reflectance values (here: using DOS1):
+
 <div class="code"><pre>
+# rename channels or make a copy to match i.landsat.toar's input name scheme:
+g.copy raster=lsat7_2002_10,lsat7_2002.1
+g.copy raster=lsat7_2002_20,lsat7_2002.2
+g.copy raster=lsat7_2002_30,lsat7_2002.3
+g.copy raster=lsat7_2002_40,lsat7_2002.4
+g.copy raster=lsat7_2002_50,lsat7_2002.5
+g.copy raster=lsat7_2002_61,lsat7_2002.61
+g.copy raster=lsat7_2002_62,lsat7_2002.62
+g.copy raster=lsat7_2002_70,lsat7_2002.7
+g.copy raster=lsat7_2002_80,lsat7_2002.8
+</pre></div>
+
+Calculation of reflectance values from DN using DOS1 (metadata obtained
+from <a href="http://www.grassbook.org/wp-content/uploads/ncexternal/landsat/2002/p016r035_7x20020524.met.gz">p016r035_7x20020524.met.gz</a>):
+
+<div class="code"><pre>
+# set computational region to first Landsat band
 g.region raster=lsat7_2002_10 -p
 
-# Find pure endmembers, they are supposed to be in the corners of
-# the PCA feature space (or use spectral measurement data)
+i.landsat.toar input=lsat7_2002. output=lsat7_2002_toar. sensor=tm7 \
+  method=dos1 date=2002-05-24 sun_elevation=64.7730999 \
+  product_date=2004-02-12 gain=HHHLHLHHL
+</pre></div>
 
-i.pca -n input="lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70" out=pca_lsat7_2002
-d.correlate layer1=pca_lsat7_2002.1 layer2=pca_lsat7_2002.2
+The resulting Landsat bands are named <tt>lsat7_2002_toar.1 .. lsat7_2002_toar.8</tt>.
+They are used as input for the next steps.
+<p>
+In order to obtain pure spectra ("endmembers") to be searched for during
+the spectral unmixing process later on we can either obtain them from spectral
+libraries (<a href="https://speclib.jpl.nasa.gov/">ASTER Spectral Library</a>,
+<a href="https://speclab.cr.usgs.gov/spectral-lib.html">USGS Spectral Library</a>,
+field spectrometer, etc.) or through a PCA analysis as follows.
+<p>
+In order to identify pure endmembers, they are supposed to be in the corners of
+the PCA feature space:
 
+<div class="code"><pre>
+i.pca -n input=lsat7_2002_toar.1,lsat7_2002_toar.2,lsat7_2002_toar.3,lsat7_2002_toar.4,lsat7_2002_toar.5,lsat7_2002_toar.7 \
+         output=pca_lsat7_2002_toar
+d.mon wx0
+# d.correlate or use scatterplot tool in g.gui
+d.correlate map=pca_lsat7_2002_toar.1,pca_lsat7_2002_toar.2
+
 # TODO: problem: how to obtain the unprojected coordinates for the corner pixels?
 # (in 1998 the xgobi software did this nicely, check today's ggobi)
+</pre></div>
 
+Next the ASCII file (e.g. called "spectrum.dat") containing six spectra needs
+to be written using either spectral data from a spectral library or from the PCA
+analysis.
+<p>
+Sample content of "spectrum.dat":
+<div class="code"><pre>
+# Channels: r g b i1 i2 i3
+# Enter spectra linewise!
+# 1. Sagebrush 
+# 2. Saltbush
+# 3. Soil
+# 4. Dry grass
+#
+Matrix: 4 by 6
+row0:  8.87  13.14  11.71  35.85  28.26 10.54
+row1: 13.59  20.12  19.61  70.66 34.82 16.35
+row2: 28.26  34.82  38.27  40.1 38.27 23.7
+row3: 10.54  16.35  23.7   38.98 40.1 38.98
+</pre></div>
 
-i.group group=lsat7_2002 subgroup=lsat7_2002 \
-  input=lsat7_2002_10,lsat7_2002_20,lsat7_2002_30,lsat7_2002_40,lsat7_2002_50,lsat7_2002_70
+Spectral unmixing step (requires input data to be collected in an imagery group):
+<div class="code"><pre>
+i.group group=lsat7_2002_toar subgroup=lsat7_2002_toar \
+  input=lsat7_2002_toar.1,lsat7_2002_toar.2,lsat7_2002_toar.3,lsat7_2002_toar.4,lsat7_2002_toar.5,lsat7_2002_toar.7
 
-i.spec.unmix group=lsat7_2002 matrix=sample/spectrum.dat result=lsat7_2002_unmix \
+i.spec.unmix group=lsat7_2002_toar matrix=sample/spectrum.dat result=lsat7_2002_unmix \
   error=lsat7_2002_unmix_err iter=lsat7_2002_unmix_iterations
 
 # todo: reclass to 0..100%



More information about the grass-commit mailing list