Turning a band of Sentinel 2 image into an array

Viewed 259

I am new to Google Earth Engine and have started playing with mathematically combining different bands to define new index. The problem I am having is the visualisation of the new index - I need to define the max and min parameter when adding it to the map, and I am having troubles understanding what these two end points should be. So here come my two questions:

  1. Is it possible to get the matrix of my image in terms of pixel values? Then I could easily see from what values they range and hence could define min and max!

  2. What values are taken in different bands? Is it from 0 to 1 and measures intensity at given wavelength, or is it something else?

Any help would be much appreciated, many thanks in advance!

1 Answers

Is it possible to get the matrix of my image in terms of pixel values? Then I could easily see from what values they range and hence could define min and max!

If this is what you want to do, there's a built in way to do it. Go to the layer list, click on the gear for the layer, and in the “Range” section, pick one of the “Stretch:” options from the menu, then click “Apply”. You can choose a range in standard deviations, or 100% (min and max).

You can then use the “Import” button to save these parameters as a value you can use in your script.

(All of this applies to the region of the image that's currently visible on screen — not the entire image.)

What values are taken in different bands? Is it from 0 to 1 and measures intensity at given wavelength, or is it something else?

This is entirely up to the individual dataset you are using; Earth Engine only knows about numbers stored in bands and not units of measure or spectra. There may be sufficient information in the dataset's description in the data catalog, or you may need to consult the original provider's documentation.

Related