Hey, everybody.
Welcome to the first code tutorial for Google Earth Engine.
This week I'm just going to give you
a sort of geography lesson of this platform.
Explain all the little tabs
and what they mean, right?
A very minimal amount of things and the script editor.
Will do a lot more next week.
But I think it's important just to sort of
get an understanding of everything that's here first.
So all of you should have access to Google Earth Engine.
I recommend opening up your code editor
so that you can see it
and sort of look at your screen while I am on mine.
And I'm just gonna go from like left to right
and explain each of these tabs
and give a little bit of helpful background information.
So starting with Scripts,
this is where all of your script files will go.
So when you write code,
like document one or more realistically
it would be like //homework for module one.
And then you would write all of your code down here.
So this is a file that you would probably wanna save
and put in a folder for organization.
So you can just start writing your script and then save it.
And then it'll ask you where do you wanna save it?
Another way if you want to...
I don't know be a little bit more organized,
is you can click on Scripts and then say New,
and then create a File.
But before you create a File,
you probably first wanna create a Repository for the class.
So maybe it's called RS_Foundations
or whatever you wanna name it.
This is where all of your files
that you write should be saved.
So then you click Create
once you wrote the name of your repository create.
I already have a repository for the class,
so I won't create one right now.
But after you have a repository,
you can go and create a file.
It might take a second.
So let's wait for it to load.
There it goes.
Make sure you're in your correct repository
and then you can name it.
So I'm gonna say Module Zero.
I guess we're not at module...
We're at Module One, right?
Click Okay.
And then when I go to my repository,
I can click Module One.
It'll say "Unsaved changes."
If there's nothing in the script editor that you need,
you can just say Yes, abandoned changes.
So now here is my script called M1.
That's in my RS_Foundation's folder. Great.
So next let's go to...
Oh, I did wanna say...
So all of the scripts that you write
will be in this
upper repository called Owner.
So these are all the ones that you personally have written.
There's also a folder called Writer.
So these are scripts that maybe somebody else owns,
but they have allowed you to edit them.
Reader.
These are scripts that somebody else wrote.
You can't edit them, but you can read them.
So one of the Reader repositories that I have
is actually for the book.
So the book tells you how to access this Reader repository.
And then I also wanted to point out this Examples repository
because it's pretty cool.
There's just different examples of codes
that you could run and see.
You could sort of decipher what they're doing
and how they work.
So it's pretty useful.
You could just click through these and learn a lot.
Now that I've done that though,
I've been kicked out of my R One script.
So I'm gonna click back, there you go.
Okay, so let's go to Docs.
Docs, in my opinion, super underrated.
This tab shows you all of the different functions
that you can do in Google Earth Engine,
which is pretty crazy that it's all in one place.
It can be a little overwhelming to scroll through it all.
It's organized by sort of buckets.
So these are all the algorithms,
these are all the classifiers.
All the things that you can do directly to an image
would be in this sort of folder.
And let me go down to an sort of easy function
that we can do to an image.
Clip.
So this clip is basically when you have a geometry...
You have an image, and you have a geometry
and you wanna clip that image to your geometry.
So you want the image to only be within that geometry.
You'd use this clip function.
And if you click on this, it tells you what it is.
It clips an image to a geometry
and then it also tells you what it returns.
So after you do this function,
it'll give you a clipped image
and then tells you what the arguments are.
So Arguments are basically like extra information
that go into a function.
So a function is like a verb, a variable is like a noun.
So you do functions on variables.
An image can be a variable.
And so in this clip function,
basically, you would need an image
and you would need a geometry.
Sometimes arguments are optional,
sometimes they're required.
So just keep that in mind.
I also wanna say that you can search in the Docs,
so you can say add.
If you for example, wanted to add two images
and you wanted more information about how to do that.
You could go to image and then add
and see what it says about that.
Super useful.
I use Docs all the time.
Assets.
So assets are...
Usually, they're things that are shape files or CSVs,
or like image raster files that are on your desktop
that you want to import into Google Earth Engine.
You import them and then they're called Assets.
And in order to import them,
say you have like a shape file of your hometown,
or of a bunch of points that you collected in the field,
you would import them by going to New, maybe Shape file.
And then this box will come up.
You can select the source files, you can name the Asset.
You can add some Properties if you want,
or add some Advanced options,
and then you would say Upload.
And then you can use that file within Google Earth Engine.
Great.
Okay, so this box in the middle is your code editor,
which I'll come back to.
I also wanted to point out that this search bar
is where you search for all of the...
I don't know, thousands of data products
that Google Earth Engine has.
So if we say...
I don't know, land.
It'll show you the top
data sets that that come up.
So places, Lander, Wyoming.
You could click that and it'll...
Yeah, it'll tell you where Lander is.
And then there's a bunch of raster data sets.
So image data sets, there's a bunch of table data sets,
and I'll just click on one.
So this is a data set
that is included within Google Earth Engine.
Here's a bunch of information about it.
We'll talk more about this in a future code tutorial.
But just so you know, that's how you search for data sets.
And then going to the right side of the screen.
By the way, these scrollers...
Don't be afraid if they get stuck,
you can just pull 'em out.
Inspector.
When you click on that,
it gives you this little
plus sign and you can use it to click on things in your map.
So if you had an imagery here
and you clicked on your imagery,
it would tell you about that specific pixel
that you clicked on.
So it would give you the value,
if it had multiple bands,
it would give you the values for each of those bands.
'Cause I don't have any imagery loaded in here right now.
It's just gonna tell me the longitude,
latitude, the zoom level.
So that's how zoomed in I am, so let's zoom out a bit.
So that was 10, this is eight.
If I zoom out more, it'll just keep on...
The zoom level will go down.
And the scale, which is the meters per pixel.
The Console.
I'll show you more about that in a second.
Basically, when you have information in the script
that you wanna print out, it'll print into the console.
That's like kind of text data.
So if you have maps, obviously,
it'll print into this map here.
But if you, for example, have some number that you generated
and you wanna print it out,
it'll be printed and show up here.
And then Tasks.
Usually, this is when you're like exporting an image
and sometimes it can take like a minute or 15 minutes.
It'll show up in this task bar
and it'll just show you the progress.
And it's kind of helpful to see like,
"Yep, it's still running."
Or like, "Oh, it finished running."
So that's where this Task window comes up.
This map, I've already been sort of playing around in it,
but you can view it as a sort of
a map with some abstract terrain.
You can see a little bit more terrain if you click on that.
You can look at satellite imagery if you want,
which is kind of helpful.
And then over here...
Right now I'm on the little hand tool,
but if we wanted to create geometry, we would use these.
We're gonna do more geometry stuff next week,
so I'm gonna ignore that for now.
But those are the icons that you would click on.
Okay, so let's just do a few things in the code editor.
So for those who have coded before,
maybe in different softwares.
JavaScript is kind of unique.
I've coded in a variety of languages.
JavaScript is not my favorite,
but I don't mind using it
because of how powerful Google Earth Engine is.
It's worth the struggle.
And I will say, you'll get used to it.
It's not so hard and there's so much help resources
and help around Google Earth Engine that...
Don't be afraid you can do it.
So in your code editor,
there are things that are part of you the code that run.
So if I had a variable...
I'll just do this.
My_name and I'll set it to Eva.
So that's part of the code that I run.
But sometimes you write code that you don't wanna run.
So for example, if I wanna say like...
This code was created by Eva Kinnebrew
on the 8th of January.
So I would comment that out.
So I don't want it to run in my code,
but I want it to be a part of my code.
And so the way that I commented it out,
so that's there but it doesn't run,
is I use these two slashes.
Commenting super important.
So you can comment
to help you understand like what you're doing in your code.
So I might, for example, comment here
and say, "Defining my name."
So right here I've just created a variable called my_name
and I've assigned it to Eva.
And so if I wanna print something into the console,
I can say print(my_name).
I can say Run.
And then this Console thing shows up orange
'cause it says something is in here.
So if I click on that, great, it says Eva.
We can also add
other like text information when we're printing things,
which can be useful to know like what you've printed.
So I can say, "My name is" in quotations,
so that means that it's text quotations.
And then my name.
So I can run that and it shows up.
Another fun thing about Google Earth Engine
and a lot of code like editors use this,
is they have different...
Google Earth Engine has different colors
for like different data types.
So text is typically red.
Or it's not typically. Text is red.
And then if you have a number,
so if I want to say...
If I'm really interested in knowing what 4 + 4 is?
I can write this here
and you can see that numbers show up blue.
And then print is a function and so it shows up purple.
And then the text that I've commented out, shows up green.
So it's pretty useful if you're sort of typing away
and you're getting confused about
what your code types are, look at the color.
So I'll print that just to make sure that
Google Earth Engine can do math and it can.
I'll stop for now.
This was again sort of just a broad overview
of Google Earth Engine
and all the different parts of it.
If you have any questions, please let me know.
I think some of this will be reiterated
in the reading tutorial that you have for this week,
but you should learn a few new things from that as well.
Okay, thanks. See you next week.