You can control the pixel size of an image by setting the scale parameter of ee.Image.reproject():
// Reference a Landsat scene.
var image_30m = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20170614');
// Define visualization parameters for a true color image.
var vizParams = {'bands': 'B4,B3,B2',
'min': 5000,
'max': 30000,
'gamma': 1.6};
Map.addLayer(image_30m, vizParams, 'image_30m');
// Get the projection information for a band.
var band2 = image_30m.select('B2');
print('CRS:', band2.projection().crs());
// Display a bilinear resampled image with 10m pixel spacing.
var image_10m = image_30m.resample('bilinear').reproject({
crs: band2.projection().crs(),
scale: 10
});
Map.addLayer(image_10m, vizParams, 'image_10m');
If you want even more control over the projection, you can manually change the CRS transform (crsTransform
) parameter:
// Reference a Landsat scene.
var image_30m = ee.Image('LANDSAT/LC08/C01/T1/LC08_044034_20170614');
// Define visualization parameters for a true color image.
var vizParams = {'bands': 'B4,B3,B2',
'min': 5000,
'max': 30000,
'gamma': 1.6};
Map.addLayer(image_30m, vizParams, 'image_30m');
// Get the projection information for a band.
var band2 = image_30m.select('B2');
var proj = band2.projection().getInfo();
print('CRS:', proj.crs);
print('original CRS transform:', proj.transform);
// Construct a new CRS transform, using 10m spacing.
var transform_new = [
10,
proj.transform[1],
proj.transform[2],
proj.transform[3],
-10,
proj.transform[5],
];
print('new CRS transform:', transform_new);
// Display a bilinear resampled image with 10m pixel spacing.
var image_10m = image_30m.resample('bilinear').reproject(
{
crs: proj.crs,
crsTransform: transform_new
});
Map.addLayer(image_10m, vizParams, 'image_10m');
See the Projections doc page for more information.
You can mosaic a collection of pan-sharpened images as follows:
// Function to mask clouds using the quality band of Landsat 8.
var maskL8 = function(image) {
var qa = image.select('BQA');
/// Check that the cloud bit is off.
// See https://landsat.usgs.gov/collectionqualityband
var mask = qa.bitwiseAnd(1 << 4).eq(0);
return image.updateMask(mask);
};
// HSV-based Pan-Sharpening of Landsat 8 TOA images.
var panSharpenL8 = function(image) {
var rgb = image.select('B4', 'B3', 'B2');
var pan = image.select('B8');
// Convert to HSV, swap in the pan band, and convert back to RGB.
var huesat = rgb.rgbToHsv().select('hue', 'saturation');
var upres = ee.Image.cat(huesat, pan).hsvToRgb();
return image.addBands(upres);
};
// Map the function over one year of Landsat 8 TOA data and take the median.
var composite = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterDate('2016-01-01', '2016-12-31')
.map(maskL8)
.map(panSharpenL8)
.median();
// There are many fine places to look; here is one. Comment
// this out if you want to twiddle knobs while panning around.
Map.setCenter(-59.61577, 6.80943, 15);
// Display before and after layers using the same vis parameters.
Map.addLayer(composite, {bands:['B4', 'B3', 'B2'], max: 0.3}, 'Original');
Map.addLayer(composite, {bands:['red','green','blue'], max: 0.3}, 'Pansharpened');
Code link: https://code.earthengine.google.com/269648d7ecc77d2491e3b3513f7ed3f4
Note that the preceding code is a combination of the CloudMasking/Landsat8TOAReflectanceQABand.js and Image/HSVPanSharpening.js examples.
While you could apply the panSharpen
function to a previously mosaicked image and get results, that approach does not make physical sense to me because the high and low spatial resolution data in the mosaic might have been collected at different times/dates.
Best Answer
As of January 2018, the EEFlux evapotranspiration algorithms are actively being developed by several academic research groups, and are not publicly accessible as Earth Engine algorithms.