Both of the two exercises completed in this lab were retrieved from sections F1.0 and F1.1 of the working manuscript titled, "Cloud-Based Remote Sensing with Google Earth Engine: Fundamentals and Applications" edited by Cardille, Clinton, Crowley and Saah. Their goals are to create and familiarize the user with the Code Editor window of the Google Earth Engine Application Programming Interface (API) while learning about JavaScript syntax and the functions available to the user. The second exercise takes a more specific look at image composition and colouring from satellite imagery and how these images can be extracted, manipulated and refined for insights.
The Earth Engine API makes it possible for users to use vast cloud-hosted datasets and perform in depth and high scaled calculations to these datasets at rapid speeds since it utilizes the capacities of many servers. The interface serves as a straightforward platform for its users functioning as a "Question to Answer" platform allowing even first-time coders to use it. Although many coding languages can be used to communicate with Earth Engine, the JavaScript Editor can be used completely online without requiring any installations. It also permits the user to save all of their projects on the cloud and share their work to collaborate with others.
The exercise goes through a list of JavaScript commands that can be useful in the Earth Engine. The commands are written in the "New Script" window and the results can be seen in the "Console" window on its right hand side after the "Run" operator is clicked. This can then be saved by using the save button and organized into a personalized user "home folder" which is forever unique to the account where all the work can be saved. The image below shows the test run of printing the phrase "Hello World" in the Console window. This has been saved to a home folder titled "trumpler.keli" within a repository titled "default" within a file titled "Hello_World" as seen in the upper left corner of the image.
Figure 1. Saving and filing a practice run of code.
In this section of the lab, the concepts of variables, lists, objects, functions, and comments were introduced and visualized using the editor. Variables store data values whether numerical in nature or a string. They can be visualized in the Console window by using the print command. Multiple values can also be stored in a single variable and displayed in a list format that assigns an index number to each item in the list enabling simpler manipulation and referencing of the items. Objects can be used to store key to value pairs within a variable. These values can then be retrieved by referencing their associated key. How to define variables in the methods mentioned above can be seen in figure 2 below.
Figure 2. Various ways to create variables in Earth Engine.
Functions in Earth Engine can manipulate an input performing various operations and then return an answer to the user. They are structured as seen in figure 3 below. Furthermore, comments can be placed within the code for explanation or organization purposes by preceding text with two slashes "//". This can also be seen in figure 3 below at the bottom of the image.
Figure 3. Example of the use of a simple function in Earth Engine.
The Earth Engine has programed functions found in the Docs tab that can perform simple to advanced computations and image processing without needing to code directly in JavaScript. They are classified by group of processes such as image, number, date, and algorithms for example.
Figure 4. Various functions available in Earth Engine to perform tasks including addition, making lists and combining strings into one word.
Detailed satellite imagery is at the users disposition in Earth Engine. These images can be manipulated and components can be extracted to understand more about the image being observed. This section explores some methods available to the user to explore images.
By using the ee.Image function, satellite imagery from various satellites at specific dates can be retrieved. These images are represented in raster form and within the bands section of the data, the bands are labeled and their dimensions are provided. An example is provided in the image below. The first three bands listed for the image measure the quantity of blue, green and red light while the second set of three measure infrared light. Earth Engine Catalog can show more details about the image data.
Figure 5. Metadata of image captured by the Landsat 5 satellite on June 6, 2000.
Figure 6 shows the use of the addLayer tool to visualize the map layer. In this case, the band "SR_B3" was shown from a range of 8000 (black) to 17000 (white). The "Inspector" tool can then be used to select specific locations on the layer and reveal information about them such as longitude, latitude, zoom level, scale, pixel for specific band values, and source of the data.
Other layers can be added with varying opacities (0 being transparent and 1 being opaque) and can be hidden or revealed (0 being not shown and 1 being shown). The code formatting of this is shown in the code present in figure 6. These can be overwritten by modifying the layer display and opacity using the "Layers" tool above the map as shown in figure 6.
Figure 6. Exploring the layers feature with image captured by the Landsat 5 satellite on June 6, 2000.
True-colour composite or natural-colour composite pairs the B1 with blue, the B2 with green and the B3 with red since this is the correspondence of the Landsat 5 satellite. The rendered image is seen in figure 7. False-colour composites such as infrared and shortwave infrared images can also be useful at distinguishing environmental conditions such as indicating crop health or distinguishing deciduous from coniferous forests. These can be made by mixing the three bands which are not part of the visible spectrum with selected bands of the visible spectrum which also consists of three bands. They also result in higher contrast images than the true-colour image would. The red colour in figure 8 shows what components of the map reflects more near infrared light . As the colours approach black, it signifies that the band numbers are low for all bands being observed. The shortwave infrared false-colour map in figure 9 shows a higher distinction of land use practices such as agricultural fields than the near-infrared image.
Figure 7. Natural colour image.
Figure 8. Near infrared colour image.
Figure 9. Shortwave infrared colour image.
The Digital Number of pixels (DN) or the value of the pixel determines the colour that the pixel will be tinted. For instance if it is higher in the blue band than the red and green then the pixel will appear blue. The intensity of colour will change depending on the relative difference in band weights. This concept can be used for sorting, classifying, and manipulating data. When the band weights of two colours are larger than another, the pixel will appear to be the mixed or additive colour of the two dominant ones ( green and red make yellow, red and blue make magenta, and green and blue make cyan). Furthermore, if all colours are weighted equal than the pixel will appear white and if all colours are absent, then it will appear black.
Certain more abstract attributes of geographic locations can be selected and searched for by using the additive colour system on other bands. The figure 10 below demonstrated how the average artificial nighttime light brightness for the year 1993 across the globe can be retrieved. Anomalies from various sources such as wildfires, cloud interruptions and lightning have been removed.
Figure 10. Average artificial nighttime light brightness for 1993
To compare stable nighttime lights at three different times, the stable_light band for each image must be relabeled to differentiate between the time periods. That is done by using the "rename" function after retrieving the image and selecting the band from the image. Then, a new image is named as "changeImage" which uses the "addBands" function to integrate the images from the three time periods into one. This integration can be seen in the console windown by viewing the three bands of the new image with 2013 as red, 2003 as green, and 1993 as blue. It is shown in figure 11 below.
Figure 11. Average artificial nighttime light brightness for 2013 as red, 2003 as green, and 1993 as blue.
A lot of useful information can be extracted from imagery like this. For instance, it can demonstrate where there have been high levels of urbanization or development in more recent times. In this case, the red light would dominate the image as more light would have been emitted in 2013 than in previous years. Yellow areas represent regions that were bright in 2013 and 2003 but not in 1993. Further, major cities will appear white as they have high levels of all coloured light since they have been high emitters each year. It can also indicate signs of resource extraction that require large quantities of light. By combining this information with the satellite base layer and textual information from the internet, a lot can be deduced as to what types of activities are going on at the bright locations.
1. Compare and contrast the changes in nighttime lights around Damascus, Syria versus Amman, Jordan. How are the colors for the two cities similar and different? How do you interpret the differences?
The white center of both cities demonstrates that they are urbanized cities that have been urbanized during the three decades. The cyan and green tones in Damascus especially toward the south east side signifies that there was more lights in 1993 and 2003 than in 2013. There are small bits of red or yellow tones in the upper left corner perhaps suggesting a slight migration to the north west side of the city in 2013. The Syrian Civil War beginning in 2011 and causing many people to flee from their homes is likely a driving contributor to the lessened light/population in Damascus in 2013 compared to the 2003 and 1993. For Amman, Jordan, the situation is the reverse. The red and yellow tones show a higher night light than in 1993. Since the red dominates, it is clear that 2013 had a more dominant amount of people living there than 2003. This can be predominantly attributed to the refugee crisis from neighboring countries like Syria. Many people sought refuge in Amman, Jordan. The light is more highly concentrated in the city center and we can see that a lot of space around the city is dark. Due to the high resource concentration in the city, it makes sense for refugees to have settled there.
Figure 12. Nighttime light changes in Damascus, Syria (2013, 2003, 1993).
Figure 13. Nighttime light changes in Amman, Jordan (2013, 2003, 1993).
2. Look at the changes in nighttime lights in the region of Port Harcourt, Nigeria. What kinds of changes do you think these colors signify? What clues in the satellite basemap can you see to confirm your interpretation?
The white colour on the map can be associated with the city center that emitted lights as it was urbanized during all three decades. Then we can see a bunch of different colours surrounding the city. On the bottom left of the image we see a large blue spot. This appears to be in line with a major river seen in the base map. Since the city is a port city, perhaps they were using that body of water in 1993 as their main transaction site. This appeared to be abandoned by 2003 as the site moved to the region represented by the cyan colour in the lower center of the map. Lastly in 2013 and 2003, and a bit of 1993, we can see there was a activity in the largest lake seen in the base map on the lower right side. It appears that boats were always working in this area. It is also possible that activities could have involved resource extraction in these bodies of water rather than solely exchanges of goods at the port city.
Figure 14. Nighttime light changes in Port Harcourt, Nigeria (2013, 2003, 1993).
Figure 15. Base map of Port Harcourt, Nigeria (2013, 2003, 1993).
3. In the nighttime lights change composite, we did not specify the three bands to use for our RGB composite. How do you think Earth Engine chose the three bands to display? How do you think Earth Engine determined which band should be shown with Red, Blue, and Green channels?
When uploading a Landsat image, the Earth Engine will associate the bands specified by the user in a RGB sequence. This means that the first band specified will show as red, the second one will be green and the third will be blue. Since we did not pull specific bands from the light images, the Engine associated each colour with the order that the images were called in. The following code was used with the addBands function. As can be seen below, the lights13 meaning from 2013 were defined first and thus associated with the red band, then the lights03 were associated with green, then the lights93 were associated with blue.
var changeImage = lights13.addBands(lights03)
.addBands(lights93.select('stable_lights').rename('1993'));
4. Create a new script to make three composites (natural color, near infrared false color, and shortwave infrared false color composites) for this image:
‘'LANDSAT/LT05/C02/T1_L2/LT05_022039_20050907'.
What environmental event do you think the images show? Compare and contrast the natural and false color composites. What do the false color composites help you see that are more difficult to decipher in the natural color composite?
The code used for loading the Landsat image and applying coloured layers to it in all three colour schemes can be seen in figure 16. These images show the aftermath of hurricane Katrina on New Orleans in 2005. We can decipher this from the images and the information that we have about the data source. We know from the file that we load that we are looking at satellite data from September 7th in 2005. Right away when I added the layers to the map and saw that the images were of New Orleans I thought that the environmental event could be a hurricane since they are common in that area. The satellite images shown below along with the date of the image, confirm that these images show the aftermath effects of hurricane Katrina. The false colour images allow the viewer to see the high contrast of regions that were not flooded (bright red and bright green/yellow) with the flooded regions (more muted dark tones). The natural colour image makes it much more difficult to see. The false colour images also clearly show the enlarged/flooded riverways whose regular size can be seen as much smaller in the base map layer.
Figure 16. Earth Engine code for applying natural and false colour to a satellite image.
Figure 17. Base map, natural colour, false colour and short wave false colour maps of Louisiana in September 2005.
5. Create a new script and run this code:
var image = ee.Image('LANDSAT/LT05/C02/T1_L2/LT05_118038_20000606');
Map.addLayer(
image,
{
bands: ['SR_B1'],
min: 8000,
max: 17000
},
"Layer 1"
);
Map.addLayer(
image.select('SR_B1'),
{
min: 8000,
max: 17000
},
"Layer 2"
);
Inspect Layer 1 and Layer 2 with the Inspector Panel. Please describe how the two layers differ and explain why they differ.
Figure 18. Investigating two function methods of creating layers.
The two images look identical. The first layer contains all of the original data within the picture but only displays the 1rst band. The second layer extracts the 1rst band from the original image and creates a new one. This deletes all the other data that was originally associate with the image. In figure 22, it can be seen that there is still 19 elements making up the bands within Layer 1 yet only one element making up the bands within Layer 2.
The code used it what dictates what the images show. The code "image.select('SR_B1')," is what makes the difference and extracts and displays only the 1rst band in Layer 2.
Various processes and manipulation of data can be performed on Earth Engine with little to no prior knowledge of JavaScript. The engine has many programed functions which are easy to find and implement into the users code to do simple to complex tasks. There are also many ways that the bands of satellite images can be extracted and manipulated to be able to extract more information from them. This can provide a lot of useful data to the user. Further, the contents of the image are readily available to the user in the console and inspector panel.