I need to access the band's pixels, do not know how to do that though

I am needing to apply a kind of “validations” in the request script, I didn’t get anywhere though.

e.g: I need to get the standard deviation of a band using a function and its return should be less than 130, if it’s true, another comparison get done.

The problem is: I couldn’t find any way to access the pixels of the band to calculate the standard deviation, the pixels should be an array.

Someone have any idea how can I get the all pixels to apply my function?

Thank you in advance! :grin:

The main idea of the script:

const standard_deviation = (band) => // here goes the formula using band pixels

if (standard_deviation(B02) < 200) {
    if (standard_deviation(B08) < 100) {
	// ... more validations
    }
}

Since this looks like the same topic as this one, I would kindly ask you to continue existing discussion there so we don’t have separate threads on the same subject. Thank you in advance!