- 1 Outline
- 2 Introduction to GEE
- 3 GEE Code Editor
- 4 Basics of EE Javascript
- 4.1 Javascript Syntax In General
- 4.2 Variable Declaration
- 4.3 Statements
- 4.4 How to Pass Function Parameters
- 4.5 List Definition
- 4.6 Dictionary Definition
- 4.7 Function Expression
- 4.8 Client vs. Server Objects
- 4.9 Strings
- 4.10
getInfovs.evaluate - 4.11 Lists
- 4.12 Mutable vs. Immutable
- 4.13 Operations With Server Objects
- 4.14
Mapping(what to do instead of afor-loop)
- 5 Spatial and Temporal Reducers
- 6 Time Series Analysis (hands-on)
- 7 Breakout Session (brainstorming)
- 8 Wrapping Up
- 9 Q&A
Eligio Maure
- GEE Introductory Overview ~ 1 h 30 min
- Time Series Analysis (Hands-on) ~ 1 h 10 min
- Wrapping Up ~ 5 min
- Q&A ~
- Google Earth Engine (GEE) - 15 min
- GEE Code Editor - 15 min
- GEE Javascript - 35 min
- Temporal and Spatial Reducers - 25 min
- Get a GMAIL/GOOGLE account
- Sign up for Earth Engine (http://bit.ly/GoogEEngine).
- Registration is needed to have access to EE
- If registered, verify your GEE access though the link below
We assume everyone is registered and have access to GEE
Otherwise, just follow the discussion and try on your own time
- This presentation is available at https://github.com/npec/AWOC2020-GEE-Training
- All participants that updated their GMAIL/GOOGLE were added to the class repository of GEE scripts
- https://code.earthengine.google.com/?accept_repo=users/nwatchs/AWOC2020
The repository will show up in your GEE code editor
- Scripts → Reader
→ users/nwatchs/AWOC2020 (more on this later)
Earth Engine Developer's Page https://developers.google.com/earth-engine

- Guides - JavaScript & Python
- Reference - Client Libraries & Code Editor
- Help & Support
- Data Catalog, etc.
- Please mute your microphone while listening
- Unmute whenever you have a question to ask or post in the comment section
- Please reach out with any questions to maure@npec.or.jp at any time
- Although we introduce EE to the ocean colour community
- We are not going to delve into specifics of ocean colour
- Unless we are advanced GEE users, it won't be practical!
So, let us focus on the foundations of GEE
The most advanced tasks are left for the future
All practical examples use ocean data (chlorophyll, temperature)
| Questions |
|---|
|
| Learning Points |
|---|
|
A cloud-based platform for planetary-scale geospatial analysis
| An interactive environment for development at scale |
|---|
- Fast prototyping & computation
- Easy dissemination of research outputs through GEE Apps
- High-impact & data-driven science
- Free cloud processing with built-in functions optimized for parallel computing
The global distribution and trajectory of tidal flats
Nicholas J. Murray, Stuart R. Phinn, Michael DeWitt, Renata Ferrari, Renee Johnston, Mitchell B. Lyons, Nicholas Clinton, David Thau & Richard A. Fuller
Global Surface Water
https://global-surface-water.appspot.com/map
| Online public data archive$~$ |
|---|
- A petabyte (> 50) storage accessible through GEE APIs
- Unfortunately, ocean colour data repository still very poor
However...
> We can upload own datasets (up to 10 GB)
> Make dataset requests
Flexible access through APIs
Rapid visualization of complex spatial analyses
API → application programming interface
- Great tool for non-specialists to get started - Allows simple data visualization but with limited analysis capabilities - Does not require registration!
| How GEE works |
|---|
| Server-side |
| Written commands can be sent as requests object to Google's cloud for compution |
| Client-side |
| Results sent back can be visualized in the browser |
GEO-GEE License Project: 32 Projects (22 Countries)
Aim to tackle some of the world’s greatest challenges using open Earth data
NPEC is part of a GEO-GEE project (lead, Prof. Joji Ishizaka, Nagoya Univ.)
Global screening of potential eutrophication waters
SGLI 250 m data for mapping of near-coastal waters
Summary
-
GEE is great tool operating on petabyte imagery using Google’s cloud
-
Allows complex analysis and visualizations with basic JavaScript
-
Eliminates most of the hurdles with satellite data analysis
→ e.g., downloading, data formats, etc (not so for ocean colour) -
Easy dissemination of output results through GEE Apps
-
Allows import/export of your own assets
→ raster and vector data, e.g., projected swath or in situ data points -
GEE is changing the way we study and understand the Earth
-
Only works with internet connection
-
Users have no control on how computations are run in GEE
-
Non-parallelizable operations cannot be performed effectively
-
GEE performs poorly for long-running iterative processes
→ e.g. finite element, etc.
| 5 min break (or questions if any) |
|---|
| GEE Code Editor |
| Questions |
|---|
|
| Learning Points |
|---|
|
## Code Editor
Summary
-
The Code Editor provides an easy and abstract way to
-
accessing GEE data catalog as well as personal assets
-
conducting geospatial analysis
-
displaying and sharing the results
-
Provide ways to import, export, share and manage personal assets
-
Example scripts, Docs and help are valuable resources to explore
| Questions |
|---|
|
| Learning Points |
|---|
|
// And, the first thing you do in any programming language:
print('Hello World!')
// Line comments start with two forward slashes. Like this line.
/* Multi-line comments start with a forward slash and a star,
and end with a star and a forward slash. */// variables store objects and are defined using the keyword var
var thisNumber = 1;
// string objects start and end with a single quote
var thisString = 'I am a string';
// string objects can also use double quotes
// But don't mix the two
var thatString = "I am a string";// statements end with a semi-colon, or the editor will complain
var feelsIncomplete = "I feel incomplete..."
var feelsComplete = "I feel complete!";// use parentheses to pass parameters to functions
print('This string will print in the Console tab.');
/* square brackets are used for items in a list
The zero index refers to the first item in a list*/
var myList = ['eggplant','apple','wheat'];
print(myList[0]); // prints eggplant
print(myList[3]); // prints undefined/* Use curly brackets (or braces) to define dictionaries
{key:value} pairs. */
var myDict = {'food':'bread', 'color':"red", 'number':42};
// Use square brackets to access dictionary items by key
print(myDict['color']);
//Or use the dot notation to get the same result
print(myDict.color);/*function can be defined as a way to reuse
code and make it easier to read*/
var myHelloFunction = function(string) {
return 'Hello ' + string + '!';
};
print(myHelloFunction('world'));- Everything we saw so far lives in the browser (client-side)
- Client-side useful, for example, when making EE user interfaces
- Server-side objects are proxy objects and start with
ee
→ Server-side (proxy) objects are just handles for objects on the server
var clientString = 'I am a String';
print(typeof clientString); // string
var serverString = ee.String('I am not a String!');
print(typeof serverString); // object
print('Is this an EE object?',
serverString instanceof ee.ComputedObject); // true
/* Observe that "serverString" is an "object",
more specifically, "ee.computedObject" *//* Client doesn't know what's in the container,
so we can find out by printing it */
print(serverString); // I am not a String
/* To see what the container itself looks like,
call toString() on the object: */
print(serverString.toString());
// ee.String("I am not a String!")/* we can get the contents of the container
and assign them to a variable */
var someString = serverString.getInfo();
var strings = someString + ' Am I?';
print(strings); // I am not a String! Am I?
/* getInfo() is synchronous, thus it blocks code execution,
so should avoid using it unless absolutely needed */var something = ee.thing.getInfo(); // synchronous call
// A good way to request a value of the server object is to use
// evaluate() - this call is asynchronous
ee.Number(7).evaluate(function(n) {
var clientNum = n + 3;
print('Should be 10. Found ' + clientNum);
});// This exists in the browser
var clientList = [0, 1, 2, 3, 4, 5, 6, 7];
print(clientList);
// This is a handle for some object on the cloud
var serverList = ee.List(clientList);
print(serverList); // They look the same!
var anotherList = ee.List.sequence(0, 7);
print(anotherList); // Also the same!// Client-side objects are mutable
clientList.push(8);
print(clientList);
// However, the same won't work on the server list
// serverList.push(8); // Error!
var longerList = serverList.add(8);
// Use docs tab to discover methods on server objects// A constant Image
var constantImage = ee.Image(7);
// This is NOT what we want:
var junkString = constantImage + 42;
/* Note that the browser calls toString() on the object and
then appends '42' to it. The JSON you see contains the
instructions sent to the server to execute your code */
print('JunkString:', junkString);// This is the right way:
var someImage = constantImage.add(42);
// Click with the inspector to observe
Map.addLayer(someImage, {}, 'someImage')- In EE we use
map()instead offor-loops - This is key to making EE work
for-loopsmay still be useful for client-side (user interfaces)- However, server-side is best served with
map
.map(...) vs. for(...)
Summary
- In EE computations are parallel (
mapinstead offor) .getInfo()can cause browser lock (.evaluateinstead)- Mixing client and server functions can cause errors
- Cast client into server objects using the
ee.Thingconstructor
e.g., ee.List([1, 2]), etc. - Server-side objects are immutable. Save changes in a new object
- i.e., assign the changes to a new variable
e.g., var newImage = oldImage.add(3)| Additional JavaScript Resources |
|---|
Reduce - Aggregate everything in a collection
reducer - an EE operation for aggregating data or computing a statistic
Apply a reducer over an image with several bands
Time Series Analysis (hands-on)
- Temporal and Spatial Reducers (Recap) - 10 min
- Time Series Analysis (By Point or Region) - 25 min
- Interactive Time Series Analysis (User Interface) - 30 min
- Q&A
| Questions |
|---|
|
| Learning Points |
|---|
|
- Introductory Overview to GEE
- GEE Code Editor: How to navigate the code editor
- Basics JavaScript: What is client-side and server-side
- Spatial and Temporal Reducers: aggregate space-time data
- Image Regions Charts: How to create a plot of image bands
- Time Series: How to do a simple time series plot
Code Editor: Where you go to write code.
- This is the best tools for development
- Also, check Help (?) inside the Code Editor, it provides links to useful pages
Data Catalogue: Details on the available datasets
- Ocean colour datasets are still in their infancy (far behind land-group)
- By building a strong (or larger) community progress can be achieved relaively faster
Developers Guide: the closest thing to a manual
- Other than documentation, this provides useful links to many other resources
Developers Forum: Where you go to post questions
- If you plan on using GEE, it is advisable to join the EE Forum
- When posting questions in this forum, include a link to your script for others to help you troubleshoot more easily
- Code sharing
- Any private asset in the shared script is only accessible to those allowed of if it is puclic
- Debugging Guide
- Earth Engine EDU
- Some materials have also been translated to Japanese
- GeoHackWeek











