Opened 6 years ago

Closed 6 years ago

#2089 closed defect (fixed)

i.landsat.toar doesn't take into account the resolution difference between panchromatic and the other bands.

Reported by: vesnikos Owned by: grass-dev@…
Priority: major Milestone: 7.0.0
Component: Imagery Version: svn-trunk
Keywords: i.landsat.toar Cc: vesnikos
CPU: Unspecified Platform: All

Description

i.landsat.toar transforms the sensors DN to top of the atmosphere radiance/reflectance.

All bands except band 8 (panchromatic) have a pixel size of 30m. Band 8 has pixel size of 15.

When i.landsat.toar runs, it makes all the calculations with g.region res=30, which is obviously wrong for band 8.

I classify it as a a major problem , because band 8 carries double data and its being used in pansharpening techniques .

Change History (7)

comment:1 Changed 6 years ago by vesnikos

Cc: vesnikos added

comment:2 Changed 6 years ago by neteler

Keywords: i.landsat.toar added

Did you check with the current version in GRASS 6 (the original author confirmed the other day to me that it should behave as expected)?

Interestingly, both use the same mechanism to maintain the resolution:

[neteler@oboe ~]$ grep _get_cellhd grass64/imagery/i.landsat.toar/main.c
	    if (G_get_cellhd(band_in, mapset, &cellhd) < 0)
	if (G_get_cellhd(band_in, mapset, &cellhd) < 0)

[neteler@oboe ~]$ grep _get_cellhd grass70/imagery/i.landsat.toar/main.c
	    Rast_get_cellhd(band_in, "", &cellhd);
	Rast_get_cellhd(band_in, "", &cellhd);

comment:3 in reply to:  description Changed 6 years ago by neteler

Replying to vesnikos:

i.landsat.toar transforms the sensors DN to top of the atmosphere radiance/reflectance.

All bands except band 8 (panchromatic) have a pixel size of 30m. Band 8 has pixel size of 15.

Did you check the input resolution? I tested it with the Raleigh scene LC80160352013134LGN03.tar.gz:

for i in `ls LC*.TIF` ; do echo -n "$i: " ; gdalinfo $i | grep Pixel ; done
LC80160352013134LGN03_B10.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)
LC80160352013134LGN03_B11.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)
LC80160352013134LGN03_B1.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)
LC80160352013134LGN03_B2.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)
LC80160352013134LGN03_B3.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)
LC80160352013134LGN03_B4.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)
LC80160352013134LGN03_B5.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)
LC80160352013134LGN03_B6.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)
LC80160352013134LGN03_B7.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)
LC80160352013134LGN03_B8.TIF: Pixel Size = (15.000000000000000,-15.000000000000000)
LC80160352013134LGN03_B9.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)
LC80160352013134LGN03_BQA.TIF: Pixel Size = (30.000000000000000,-30.000000000000000)

The TIFF files are delivered as such (only B8 is 15m).

I also see that even the PAN B8 band is set to 30m in GRASS 7:

i.landsat.toar input_prefix=LC80160352013134LGN03_B output_prefix=toar \
  metfile=LC80160352013134LGN03_MTL.txt sensor=oli8 date=2013-05-14  -r
...

for i in `g.mlist rast pattern="toar*"` ; do echo "$i: " ; r.info -g $i | grep -i res ; done
toar1: 
nsres=30
ewres=30
toar10: 
nsres=30
ewres=30
toar11: 
nsres=30
ewres=30
toar2: 
nsres=30
ewres=30
toar3: 
nsres=30
ewres=30
toar4: 
nsres=30
ewres=30
toar5: 
nsres=30
ewres=30
toar6: 
nsres=30
ewres=30
toar7: 
nsres=30
ewres=30
toar8: 
nsres=30  <<-- should be 15
ewres=30  <<-- should be 15
toar9: 
nsres=30
ewres=30

Using

g.version -g
version=7.0.svn
date=2013
revision=57610
build_date=2013-09-08

NOTE: In GRASS 6 i.landsat.toar preserves the resolution. Must be a bug in the usage of Rast_get_cellhd() in the G7 version?

comment:4 Changed 6 years ago by neteler

Perhaps this email contains relevant info:

http://lists.osgeo.org/pipermail/grass-dev/2010-July/051318.html [GRASS-dev] Rast_set_window() changes in 7.0 - Thu Jul 22 02:57:55 EDT 2010

The problem will be in this part of G7's i.landsat.toar/main.c:

            sprintf(band_in, "%s%d", inputname, lsat.band[i].code);
            if ((infd = Rast_open_old(band_in, "")) < 0)
                G_fatal_error(_("Unable to open raster map <%s>"), band_in);
            Rast_get_cellhd(band_in, "", &cellhd);
            G_set_window(&cellhd);

comment:5 in reply to:  4 ; Changed 6 years ago by mmetz

Replying to neteler:

Perhaps this email contains relevant info:

http://lists.osgeo.org/pipermail/grass-dev/2010-July/051318.html [GRASS-dev] Rast_set_window() changes in 7.0 - Thu Jul 22 02:57:55 EDT 2010

The problem will be in this part of G7's i.landsat.toar/main.c:

            sprintf(band_in, "%s%d", inputname, lsat.band[i].code);
            if ((infd = Rast_open_old(band_in, "")) < 0)
                G_fatal_error(_("Unable to open raster map <%s>"), band_in);
            Rast_get_cellhd(band_in, "", &cellhd);
            G_set_window(&cellhd);

Most likely. The window needs to be set 1) with Rast_set_window(), 2) before a raster is opened. Please try r57957.

comment:6 in reply to:  5 Changed 6 years ago by Nikos Alexandris

Replying to mmetz:

Replying to neteler:

Perhaps this email contains relevant info:

http://lists.osgeo.org/pipermail/grass-dev/2010-July/051318.html [GRASS-dev] Rast_set_window() changes in 7.0 - Thu Jul 22 02:57:55 EDT 2010

The problem will be in this part of G7's i.landsat.toar/main.c:

            sprintf(band_in, "%s%d", inputname, lsat.band[i].code);
            if ((infd = Rast_open_old(band_in, "")) < 0)
                G_fatal_error(_("Unable to open raster map <%s>"), band_in);
            Rast_get_cellhd(band_in, "", &cellhd);
            G_set_window(&cellhd);

Most likely. The window needs to be set 1) with Rast_set_window(), 2) before a raster is opened. Please try r57957.

It works here (revision=57968M)! Thank you.

comment:7 Changed 6 years ago by neteler

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.