Remote Sensing Foundations Module 3 Q&A: Introduction to Image Processing and Data Visualization

This page features troubleshooting questions students have asked for Remote Sensing Foundations Module 3: Introduction to Image Processing and Data Visualization

Question Fig. F1.3.7 Error: I was able to import the image but am having trouble renaming it (Fig. F1.3.7). I’ve attached a screenshot of the textbook instructions and my code with the error message. Anyone have ideas what I’m doing wrong? Maybe I just have a type-o in my code and don’t see it?

Answer: The issue is with the line above. This code seems to be trying to import the MODIS 09A1 dataset twice. Bascially, in order to import it here you will need a container to ‘hold’ that image collection within your code, so first define a variable (“container”) to put the collection into. Example: var mod09 = ee.ImageCollection(“MODIS/006/MOD09A1”)

From there you can filter the image collection to include a date range, area of interest or cloud threshold, etc. You can also print this variable and see how many images it contains, which right now with this line of code, is all of them! 🙂

Question False Color Composites:  I’m working on my false color composites. I’ve got it so the maps are no longer all black. But I can’t seem to get the colors to look like I think they should. For example, for a Color Infrared composite, I set the bands to B4, B3, and B2 for Landsat 7. And I get the GEE screenshot attached. I know this area is arid, but there is vegetation, so I’m wondering why there is so little red. Then I looked at the EO Browser to get a sense of whether my colors are way off. It’s a neat tool. With it — selecting false color composite for Landsat 7, Bands B4, B3, and B2, I get what’s in the EO screenshot below. Very different colors — much more red. I keep messing around with which bands are showing (though I’m fairly sure I need B4, B3, and B2 in that order). And with the visualization settings — stretch and custom — just trying it all out. But I never get much red at all. These images are from about the same point in time. This is why I thought I needed to set a max and min for the addLayer arguments — but not sure what to set there. The tutorial has 8000 to 17000 for some other images — but those are a different image source, I believe. And they result in a black map here.  This is what I was asking about — though probably not describing it very well. Any hints on how to make this image a little more red like it seems it should be? Here’s the link to the script.

Answer: The short answer is that the image is as red as it should be. I took a look at your images and everything seems to be right so I’m not sure why it wouldn’t give you a redder color; that’s the reason I think that it’s as red as it can go. If you really want to proof this, you can take a look at another image that has a similar climate, maybe even more arid/dry, just to see how it compares, although I don’t think it’s necessary.

Question 2: After watching this week’s lecture, I’m guessing that this difference I saw between my images and the Earth Observatory images had to do with Image Enhancement. But I don’t know how the Earth Observatory image might have been enhanced. Seems like maybe a contrast stretch? Is that something we’ll cover more later? Or is there a reference to learn how to do that and what those different types of stretch are in the visualization panel in GEE?

Answer 2: Yes, all of this falls under the data visualization section in GEE. I’ll attach a link below. We’ll be doing more with this but it’s essentially a way to customize and mess around with palettes/visuals on the images. Here’s a great resource. Also, check out the “False Color Composites” Topic on Yellowdig to see what others have done. Here, I attached a guide on imagery color from GEE.

Question about module 3 assignment false-color composite: The module 3 assignment says to: “Display 2 false-color composites, zoom into the ROI in the exercise.” I think I’m being dense here — but what does “zoom into the ROI in the exercise” mean? Does it mean the ROI from last week’s posting to YellowDig? Or something in the tutorial we did this week?

Answer: Yes, you can use last week’s ROI. If you want to change to a new one that’s ok, too.

Question filtering by date… what gets displayed?: I’ve noticed filters that set-date ranges for images, but they are ranges. When we add a map layer — for the image that gets displayed — how does GEE decide which date gets displayed? 

Answer: If you filter an image collection and try to display it, unless you specify an image to display, it will automatically display the first image in the collection. Typically, you would use a reducer to get from an image collection to one image – e.g. take the mean or max value per pixel.

Question Code import and Mod9 renaming issue: I see this note on MOD09A1.006 that this dataset has been superseded:

Try to download the 006 version, and it’s not available – only the updated 061 version, which is fine. But then the first line of code doesn’t match the textbook

Tried to substitute “dataset =” with mod9: doesn’t work:

Put “mod9 = ” and that is accepted put puts an error further down the code

please advise – cannot get past this!

Answer:  This is a great find (textbook error-wise!). I will make sure the editor knows this issue so the textbook can be updated! Sorry for the trouble! I think you are still getting errors because you are asking for images in 2018 and the start date of 061 is 2020. Try changing the year!

Question part 2: I ran into trouble finding the 006 as well, and ended up using 061. I did find 006 when I searched on it specifically, but it looks like I went with 061. When I cut and pasted code from the text I had to fix some of the lines that went onto a second line to get them to work, like your line 23-24. Maybe??

I have a question for both of you — do you put the var mod09= ee.ImageCollection (“MODIS….. within your numbered lines script area? For me — they are in the Imports area just above the rest of the numbered lines area of the script. See screenshot. Should I be moving those into the numbered lines area? 

Answer part 2: It is okay in either place (script or imports list). Perhaps play around with both? But for our purposes, either will be accepted. In the broad sense, the script will be more portable if the call for the image collection (or import) is in the script.

Question Almost There?, False-Color Composites: I could use some help clarifying how to change the bands to a false color composite. I completed the tutorial and included two screen shots of different layers that we created in this portion of the module (naip in turquoise & MSI in red). To alter the color scheme for these are we just adjusting the band numbers in the code editor? Aren’t these already a false color? Very confused on this. Thank you for helping me sort this out.

// Display the MSI image as a false color composite.
Map.addLayer(msiImage, {bands: [‘B8’, ‘B4’, ‘B3’], min: 0, max:
2000}, ‘MSI’);
// Get the scale of the MSI data from its projection:
var msiScale = msiImage.select(‘B8’)
.projection().nominalScale();
print(‘MSI scale:’, msiScale);
// NAIP
// Get NAIP images for the study period and region of interest.
var naipImage = naip
.filterBounds(Map.getCenter())
.filterDate(‘2018-01-01’, ‘2018-12-31’)
.first();
// Display the NAIP mosaic as a color-IR composite.
Map.addLayer(naipImage, {bands: [‘N’, ‘R’, ‘G’]}, ‘NAIP’);

Answer: I see what you’re saying here. This already looks like a false color composite so that’s good, probably can get redder if you wanted! To answer your other question in conjunction; you are basically changing the bands and their color assignments, in order to get a more saturated image. You can refer to this guide by GEE to get a better idea on what I mean.

Question False-Color Composites: Well after a couple of hours messing around, I finally was able to find a usable satellite image that captures my ROI (albeit a small area within my ROI). First, I figured out how to display the Lake Champlain Basin, using a dataset of watershed boundaries in the US. I have attached the link to the tutorial that I found on that process below.

Then I spent way too much time messing around with various GEE code I found on the internet and trying to adapt it for my ROI. That was unsuccessful because I kept getting errors that I didn’t know how to fix. Also, any Landsat images I was able to find didn’t appear to show anything when they were displayed… Probably too much cloud cover? Finally, I returned to the text book example in F1.3, and adapted the code for the NAIP imagery for my ROI, because it was the highest resolution dataset I know of. See the attached images for my color-IR composite and my true-color composite.

Here are the things I’m still struggling to understand:

  1. I still don’t understand the process of importing images. I feel like I only know about very few of the imagery datasets that are available on GEE, and even if I had a good dataset in mind, I don’t understand the coding language that actually makes the image appear on the map once you hit the import button.
  2. I wish I better understood the methods for filtering the image collections by location, date, cloud cover, etc. All the tutorials that I find on the internet give an example of the code you can use, but it doesn’t explain what each section of code actually does and how you would replicate it.
  3. I’m also still confused on how you generate the false-color composites. I don’t have a grasp on how you write code that assigns different colors to different bands. I only used the example from the textbook for this assignment.

Link to watershed boundary tutorial.

Answer:  You are not the only one who is struggling to understand this material. I can try to shed light here a little but but it’s probably going to be best to have an online session to sort through some of this with you. You can think of the import calls in your GEE script as basically checking out a book from the library. Each time you import a dataset, you’ve taken a book from the stacks in the library and put it on your work table in the library (think one book per dataset import). But in order to get in any information, you’ve got to open the book and read through it, sort through pages, look at pictures, etc. The script in GEE is that table in the library. When you display it on the map it’s like you are looking at the pretty pictures in the book. In order to really understand the content of the book, that’s where you read it. In this case “reading” the book is writing a function or doing some band math or perhaps querying the data contained in the image to derive a new image. This is done in your GEE script (in this metaphor at the table in the library).

The map display in GEE is just looking at the pictures of the book without reading it. It’s simply displaying what’s there as it is without actually manipulating the image. When you are displaying it, you have options for what bands to display, what stretches to apply and what colors to see it with, but this is simply for visualization, the dataset itself is not altered.

Question Cloud cover coding issues from Wk3 submission: In the week 3 assignment, I added in a line of code .sort(“CLOUD_COVER”) – this was based on reviewing the code of others, so I tried adding it in. The code ran, but I couldn’t see any meaningful output.

Q1: How do I view the percentage cloud cover output?

So I removed the line of code and my false color images went from displaying the full extent of the ROI (a defined square area) to a small cutoff of the top right corner. I tried clearing my cache and re-running, but still the same.

Q2: Why is this happening (see image), why is removing a line of (arbitrary) cloud cover code affecting the clip to the defined ROI?

I need your help explaining/resolving these issues, please. I’ve dug through some materials online, particularly the GEE developer guidance, but I can’t find any explanations.

Answer: Can you link me to your code here so I can have a look? Without seeing your code my first thought is that you are somehow only selecting one image, the boundaries of which do not line up with your ROI (i.e. your ROI straddles more than one image). But this is just based on the image only. I am sure we can get to the bottom of it!

Skip to toolbar