Import of LANDSAT 7 into GRASS

Idea: From a CDROM with LANDSAT 7 we directly generate a GRASS LOCATION automatically by a script, then we import the other channels from CDROM. Usually we have two CDROMs, one for R,G,B,NIR,MIR,MIR2,Thermal1,Thermal2 and another CDROM for PAN band.

Preparations

1. Download the script: create_location.sh (save as file 'create_location.sh'). It might be necessary to adjust the variable GRASSSTARTSCRIPT in the script.

2. Make script executable:

    chmod a+x create_location.sh

Creating a Location via script

Mount the CDROM, create location using the script:
   mount /cdrom
   cd /cdrom
   ls

   #check with gdalinfo if the data are detected properly:
   gdalinfo l71230079_07920030215_hrf.fst

   # now we use the script, see help text:
   create_location.sh 
  
   #launch it:
   create_location.sh l71230079_07920030215_hrf.fst tuc_lsat

   #unmount CDROM:
   cd $HOME
   umount /cdrom
Now we have available a GRASS location!

Working with new location

Start GRASS as advertised by the 'create_location.sh' script, and import the other channels into the location:
  grass5 /ssi0/ssi/neteler/grassdata/tuc_lsat/PERMANENT

  #check the coordinates:
  g.region -p
  # should display the correct lat/long values:
  g.region -l
  g.projinfo

  #import the missing channels (thermal):
  r.in.gdal in=l71230079_07920030215_htm.fst out=l71230079_07920030215_htm.fst

  #you may want to change the CDROM and import the PAN channel:
  mount /cdrom
  cd /cdrom
  ls
  #import PAN:
  r.in.gdal in=l71230079_07920030420_hpn.fst out=l71230079_07920030420_hpn.fst
  cd $HOME
  umount /cdrom

  #now we have 6 channels + 2 thermal (low and high gain) + 1 PAN:
  g.list rast

  #look and play:
  d.mon x0

  d.rast l71230079_07920030215_hrf.fst.1
  # note that r.in.gdal applies
  d.rgb b=l71230079_07920030215_hrf.fst.1 g=l71230079_07920030215_hrf.fst.2 r=l71230079_07920030215_hrf.fst.3

  # to get better RGB colors, we apply a histogram equalized grey color table:
  r.colors  l71230079_07920030215_hrf.fst.1 col=grey.eq
  r.colors  l71230079_07920030215_hrf.fst.2 col=grey.eq
  r.colors  l71230079_07920030215_hrf.fst.3 col=grey.eq
  d.rgb b=l71230079_07920030215_hrf.fst.1 g=l71230079_07920030215_hrf.fst.2 r=l71230079_07920030215_hrf.fst.3
Now you could do image fusion (R,G,B and PAN) with IHS or Brovey (download i.brovey.tm, perform classifications etc (see GRASS book or other references).

Brovey image fusion

Use the script above:
i.brovey tm2=l71230079_07920030215_hrf.fst.2 tm4=l71230079_07920030215_hrf.fst.4 \
         tm5=l71230079_07920030215_hrf.fst.5 etmpan=l71230079_07920030420_hpn.fst out=brov

NDVI calculation

r.mapcalc "ndvi_20030215=1.0*(l71230079_07920030215_hrf.fst.4 - l71230079_07920030215_hrf.fst.3)/(l71230079_07920030215_hrf.fst.4 \
           + l71230079_07920030215_hrf.fst.3)"
d.rast.leg ndvi_20030215

© 2003 Markus Neteler (neteler AT itc.it)
Back MPA HOME
Last change: $Date: 2003-11-09 23:08:46 +0100 (Sun, 09 Nov 2003) $