Exploring the Code editor

An exercise for beginners

Step 1: open the code editor by going to https://code.earthengine.google.com/

Step 2: import the sentinel 2 image collection by following the steps below:

Tip!: you can also use the line below to import your sentinel 2 image collection

var sentinel2 = ee.ImageCollection("COPERNICUS/S2");

Step 3: import your administrative area:

var bnd_cambodia = ee.FeatureCollection("projects/servir-mekong/referenceData/cam_adm");

Step 4: create 2 mosaics, 1 for the dry season and 1 for the wet season in 2019. Use the months jan – april for the dry season, the months jun – oct for the wet season. Make sure you sort the image collection based on cloud cover and clip the mosiac.

Tip! use the functions: .filterDate() .filterBounds() .sort() .mosaic() .clip()

Step 5: use the .normalizedDifference([“band1”,”band2”) function to calculate the Normalized Difference Water Index (NDWI). Replace the “band1” and “band2” with the relevant bands:

Tip: you can find the band designations in the “BANDS” tab

Step 6: show the RGB imagery of the Dry and Wet season and the NDWI maps you created.

Find the full code here:

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s