[GRASS-user] Error with pansharpening

Hi all,

I’m using GRASS 7.8 on WIndows 10, and trying out some of the Landsat routines.

I’m getting an error on pan sharpening, at the very end of the processing: and i see some temp files have been created. is there a way to fix this? Thanks, Vishal

···

Vishal K. Mehta, PhD
Sr. Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org

Hi Vishal,

On Wed, Feb 23, 2022 at 8:22 PM Vishal Mehta <vishalm1975@gmail.com> wrote:

Hi all,

I'm using GRASS 7.8 on WIndows 10, and trying out some of the Landsat routines.

Which version do you precisely use?

g.version -rge

Is it 7.8.6 or older?

Markus

PS: Just a few minutes ago I released 7.8.7 :slight_smile:
       https://github.com/OSGeo/grass/releases/tag/7.8.7
      (Windows and other binaries aren't ready yet)

I'm getting an error on pan sharpening, at the very end of the processing: and i see some temp files have been created. is there a way to fix this? Thanks, Vishal
---
Wed Feb 23 11:14:22 2022)
i.pansharpen red=Refl_3@PERMANENT green=Refl_2@PERMANENT blue=Refl_1@PERMANENT pan=LC08_L1TP_044033_20180225_20180308_01_T1_B8@PERMANENT output=brovey_pansharpen method=brovey bitdepth=8
Using 8bit image channels
Performing pan sharpening with hi res pan image: 15.000000
Pan channel/intensity histogram matching using linear regression
Histogram matching...
Traceback (most recent call last):
  File "C:\PROGRA~1\QGIS3~1.10\apps\grass\grass78/scripts/i.
pansharpen.py", line 632, in <module>
    main()
  File "C:\PROGRA~1\QGIS3~1.10\apps\grass\grass78/scripts/i.
pansharpen.py", line 257, in main
    brovey(pan, ms1, ms2, ms3, out, pid, sproc)
  File "C:\PROGRA~1\QGIS3~1.10\apps\grass\grass78/scripts/i.
pansharpen.py", line 315, in brovey
    panmatch1 = matchhist(pan, ms1, outname)
  File "C:\PROGRA~1\QGIS3~1.10\apps\grass\grass78/scripts/i.
pansharpen.py", line 552, in matchhist
    stats = stats_out.communicate()[0].split('\n')[:-1]
TypeError: a bytes-like object is required, not 'str'
(Wed Feb 23 11:14:31 2022) Command finished (9 sec)

...

Thanks Markus,

It’s 7.8.2
g.version -rge
version=7.8.2
date=2019
revision=3900fb114
build_date=2019-12-11
build_platform=x86_64-w64-mingw32
build_off_t_size=8
libgis_revision=00000
libgis_date=“?”
proj=6.2.1
gdal=3.0.2
geos=3.8.0
sqlite=3.29.0

I did see your email recently about 7.8.7…
I could just try version 8?

-V

image.png

···

Vishal K. Mehta, PhD
Sr. Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org

Hi Vishal,

On Wed, Feb 23, 2022 at 9:04 PM Vishal Mehta <vishalm1975@gmail.com> wrote:

Thanks Markus,

It's 7.8.2
g.version -rge
version=7.8.2
date=2019

.. your installation is a few years old - please consider updating to
7.8.6 or even 8.0.x.

I did see your email recently about 7.8.7..
I could just try version 8?

Sure, that would be best.

BTW: For the QGIS integration of GRASS GIS 8.0:
QGIS has been updated in master (QGIS 3.24) and everything backported
to QGIS 3.22 LTR.

Cheers,
Markus

Thanks Markus,
I’ll just do a fresh install of Grass 8 and try it out,
Best,
Vishal

···

Vishal K. Mehta, PhD
Sr. Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org

HI Markus, all,

I installed Grass 8.0.0 and tried the pansharpening step. ALthough there are no errors, the resulting pansharpened rasters all have zero values.

I basically followed the steps here
https://courses.neteler.org/processing-landsat8-data-in-grass-gis-7/#Unpacking_the_downloaded_Landsat_8_dataset

and here:
https://courses.neteler.org/processing-landsat-8-data-in-grass-gis-7-rgb-composites-and-pan-sharpening/

Essentially, after downloading the Landsat 8 OLI scene:

  1. Copy blue, green and red channels rasters so that the GRASS module for converting to reflectance can work
  2. Convert DN to reflectance
  3. i.enhance.colors
  4. pansharpen with Landsat band 8
    This last step is where I haven’t yet succeeded. Note that i did not convert the DN to reflectance for band 8. Could that be the problem? Note also that i was using older Grass versions for step 2 and 3.

This is the Grass version i’m trying now:

···

Vishal K. Mehta, PhD
Sr. Scientist
Stockholm Environment Institute - US
133 D St Suite F
Davis CA 95616
www.sei-us.org