2. Time-series analysis
Objective
The objective of today's session is to provide you with the critical skills needed to analyze image collections. In optical image processing, cloud masking is an important first step. Based on this pre-processing operation, we can create data statistics, visualizations and analysis.
Cloud masking
Reliable identification of clouds is necessary for many types of optical remote sensing image analysis.
Landsat
Landsat, a joint program of the USGS and NASA, has been observing the Earth continuously from 1972 through the present day. Today the Landsat satellites image the entire Earth's surface at a 30-meter resolution about once every two weeks, including multispectral and thermal data.
Simple cloud score
For scoring Landsat pixels by their relative cloudiness, Earth Engine provides a rudimentary cloud scoring algorithm in the ee.Algorithms.Landsat.simpleCloudScore()
method. (For details on the implementation, see this Code Editor sample script). The following example uses the cloud scoring algorithm to mask clouds in a Landsat 8 image:
If you run this example in the Code Editor, try toggling the visibility of the TOA layers to compare the difference between the masked and unmasked imagery. Observe that the input to simpleCloudScore()
is a single Landsat TOA scene. Also note that simpleCloudScore()
adds a band called ‘cloud’
to the input image. The cloud band contains the cloud score from 0 (not cloudy) to 100 (most cloudy). The previous example uses an arbitrary threshold (20) on the cloud score to mask cloudy pixels.
We can use this algorithm to wrap it into a function and map it over a Landsat image collection.
Fmask
The ImageCollection Landsat 8 Surface Reflectance Tier 1 have been atmospherically corrected using LaSRC and includes a cloud, shadow, water and snow mask produced using CFMASK, as well as a per-pixel saturation mask.
MODIS
The MODIS (Moderate Resolution Imaging Spectroradiometer) program offers a large collection of Earth observation products. The foundation for many of these derivatives is the MODIS Surface Reflectance product MOD09GA. The MODIS Surface Reflectance products provide an estimate of the surface spectral reflectance as it would be measured at ground level in the absence of atmospheric scattering or absorption. Low-level data are corrected for atmospheric gases and aerosols. MOD09GA version 6 provides bands 1-7 in a daily gridded L2G product in the sinusoidal projection, including 500m reflectance values and 1km observation and geolocation statistics.
Playtime
Task: Find the sunniest place on Earth [make us of ee.Image.pixelLonLat() and reduceRegion()].
Sentinel-2
Sentinel-2 is a wide-swath, high-resolution, multi-spectral imaging mission supporting Copernicus Land Monitoring studies, including the monitoring of vegetation, soil and water cover, as well as observation of inland waterways and coastal areas.
Cloud probability
The S2 cloud probability is created with the sentinel2-cloud-detector library (using LightGBM). All bands are upsampled using bilinear interpolation to 10m resolution before the gradient boost base algorithm is applied. The resulting 0..1
floating point probability is scaled to 0..100
and stored as a UINT8. Areas missing any or all of the bands are masked out. Higher values are more likely to be clouds or highly reflective surfaces (e.g. roof tops or snow).
Cloud Score+
Cloud Score+ is a quality assessment (QA) processor for medium-to-high resolution optical satellite imagery. It includes two QA bands, "cs" and "cs_cdf", that both grade the usability of individual pixels with respect to surface visibility on a continuous scale between 0 and 1, where 0 represents "not clear" (occluded), while 1 represents "clear" (unoccluded) observations. For more information about the Cloud Score+ dataset and modelling approach, see this Medium post.
Cloud Score+ not only masks clouds, it also helps detect cloud shadows. The script below additionally detects and masks cloud shadows using clouds and solar shading geometry.
Open in Code Editor (Sentinel-2 cloud and cloud shadow masking using Cloud Score+)
Cloud displacement
The Cloud Displacement Index (CDI) makes use of the three highly correlated near infrared bands of Sentinel-2 that are observed with different view angles. Hence, elevated objects like clouds are observed under a parallax and can be reliably separated from bright ground objects.
Open in Code Editor (Sentinel-2 cloud displacement index)
Data availability
Before you start any study, you should verify what kind of data is available for your purposes. Here is one script for Landsat 4, 5, 7, 8 and 9 data that indicates for a given area and time span the average per-pixel revisit time and average number of observation per satellite:
Open Code in Editor (Landsat data availability in Space)
Open Code in Editor (Landsat data availability in Time)
The same principle can be applied to other satellites, such as Sentinel-1 or Sentinel-2.
Open Code in Editor (Sentinel-1 data availability)
Open Code in Editor (Sentinel-2 data availability)
Playtime
Task: Navigate to a location of interest and find out more about Landsat and Sentinel data availability.
Forest monitoring
Forests around the world are in crisis. Rapidly expanding global human footprint and climate change have caused extensive deforestation, and have left remnant forests fragmented and significantly altered in condition. Yet, these remaining forests harbour a dazzling array of unique ecosystems and an overwhelming majority of our planet’s current terrestrial biodiversity, thanks to in-situ conservation efforts including those by local and indigenous communities. Valuing these forests and ensuring their continued conservation depends on our understanding their long term dynamics and responses to dominant anthropogenic and climatic drivers. These scripts illustrates the use of Earth Engine to investigate forest vegetation condition over time.
Vegetation indices
Remotely sensed indices such as enhanced vegetation index (EVI), normalized difference vegetation index (NDVI), normalized burn ratio (NBR) and normalized difference water index (NDWI) are widely used to estimate vegetation status from satellite imagery. EVI and NDVI estimate vegetation chlorophyll content while the NBR estimates the severity of fires and the NDWI estimates vegetation moisture content. These indices can be derived from Landsat and other satellites with similar spectral settings. The following script illustrates the combined use of Landsat 5, 7 and 8 for time-series analysis of these indices in forest areas.
Open in Code Editor (Landsat vegetation indices time series)
Task: In 2003 one of the largest forest fires in recent history (in Switzerland) occurred close to Leuk (7.651, 46.333) in Valais. Investigate based on available Landsat data how many years it took for the vegetation to recover to the pre-event level.
Trend analysis
To infer vegetation conditions, we infer a linear trend at each pixel by calculating its Sen's slope of maximum summer EVI with time. For this analysis we use the MODIS 250m/pixel 16-day composite vegetation indices dataset and build an image collection with an image for each year from 2000 to 2020. Each of these images is calculated to be the mean EVI in the summer months of its corresponding year. This value is our measure of the status of the vegetation for each year. Furthermore, we add the year as a band, in preparation for linear trend analysis. As a result, we can infer the pixel-wise vegetation greening or browning based on the sign of the slope value. Finally, we visualize results in forest areas and calculate summarizing stats for our area of interest.
Open in Code Editor (MODIS EVI trends using Sens Slope)
Task: Check out the vegetation trends in you area of interest.
Climatologies
Information on climatic conditions is essential to many applications in environmental and ecological sciences. Working with remote sensing images is a global endeavor. Using climatological information helps to better understand local conditions in remote areas. The attached script provides information on precipitation, cloud cover, air temperatures, snow cover and vegetation cover.
Open in Code Editor (Script to derive climatologies)
Task: Derive climatological information of your favorite area of interest.
Thumbnails
The getVideoThumbURL()
function generates an animation from all images in an ImageCollection
where each image represents a frame. The general workflow for producing an animation is as follows:
Define a
Geometry
whose bounds determine the regional extent of the animation.Define an
ImageCollection
.Consider image visualization: either map an image visualization function over the collection or add image visualization arguments to the set of animation arguments.
Define animation arguments and call the
getVideoThumbURL
method.
The result of getVideoThumbURL
is a URL. Print the URL to the console and click it to start Earth Engine servers generating the animation on-the-fly in a new browser tab. Alternatively, view the animation in the Code Editor console by calling the ui.Thumbnail
function on the collection and its corresponding animation arguments. Upon rendering, the animation is available for downloading by right clicking on it and selecting appropriate options from its context menu.
The following example illustrates generating an animation depicting global temperatures over the course of 24 hours. Note that this example includes visualization arguments along with animation arguments, as opposed to first mapping a visualization function over the ImageCollection
. Upon running this script, an animation similar to the Figure below should appear in the Code Editor console.
Playtime
Task: Use the "ECMWF/ERA5/MONTHLY" dataset to animate annual temperature variations.
The following sections describe how to use clipping and layer compositing to enhance visualizations by adding polygon borders and comparing images within a collection.
Multiple images can be overlaid using the blend
Image
method where overlapping pixels from two images are blended based on their masks (opacity). Multiple images can be overlaid using the blend
Image
method where overlapping pixels from two images are blended based on their masks (opacity). Vector data (Features
) are drawn to images by applying the paint
method. Features can be painted to an existing image, but the better practice is to paint them to a blank image, style it, and then blend the result with other styled image layers. You can also blend image data with a hillshade base layer to indicate terrain and give the visualization some depth.
Open in Code Editor (Thumbnails - Temperature Overlay)
... and here comes another blended animation of cumulative precipitation in the Indus catchment from 14.07.2022 to 30.08.2022.
Open in Code Editor (Thumbnails - Precipitation Overlay)
... and here a "cool" example from the Panmah Glacier in the Karakorum featuring cloud-filtered annual Sentinel-2 composites with minimum snow cover between 2017 and 2023.
Assignment
Select one of the following topics dealing with time series analysis or define your own topic according to your interests. Your results should be summarized in one plot/chart that features time on the x-axis. This exercise is meant to apply and deepen the knowledge and skills you have acquired so far. You can work in groups of two or three, or individually.
Last updated
Was this helpful?