L5 & Sentinel2 - Change Detection...many steps to the finish line

Hey all,

I have a Landsat 5 TM image and a Sentinel2 MSI image of the Austrian alps. I now want to perform a change detection which requires both dataset to have the same geometry. I did this step by step but still I am stuck…

#1: Resample Landsat and Sentinel-2 images to a pixel size of 10m, save as BEAM

#2: Mosaicing of the two desired S2-tiles

#3: Create a spatial subset of L5 and S2 images and save it as BEAM
-> it creates additional bands with “count” in the name…e.g. “B1”, “B1_count”, “B2”, “B2_count” and so on…what is this and why do I need this? SNAP crashed when I removed them

#4: Collocation: to have all pixels at the exact same location and make image algebra possible

Now I get a new image with all S2 and L5 bands in it. When I try to extract them via spectral subset, it will throw an error (I need what’s called the “collocation flag”).

This all seems too complicated. Isn’t there an easier way of doing this? Or any other way that works? How can I get rid of the “count” bands and just go back to band 1, 2, 3, … (this is for education purpose and I don’t want to confuse the students)

Thanks!

The ‘*_count’ bands are created by the mosaic step. They count how many source pixels contributed to one target pixel. This is often useful when mosaicking multiple products. They are also used in the valid expression of the B# bands.
You can remove the count bands but you also have to change the valid expression of the B# bands.

I agree that it would be a good option for the Mosaic to disable the generation of the count bands. I’ve put it into our issue tracker.

To ease the workflow a bit it is sufficient to create the spatial subset only on one of the products, e.g. the L5. When collocating the products afterwards and using this one as master the other will be tailored to this spatial extended.

You can also do the spectral subset at the same time as the spatial subset or the mosaic.

What I haven’t yet understood is the last error you report.

I think you can simply delete the collocation_flags

Dear marpet,

thank you very much for the quick and exhaustive response!

They are also used in the valid expression of the B# bands. You can remove the count bands but you also have to change the valid expression of the B# bands.

Could you please explain what you mean by “valid expression” and how I change them for the B# bands? I used to work with ERDAS Imagine, ENVI or LeoWorks but in the moment, I don’t quite figure what it could mean.

To ease the workflow a bit it is sufficient to create the spatial subset only on one of the products, e.g. the L5. When collocating the products afterwards and using this one as master the other will be tailored to this spatial extended.

That’s a very good hint, I will keep it in mind! It leads me to my next answer…

I think you can simply delete the collocation_flags

I thought this was the reason for SNAP to crash, but maybe it’s a different issue. After the collocation, I get a new dataset with all the S2- and all the L5-bands in it (+ B#_counts + collocation_flags). Now if I want to separate those again (band subset), to get two datasets (one for S2 and one for Landsat), but don’t include the collocation flags, it says:

“If you do not include these dataset(s) [‘collocation_flags’] into your selection, you might get unexpected results while working witht he resulting product”

and next:

“If you do not include a flag dataset in the subset, you will not be able to create bitmask overlays”

Ignoring these messages allows to finish the process. But when I want to open the band that I extracted, SNAP crashes (no reaction until I terminate the process).

If you right click on a band and select Properties you can change the Valid-Pixel Expression.
You can delete it for the B# bands.

But as you want to have both products separate at the end. You can use the Reprojection instead of the Collocation.
In the reprojection you have the ‘Use CRS of’ option. If you specify on of the products here e.g. the L5, then the S2 is reprojected to the CRS of the L5.
I’m not sure if this works and fits your needs but maybe worth a try.