Blue-Ventures-Conservation / GEM

This repository stores the code for the Google Earth Engine Mangrove Mapping Methodology. It is best used by following the links located in the ReadMe file. The GEM is owned and managed by Blue Ventures Conservation.
https://blueventures.org/
GNU General Public License v3.0
59 stars 19 forks source link

Only one pixel date across pixels which are from different images #31

Closed thejollygeo closed 2 weeks ago

thejollygeo commented 2 weeks ago

Within a single composite, different pixels which are clearly from different images, read the same date values, e.g. in this script, as explained below. Is the pixel date calculation correct for all pixels?

The stars show the three pixels which were selected, pixels almost certainly from at least 2 different images, yet the Landsat image date is the same for all three (the Historical High Tide image is in question here, and shown in the maps):

image

image

image

zibnix commented 2 weeks ago

This was an interesting thread to pull on!

The problem ends up being that the date bands are added after the cloud masking, so the date gets pulled from the image on top, even where it should be masked, because the date bands are not masked in the same areas as the visual bands.

The fix is to add the date bands to the imagery before masking, which is easy enough, but this also has implications for the tidal bands as well, which are added after the cloud masking. In testing, the same issue occurs there, where pixels are assigned an MNDWI value from the wrong scene, causing the quality mosaic to then pull pixels from the wrong scene when separating high and low tide.

I will move things around so that the tidal bands and the date bands are added before cloud masking. Any time a band is added to the imagery before we do the quality mosaic, we need to be sure that the bands are added before any image level masking takes place.

zibnix commented 2 weeks ago

Ok, recent commits have fixed this issue with the dates, as well as with the tidal bands and ordering for high and low tide in areas that were previously intended to be masked by the cloud mask.

In this specific region you're looking at, you won't see these same artifacts in the imagery, because (due to the tide band changes) the visual imagery selected no longer has as much cloud masked area in it and is from a different date.

thejollygeo commented 2 weeks ago

Oh cool, well that's good news! The dates now work 👍

As you stated these fixes change the composites generated for our MHJ work, in the areas which are masked out due to clouds. Those artifacts in the historical high-tide have indeed gone, perhaps due to a different image being used in the east of the ROI. However the historical low-tide image isn't so nice now (some cloud shadow, some blotchiness). I've switched up the Historical parameters and have landed on these beauties.

Onto Mahajamba Module 2!

zibnix commented 2 weeks ago

Looking great! Hopefully there should be more separation between high and low tide conditions in the future as well, as this change is a more accurate use of the MNDWI when selecting imagery.