Fall 2023 Lab Lecture - https://youtu.be/w_BmOZnBTro
This lab pickups where you left off in Lab 17 - Health Applications Part 1 - Preparing Data for Analysis
If you want to refere to the Lab 17 code you can look here for a completed version of it: https://code.earthengine.google.com/9f6a14b29868b9e4f989a2be61ada2a4
In the previous lab the environmental data obtained from Earth Engine and submitted as CSV files can be used for infectious disease modeling and forecasting. The Earth Engine code was written in support of EPIDEMIA, a software system based in the R language and computing environment for forecasting malaria, and was actively used in certain study pilot woredas in the Amhara region of Ethiopia. The R system consists of an R package—epidemiar—for generic functions and a companion R project for handling all the location-specific data and settings.
One of the main outputs of EPIDEMIA is the forecasted incidence of malaria in each woreda by week from one to eight (or more) weeks in advance. Using our publicly available demo project that uses synthetic data (not for use in epidemiological study), we created forecasts for week 32 of 2018 made eight weeks prior (“knowing” data up to week 24), and also added the observed incidence for comparison. (Note: dates and weeks follow International Organization for Standardization [ISO] standard 8601). These new data can be re-uploaded to Earth Engine for further analyses or exploration. That's were you are picking up at now, post anlaysis in R and ready to keep exploring in GEE.
Objective: The objective of this lab protocol is to create a map visualization of synthetic malaria incidence data for the Amhara region in Ethiopia. The map will show the incidence levels of malaria in different woredas (administrative divisions) within the region, using different colors to represent different incidence levels. The protocol consists of the following steps:
Lab:
-
Start off a new Script. Go to https://code.earthengine.google.com/ signin and start off with a blank script.
-
Import the synthetic malaria data as a Feature Collection using the "ee.FeatureCollection" function and assign it to a variable called "epidemiaResults".
-
// This code displays an interactive map of a region in Ethiopia, and overlays different layers
// to display results of an analysis of synthetic malaria data.
// First, we import a FeatureCollection of synthetic malaria data for the Amhara region of Ethiopia.
var epidemiaResults = ee.FeatureCollection("users/sounny/amhara_pilot_synthetic_2018W32"); -
Filter the Feature Collection to separate the "pilot" woredas (with forecasted incidence data) from the "non-pilot" woredas (without forecasted incidence data) using the "ee.Filter.neq" and "ee.Filter.eq" functions. Assign each group to a new variable called "pilot" and "nonpilot", respectively.
-
// Filter the FeatureCollection to only keep woredas with forecasted values.
var pilot = epidemiaResults.filter(ee.Filter.neq('inc_n_fc', null));
// Filter the FeatureCollection to only keep woredas without forecasted values.
var nonpilot = epidemiaResults.filter(ee.Filter.eq('inc_n_fc', null)); -
Create a new layer for the "pilot" woredas and assign different colors to them based on their forecasted incidence levels using the "ee.Image().byte().paint()" function. Use a color palette that ranges from light to dark shades of red, with each color representing a different incidence level. The incidence levels are defined in incidence per 1000 people and are divided into 5 categories: 1 to 5, where 1 is the lowest incidence level and 5 is the highest. Assign the resulting image to a variable called "fill_fc".
-
// Define an empty image to use for painting color onto each woreda based on forecasted incidence.
var empty = ee.Image().byte();
// Paint the woredas with different colors for forecasted incidence.
// The 'inc_n_fc' property is the forecasted incidence (cut into factors) made on (historical) 2018W24
// (i.e. 8 weeks in advance), and the color for each woreda is based on the range the incidence falls into.
// Incidence per 1000
// 1 : [0 - 0.25)
// 2 : [0.25 - 0.5)
// 3 : [0.5 - 0.75)
// 4 : [0.75 - 1)
// 5 : > 1
var fill_fc = empty.paint({
featureCollection: pilot,
color: 'inc_n_fc',
});
// Define a color palette for the different ranges of incidence.
var palette = ['fee5d9', 'fcae91', 'fb6a4a', 'de2d26', 'a50f15']; -
Add the "fill_fc" layer to the map using the "Map.addLayer()" function. Set the palette, minimum, and maximum values using the "palette", "min", and "max" arguments, respectively. Also, set the name of the layer to "Forecasted Incidence".
-
// Set the map center and zoom level.
Map.setCenter(38, 11.5, 7);
// Add the layer of forecasted incidence to the map, using the color palette defined above.
Map.addLayer(
fill_fc, {
palette: palette,
min: 1,
max: 5
},
'Forecasted Incidence'
); -
Create a new layer for the observed incidence data of the "pilot" woredas using the same color palette as before. Use the "ee.Image().byte().paint()" function to create the layer and assign it to a variable called "fill_obs".
-
// Paint the woredas with different colors for observed incidence.
// The 'inc_n_obs' property is the observed incidence, and the color for each woreda is based on the range the incidence falls into.
// This layer is turned off by default, but can be toggled on and off by the user in the map viewer.
var fill_obs = empty.paint({
featureCollection: pilot,
color: 'inc_n_obs',
});
// Define the same color palette for the observed incidence as for the forecasted incidence.
var palette = ['fee5d9', 'fcae91', 'fb6a4a', 'de2d26', 'a50f15']; -
Add the "fill_obs" layer to the map using the "Map.addLayer()" function. Set the palette, minimum, and maximum values using the "palette", "min", and "max" arguments, respectively. Also, set the name of the layer to "Observed Incidence" and set the default visibility to "false".
-
// Add the layer of observed incidence to the map, using the same color palette as for the forecasted incidence
Map.addLayer(
fill_obs, {
palette: palette,
min: 1,
max: 5
},
'Observed Incidence',
false
); -
Create a gray layer for the "non-pilot" woredas using the "ee.Image().byte().paint()" function and assign it to a variable called "fill_na".
-
// Paint non-study woredas with gray.
var fill_na = empty.paint({
featureCollection: nonpilot
}); -
Add the "fill_na" layer to the map using the "Map.addLayer()" function. Set the palette to "a1a9a8" and set the name of the layer to "Non-study woredas".
-
// Add the layer of non-study woredas to the map, using gray as the fill color.
Map.addLayer(
fill_na, {
palette: 'a1a9a8'
},
'Non-study woredas'
); -
Draw the borders of all the woredas in the Amhara region using the "ee.Image().byte().paint()" function and assign it to a variable called "outline".
-
// Draw borders for ALL Amhara region woredas.
var outline = empty.paint({
featureCollection: epidemiaResults,
color: 1,
width: 1
}); -
Add the "outline" layer to the map using the "Map.addLayer()" function. Set the palette to "000000" and set the name of the layer to "Woredas".
-
// Add woreda boundaries to map.
Map.addLayer(
outline, {
palette: '000000'
},
'Woredas'
); -
Results: The resulting map will show the incidence levels of malaria in different woredas within the Amhara region in Ethiopia. The "pilot" woredas will be colored based on their forecasted incidence levels, while the "non-pilot" woredas will be gray.

-
Share it as a link using the appropriate functions in Google Earth Engine and submit it to canvas.
Lab Submission
Submit lab via email.
Subject: Lab 18 - Health Applications Part 2 - [Your Name]