Using pansharpening in Gee python API to calculate NDWI in better resolution

62 Views Asked by At

I am new to Gee and python as well and am facing a problem in Gee python API in Colab. I want to pansharpen a Landsat 8 mage to generate an image with better spatial resolution. Afterwards I want to use the sharpened image to calculate a NDWI image with enhanced resolution. The aim is to perform otsu threshholding on a bunch of NDWI images (binarisation of Land/Water surfaces), so that the radiometric resolution of the NDWI images won´t matter quite much until the histograms shows two peaks and one tale :) The sharpened image looks perfekt but when I calculate the NDWI both NDWI images (ndwi_pamsharp, ndwi) look alike and have the same spatial resulution. Does anyone know why that is?

So here is my code to calculate the pancharpening and the NDWI:

image = ee.Image('LANDSAT/LC08/C02/T1_TOA/LC08_044034_20140318')
Map.addLayer(
    image,
    {'bands': ['B8', 'B3'], 'min': 0, 'max': 0.25, 'gamma': [1.1, 1]},
    'Original')

hsv = image.select(['B4', 'B3','B6']).rgbToHsv()

sharpened = ee.Image.cat([
    hsv.select('hue'), hsv.select('saturation'), image.select('B8')
]).hsvToRgb()

Map.setCenter(-122.44829, 37.76664, 13)
Map.addLayer(sharpened,
             {'min': 0, 'max': 0.25, 'gamma': [1.3, 1.3, 1.3]},
             'Pan-Sharpened')

Map.addLayer(image,
             {'min': 0, 'max': 0.25, 'gamma': [1.3, 1.3, 1.3]},
             'Original')



ndwi_pamsharp = sharpened.normalizedDifference(['blue', 'green']).rename('NDWI');
ndwi = image.normalizedDifference(['B6', 'B3']).rename('NDWI');
0

There are 0 best solutions below