mamenarguez@ou.edu
Remote Sensing Archive: Petabytes merged in one location https://earthengine.google.org/#index
Distributed computational power: one million CPU hours in a few days http://earthenginepartners.appspot.com/science-2013-global-forest
Server side programming: we don't need to store data and the CPU power is provided by their cluster
Results from time-series analysis of 654,178 Landsat images in characterizing forest extent and change, 2000–2012.
HPC Computing clusters
(Thousands of CPUs)
HPC Storage clusters
(Petabytes of data)
Divides data in independent grids
Merges all grid calculations
Interactive Landsat timelapse of deforestation of the Amazon rainforest, 1984-2012.
Interactive Landsat timelapse of the drying of the Aral Sea, 1984-2012
Interactive Landsat timelapse of deforestation of the Amazon rainforest, 1984-2012.
Interactive Landsat timelapse of the drying of the Aral Sea, 1984-2012
MOD09A1 (surface reflectance 500m) rgb(B4,B3,B1) 2010 aggregated removing clouds using median.
Graphical User Interface https://earthengine.google.org/#workspace
Easy to use
Fast classifications from selectable points polygons
Good for non-programmers
Does not exploit full GEE power (Restricted actions allowed).
Does not allow to map functions at the pixel level.
Pros:
Cons:
Coding User Interface https://ee-api.appspot.com/
Pros:
Visual User Interface capabilities + anything you can code in Python or JavaScript
Can create batch tasks and download their results once they are done
Cons:
Requires JavaScript or python knowledge
Need to learn how to use GEE objects and their functions
Server side programming may limit some functionalities
Nighttime lights from DMSP (linear fit) from 1991 to 2013 code here
Coding User Interface https://ee-api.appspot.com/
Saved Scripts
Documentation
Coding console
Inspector
Output console
List of batch tasks
Map
Nighttime lights from DMSP from 1991 to 2013 (code here)
Executes in order
var a = 3;
a = 4;
console.log(a)
Prints 4
Be careful with upper and lower characters!
Case sensitive
var myVariable = "I am a String";
console.log(myvariable);
Uncaught ReferenceError: myvariable is not defined
How should I call you? I got it! asdsd... right?
Methods, variables and properties start with lowercase and the first letter of each word is Capitalized
// Do not worry about how to write functions, nor define variables, just look at the naming!
var myFunctionName = function(){}
var myVariableNameIsUpperCased = "I am a cool and correct variable name";
var my_variable_name_bad_notation= "I will work..."
+ "but I should not be written in this way. Are you a python programmer?";
Naming: "Camel-back" style.
Be careful with upper and lower characters!
Whitespaces
var myVariable = "I am a variable defined with spaces between var and my name";
var test= " will I print three spaces"
console.log(test);
Prints: ' will I print three spaces'
Ignores them when there are more than 1 spaces
- I forgot a semicolon, are you mad at me JavaScript?
Statements
var one=1,two=2,three=3;
one=1
two=2;
three=3
Careful! Statement will continue if there is no semicolon and the next line compiles as part of the previous one.
End with semicolon or a line break
var multiLineString = "line1"
+" line2"
+ " line3"
console.log(multiLineString )
Prints: line1 line2 line3
- No, I will get over it...
Defining & Assigning:
var stringVariable = "I can have any text!"
var integerVariable, otherVar
integerVariable = 2
var VariableName [= value] [, Variable2Name [= value]]
[ ] means optional
JavaScript is dynamically (weakly) typed... Great! like python or R!
This means that the type is determined when assigned
var stringVariable = "I can have any text!"
var integerVariable = 1
stringVariable = integerVariable
console.log(stringVariable)
That is crazy! my stringVariable now contains an integer!
Lesson: Never name variables after its type if they are dynamicly changing
Prints: 1
var booleanVariable = true //String assigned using a Boolean literal (true / false)
var stringVariable = "I can have any text!" // String assigned using a String literal
var numericVariable = 3.14159265359 // Number assigned using a numerical literal
var arrayWithInitialValues=["val1",numericVariable ] //Array assigned using an array literal
var x = {firstName:"John", lastName:"Doe"}; // Object assigned by an object literal
1: Boolean 2: String 3: Number 4: Array 5: Object
var stringVariable = "I can have any text!" //variable definition and initialization
console.log(stringVariable.length) // Prints '20'
stringVariable = stringVariable + " I am appending this" //String concatenation
console.log(stringVariable) //prints 'I can have any text! I am appending this'
var apples = 5, pears = 10;
var piecesOfFruit = apples + pears;
console.log(piecesOfFruit ) //Prints 15
Basic operators: + - / *
var a = (10 + 2) / 2 + 4 * 2
console.log(a) // What will I print?
(10 + 2) / 2 + 4 * 2 = 12 / 2 + 4 * 2
12 / 2 + 4 * 2 = 6 + 4 * 2
6 + 4 * 2 = 6 + 8
6 + 8 = 14
Careful! Operator precedence matters
Assignment operators: = += -= *= /= %=
var emptyArray=[]
var myArray = [1,4,9]
var myArray2 = ["phrases are okay", false, 3.14159, 6, "x**2"] //Can have different variable types
var myArray3 = new Array() // {undefined length, empty}
var mayArray4 = new Array(5) // {5-item array, empty}.
console.log(myArray2[2])
var jedi = {
name: "Yoda",
age: 899,
isCool: true
};
console.log(jedi.name+jedi.age)
console.log(jedi.isCool)
Yoda899
true
var myObject = {
propertyName1: value,
propertyName2: value,
...
};
Careful! Arrays start indexing at 0, not 1!
3.14159
prints -5
Math.random(); // returns a random number
Math.min(0, 150, 30, 20, -8); // returns -8
Math.round(4.7); // returns 5
Math.round(4.4); // returns 4
Math.ceil(4.4); // returns 5
Math.floor(4.4); // returns 4
Math.E; // returns Euler's number
Math.PI // returns PI
Math.SQRT2 // returns the square root of 2
Math.SQRT1_2 // returns the square root of 1/2
Math.LN2 // returns the natural logarithm of 2
Math.LN10 // returns the natural logarithm of 10
Math.LOG2E // returns base 2 logarithm of E
Math.LOG10E // returns base 10 logarithm of E
//Math.sin() Math.cos() ... Math.abs()
// NOW A QUESTION FOR YOU
console.log(Math.abs(Math.floor(-4.5))) // What should I return?
! NOT
|| OR
&& AND
== Equal value
!= Different value
=== Equal value and type
!== Different value or type
< Smaller than
> Greater than
>= Greater or equal than
<= Smaller or equal than
var a = 5
var b = '5'
console.log(a==b)
console.log(a===b)
console.log(a!=b)
console.log(a!==b || !(a===b))
true
false
false
true
What will this print?
& AND
| OR
~ NOT
^ XOR
<< Left shift
>> Right shift
var a = 9 // 1001
var b = 3 // 0011
var c = 8 // 1000
console.log(~a)
console.log(a|b)
console.log(a>>2)
-10 // Note a = 1111......0110 Negative
11 // 1001 OR 0011 = 1011 = 11
2
What will this print?
Warning! JavaScript uses 32-bit signed numbers
if (condition) {
code...
}else{
code ...
}
var a = 9
var b = 3
if (a>b){
console.log("a greater than b")
} else if (a<b){
console.log("b greater than a")
} else {
console.log("a equals b")
}
A greater than b
What will this print?
Advice! ifs can be nested
if (1==0){
if (2==2){
console.log(2)
}else{
console.log(1)
}
}
What will this print?
Nothing!
for (variable=initial_val; condition; increment of var) {
code...
}
for (var i=0; i<5; i++){
if (i%2){ //true=1;false= 0
console.log(i)
}
}
1
3
What will this print?
function name(param1,param2,...){
code
return x;
}
function sayMessage(message){
alert(message)
}
sayMessage("This function is cool")
var name = function (param1,param2,...){
code
return x;
}
var sayMessage=function(message){
alert(message)
}
var newVariable = {} //Initialize object variable
newVariable.myFunction = sayMessage //Create property myFunction and assign it our function
newVariable.myFunction("This function is cool")
Really?
Not really... We just got the basics, but will be more than enough to use Google Earth Engine!
In fact, you may not use everything, but it is good to know in case you will need it someday!
Remember... if you do not know how to do something... Google it!