I would like to generate a histogram of the ratio between pixels within a polygon called "MODISofstation". Thereby all the pixels within my polygon should be compared to the pixel where my Point "pt" is located in and I can see the variability within the polygon. I am only looking at B8 for this example. The first part of my code works fine and I receive all the values from each month but from the part "//RATIO" on, I fail to make it work to calculate the monthly mean, the ratio and bring it into a histogram.
Below you can find the code snippet
var start = '2020-06-01';
var finish = '2020-06-30';
var pt = ee.Geometry.Point([-49.31582, 69.56833]);
// Map the function over one year of Landsat 8 TOA data and take the median.
var l8 = ee.ImageCollection('LANDSAT/LC08/C01/T1_TOA')
.filterDate (start,finish)
.filterBounds(pt)
.filter("WRS_ROW <= 122")
.map(maskL8);
//Map. addLayer(B8)
//Map. addLayer(pt)
Map.centerObject(pt, 16);
print(l8);
// B8 VALUE OF PT
var myB8 = l8.select("B8")
print("myB8",myB8);
var getB8 = function(image) {
// Reducing region and getting value
var value_B8 = ee.Image(image)
.reduceRegion(ee.Reducer.first(), pt)
.get('B8');
return value_B8;
};
var count = myB8.size();
var B8_list = l8.toList(count).map(getB8);
print("B8 list", B8_list);
var img = l8.first();
Map.addLayer(img);
Map.addLayer(pt);
var allDates = l8.aggregate_array('system:time_start');
var allDatesSimple = allDates.map(function procDates (ele) {
return ee.Date(ele).format().slice(0,10);
});
var paired = allDatesSimple.zip(B8_list);
print (paired);
// RATIO
//Monthly mean of pt pixel
var MonthlyMeanPt = myB8.mean;
print (MonthlyMean)
var ratio= ee.Image.divide(Monthlymean)
Map.addLayer (ratio);
//Histogram within my polygon MODISofstation
var histogram = ui.Chart.image.histogram({
image: ratio,
region: MODISofstation,
scale: 15,
});
histogram.setOptions({
title: 'Histogram of Ratio'
});
print(histogram);