1

I have a code in GEE which creates two images from sentinel-1 (SAR) and from sentinel-2 (NDVI) , creates from them paired image and then creates scatter plot from the two bands in the image. In order to create the scatterplot, I know I need to run kind of training and i'm a bit confused about it and about my results.

This is the code I have that seemed to be working:


// make an image for the two variables
var pairedImage =  ee.ImageCollection.fromImages([imageNDVIcor,SARreproject]).toBands().rename(["NDVI","SAR"]);
print("pairedImage",pairedImage);
// Generate a sample of points within the region
var sample = pairedImage.sampleRegions(geometry, null, 150);
print("sample",sample);
// Generate chart from sample
var chart = ui.Chart.feature.byFeature(sample, 'NDVI', 'SAR')
    .setChartType('ScatterChart');
print("chart",chart);

The point is that I get results that look nice but I can't understand, for example: this is suppose to be my point? what is this? what are those values?

var sample = pairedImage.sampleRegions(geometry, null, 500);

enter image description here

and this is with: var sample = pairedImage.sampleRegions(geometry, null, 150);:

enter image description here

and this is when it's 1000: enter image description here

How come using less points lead to more ponts in the correlation? I feel confused and i'm afraid that I don't understand something very basic with the sample points.

My end goal is to understand why I have gotten those two different charts when 500 has lesspoints than 100 and 1000 had the least. what'shapenning here?

1 Answer 1

2

Here's the sampleRegions() function:

sampleRegions(collection, properties, scale, projection, tileScale, geometries)

You're changing the third argument - scale. Increasing the scale will decrease the number of pixels you can sample, which in turn decreases the number of samples.  

7
  • 1
    To add to this, if you don’t specify a scale it will sample at the scale of the top image layer (beware of memory allocations). Dec 5, 2019 at 16:52
  • so what does scale refers to in this case?
    – ReutKeller
    Dec 5, 2019 at 18:25
  • From the docs: "A nominal scale in meters of the projection to sample in. If unspecified,the scale of the image's first band is used." Dec 5, 2019 at 19:42
  • @Daniel maybe it's problem of language as English is not my mother tongue, but from what is written I have understood that the scale is kind of pixel size? and no way it was used to this test right?
    – ReutKeller
    Dec 6, 2019 at 10:25
  • Pixel size - that's pretty much it. On having fewer sampled pixels with larger scale: Think of the extreme case, where your scale is so big, that your image only contains a single pixel. Then you couldn't get more than one single sample, since you only have one pixel to sample from. Dec 6, 2019 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.