Skip to content

Instantly share code, notes, and snippets.

@jkariscodes
Last active May 16, 2017 10:41
Show Gist options
  • Save jkariscodes/c1e0194f91c627ab1b1cd3bac9433f04 to your computer and use it in GitHub Desktop.
Save jkariscodes/c1e0194f91c627ab1b1cd3bac9433f04 to your computer and use it in GitHub Desktop.
Unsupervised classification in PyGRASS
/usr/bin/python2.7 landsatProcessing.py
L7_Kenya
Ungzip Landsat files in /home/hempire/rawData/L7Dir/LE07_
Import in GRASS GIS
> LE07_L1TP_166061_20170221_20170319_01_T1_B2
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B2>...
Region for the current mapset updated
> LE07_L1TP_166061_20170221_20170319_01_T1_B5
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B5>...
Region for the current mapset updated
> LE07_L1TP_166061_20170221_20170319_01_T1_B8
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B8>...
Region for the current mapset updated
> LE07_L1TP_166060_20161016_20161111_01_T1_B2
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B2>...
Region for the current mapset updated
> LE07_L1TP_166061_20170221_20170319_01_T1_B1
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B1>...
Region for the current mapset updated
> LE07_L1TP_166060_20161016_20161111_01_T1_B1
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B1>...
Region for the current mapset updated
> LE07_L1TP_166061_20170221_20170319_01_T1_B61
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B61>...
Region for the current mapset updated
> LE07_L1TP_166061_20170221_20170319_01_T1_B7
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B7>...
Region for the current mapset updated
> LE07_L1TP_166061_20170221_20170319_01_T1_B4
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B4>...
Region for the current mapset updated
> LE07_L1TP_166061_20170221_20170319_01_T1_B62
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B62>...
Region for the current mapset updated
> LE07_L1TP_166060_20161016_20161111_01_T1_B8
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B8>...
Region for the current mapset updated
> LE07_L1TP_166060_20161016_20161111_01_T1_B7
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B7>...
Region for the current mapset updated
> LE07_L1TP_166060_20161016_20161111_01_T1_BQA
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166060_20161016_20161111_01_T1_BQA>...
Region for the current mapset updated
> LE07_L1TP_166060_20161016_20161111_01_T1_B4
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B4>...
> LE07_L1TP_166060_20161016_20161111_01_T1_B62
Region for the current mapset updated
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B62>...
Region for the current mapset updated
> LE07_L1TP_166061_20170221_20170319_01_T1_B3
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B3>...
Region for the current mapset updated
> LE07_L1TP_166060_20161016_20161111_01_T1_B5
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B5>...
Region for the current mapset updated
> LE07_L1TP_166060_20161016_20161111_01_T1_B61
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B61>...
> LE07_L1TP_166061_20170221_20170319_01_T1_BQA
Region for the current mapset updated
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166061_20170221_20170319_01_T1_BQA>...
Region for the current mapset updated
> LE07_L1TP_166060_20161016_20161111_01_T1_B3
Proceeding with import of 1 raster bands...
Importing raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B3>...
Region for the current mapset updated
Creating color table for output raster map...
Writing raster map <LE07_L1TP_166060_composite>...
r.composite complete. Raster map <LE07_L1TP_166060_composite> created.
Creating color table for output raster map...
Writing raster map <LE07_L1TP_166061_composite>...
r.composite complete. Raster map <LE07_L1TP_166061_composite> created.
Performing pan sharpening with hi res pan image: 15.000000
Transforming to IHS color space...
Histogram matching...
Transforming back to RGB color space and sharpening...
Assigning grey equalized color tables to output images...
Adding raster map <pansharpened1_red@hempire> to group
Adding raster map <pansharpened1_blue@hempire> to group
Adding raster map <pansharpened1_green@hempire> to group
Performing pan sharpening with hi res pan image: 15.000000
Transforming to IHS color space...
Histogram matching...
Transforming back to RGB color space and sharpening...
Assigning grey equalized color tables to output images...
Adding raster map <pansharpened2_red@hempire> to group
Adding raster map <pansharpened2_blue@hempire> to group
Adding raster map <pansharpened2_green@hempire> to group
Adding raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B2@hempire> to
group
Adding raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B3@hempire> to
group
WARNING: Raster map
<LE07_L1TP_166060_20161016_20161111_01_T1_B4LE07_L1TP_166060_20161016_20161111_01_T1_B8>
not found. Skipped.
Adding raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B2@hempire> to
subgroup
Adding raster map <LE07_L1TP_166060_20161016_20161111_01_T1_B3@hempire> to
subgroup
WARNING: Raster map
<LE07_L1TP_166060_20161016_20161111_01_T1_B4LE07_L1TP_166060_20161016_20161111_01_T1_B8>
not found. Skipped.
Adding raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B2@hempire> to
group
Adding raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B3@hempire> to
group
Adding raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B4@hempire> to
group
Adding raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B8@hempire> to
group
Adding raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B2@hempire> to
subgroup
Adding raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B3@hempire> to
subgroup
Adding raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B4@hempire> to
subgroup
Adding raster map <LE07_L1TP_166061_20170221_20170319_01_T1_B8@hempire> to
subgroup
Reading raster maps...
i.cluster complete. File <sig_cluster_1> created.
Reading raster maps...
i.cluster complete. File <sig_cluster_2> created.
WARNING: Signature 1 is not valid (ill-conditioned) - ignored
WARNING: Signature 1 is not valid (ill-conditioned) - ignored
----------------------------------------------
raster files available in mapset <hempire>:
LE07_L1TP_166060_20161016_20161111_01_T1_B1
LE07_L1TP_166060_20161016_20161111_01_T1_B2
LE07_L1TP_166060_20161016_20161111_01_T1_B3
LE07_L1TP_166060_20161016_20161111_01_T1_B4
LE07_L1TP_166060_20161016_20161111_01_T1_B5
LE07_L1TP_166060_20161016_20161111_01_T1_B61
LE07_L1TP_166060_20161016_20161111_01_T1_B62
LE07_L1TP_166060_20161016_20161111_01_T1_B7
LE07_L1TP_166060_20161016_20161111_01_T1_B8
LE07_L1TP_166060_20161016_20161111_01_T1_BQA
LE07_L1TP_166060_composite
LE07_L1TP_166061_20170221_20170319_01_T1_B1
LE07_L1TP_166061_20170221_20170319_01_T1_B2
LE07_L1TP_166061_20170221_20170319_01_T1_B3
LE07_L1TP_166061_20170221_20170319_01_T1_B4
LE07_L1TP_166061_20170221_20170319_01_T1_B5
LE07_L1TP_166061_20170221_20170319_01_T1_B61
LE07_L1TP_166061_20170221_20170319_01_T1_B62
LE07_L1TP_166061_20170221_20170319_01_T1_B7
LE07_L1TP_166061_20170221_20170319_01_T1_B8
LE07_L1TP_166061_20170221_20170319_01_T1_BQA
LE07_L1TP_166061_composite
pansharpened1_blue Image blue
pansharpened1_green Image green
pansharpened1_red Image red
pansharpened2_blue Image blue
pansharpened2_green Image green
pansharpened2_red Image red
unsupervised_result1 Maximum Likelihood Classification
unsupervised_result2 Maximum Likelihood Classification
----------------------------------------------
no raster files available in mapset <PERMANENT>
----------------------------------------------
Process finished with exit code 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment