Module 5: Image Series Interpretation: Image Collections, Image Compositing, Change Detection

This page features troubleshooting questions students have asked for Remote Sensing Foundations Module 5: Image Series Interpretation: Image Collections, Image Compositing, Change Detection.

Question about this assignment, EVI Image

Question: The assignment says to “reduce the image collection to find the median EVI.” I am having trouble figuring this out. Is the process to calculate EVI for each image in the collection and then get the median for all of them. Or is to the get the median for bands that are in the EVI calculation. And then calculate EVI with those median numbers. Maybe you would get the same answer either way (not sure on the math of that—would have play around with some examples).

Answer:  You’re going to use imageCollection.reduce ( ) along with the ‘median’ input and it should calculate it for you automatically. I found this that could help!

Question (part 2): Thanks, I will try using this. I did not know about .reduce. My question though is I think more conceptual — it’s about how we are doing this mathematically. If you have an image collection of 20 images and you want to get a median EVI on it (as we do for this exercise, if I understand it correctly) — are we getting the median value of each band and then calculating EVI with those medians for the reduce image? Or are we calculating EVI for each image and then taking the median for the reduced image? The former seems to me like it might be more mathematically correct, but I’m not sure. And then is that what the .reduce.median function will do? If I understand what it’s doing, I think it will help me to figure out the coding better. For now, I keep getting confused because I’m not sure which of those two things we’re trying to do. Let me know if you have an explanation for that conceptual question. Thanks. 

That guide was a helpful explanation. It does say that we are creating an image with median values for each pixel for each band (if I understand it correctly). And I assume we are then to calculate the EVI from those medians. (Rather than doing EVI first for each image.) But I want to get clear on why we do it in that order from a conceptual or mathematical perspective. Let me know if you have any thoughts on that.

Also that guide says: “In particular, note that images produced by reducing an ImageCollection have no projection. This means that you should explicitly set the scale on any computations involving computed images output by an ImageCollection reduction.” Do we need to address this? I don’t think any of my code addresses scale for the computations? (Unless it’s build into the EVI formula?)  Any thoughts about scale in EVI computation?

So reading through this again, I’m not sure if I actually reduced my image either. I did this:

var WebbFarmImage = Landsat7
.filterBounds(WebbFarm)
.filterDate(‘2012-04-25’, ‘2012-10-25’)
.filterMetadata(‘CLOUD_COVER’, ‘less_than’, 50)
.median( );

It gave me an image the median values for each band (I think). But is it the same as the method you suggested?

Plus, I’m still not sure about the math — is calculating the EVI from the medians for the component bands from the image collection the same as calculating EVI for each image and then taking the median EVI?

Answer (part 2): I’m reading through the thread here. When you reduce an image or an image collection (you can do both) you are basically aggregating data. This can be done over bands, over time, or over space in GEE. In this case (if I am understanding the original question above), you are taking an image collection and reducing it to one image with multiple bands. The ‘reducer’ that you are using is median. You will write a function to do this. 

In the code you pasted above, you were filtering your image collection by ROI, date, metadata and grabbing the median. This might get you the same answer as you would get by writing a function where your reducer is median, but it might not in all cases. It has to do with how GEE computes (and takes shortcuts in computing on a supercomputer to arrive at an answer). If you write a function to reduce the collection using ee.Reducer, you are stacking up the images in your collecting and then calculating the median per pixel and per band, arriving (hopefully!) at one multi-band image that is a composite of your date range. From this you will calculate EVI.

I see you posted ‘reducing and image collection’ above. ‘Reducer overview‘ is in the same content folder but has more of an explanation about what reducers are doing.

Cloud Mask, Q&A:

Question: I’ve seen a few people mention doing cloud masks. I’m curious to try that. Is that something we covered in a tutorial that I somehow missed? Or if you learned about it on your own — let me know where you found out how to do it. @Alejandro Prieto @Amanda Armstrong

Answer: We only discussed cloud-masking a little bit in the live session. We did apply a mask with ‘UpdateMask.’ Here is a good tutorial on how to apply masks.

Skip to toolbar