1 00:00:01,350 --> 00:00:02,910 Hey, everybody. 2 00:00:02,910 --> 00:00:07,910 Welcome to the first code tutorial for Google Earth Engine. 3 00:00:09,180 --> 00:00:10,770 This week I'm just going to give you 4 00:00:10,770 --> 00:00:14,100 a sort of geography lesson of this platform. 5 00:00:14,100 --> 00:00:17,970 Explain all the little tabs 6 00:00:17,970 --> 00:00:20,460 and what they mean, right? 7 00:00:20,460 --> 00:00:24,240 A very minimal amount of things and the script editor. 8 00:00:24,240 --> 00:00:25,500 Will do a lot more next week. 9 00:00:25,500 --> 00:00:27,570 But I think it's important just to sort of 10 00:00:27,570 --> 00:00:32,570 get an understanding of everything that's here first. 11 00:00:35,370 --> 00:00:38,190 So all of you should have access to Google Earth Engine. 12 00:00:38,190 --> 00:00:41,580 I recommend opening up your code editor 13 00:00:41,580 --> 00:00:43,590 so that you can see it 14 00:00:43,590 --> 00:00:48,590 and sort of look at your screen while I am on mine. 15 00:00:48,630 --> 00:00:51,330 And I'm just gonna go from like left to right 16 00:00:51,330 --> 00:00:54,420 and explain each of these tabs 17 00:00:54,420 --> 00:00:58,950 and give a little bit of helpful background information. 18 00:00:58,950 --> 00:01:00,660 So starting with Scripts, 19 00:01:00,660 --> 00:01:05,520 this is where all of your script files will go. 20 00:01:05,520 --> 00:01:07,613 So when you write code, 21 00:01:07,613 --> 00:01:10,920 like document one or more realistically 22 00:01:10,920 --> 00:01:14,880 it would be like //homework for module one. 23 00:01:14,880 --> 00:01:17,883 And then you would write all of your code down here. 24 00:01:19,380 --> 00:01:22,020 So this is a file that you would probably wanna save 25 00:01:22,020 --> 00:01:24,270 and put in a folder for organization. 26 00:01:24,270 --> 00:01:27,510 So you can just start writing your script and then save it. 27 00:01:27,510 --> 00:01:29,610 And then it'll ask you where do you wanna save it? 28 00:01:29,610 --> 00:01:31,160 Another way if you want to... 29 00:01:33,540 --> 00:01:35,430 I don't know be a little bit more organized, 30 00:01:35,430 --> 00:01:39,003 is you can click on Scripts and then say New, 31 00:01:39,840 --> 00:01:41,100 and then create a File. 32 00:01:41,100 --> 00:01:42,630 But before you create a File, 33 00:01:42,630 --> 00:01:47,630 you probably first wanna create a Repository for the class. 34 00:01:47,670 --> 00:01:52,670 So maybe it's called RS_Foundations 35 00:01:52,740 --> 00:01:54,450 or whatever you wanna name it. 36 00:01:54,450 --> 00:01:56,310 This is where all of your files 37 00:01:56,310 --> 00:01:58,710 that you write should be saved. 38 00:01:58,710 --> 00:02:00,150 So then you click Create 39 00:02:00,150 --> 00:02:04,410 once you wrote the name of your repository create. 40 00:02:04,410 --> 00:02:06,030 I already have a repository for the class, 41 00:02:06,030 --> 00:02:07,860 so I won't create one right now. 42 00:02:07,860 --> 00:02:09,540 But after you have a repository, 43 00:02:09,540 --> 00:02:11,430 you can go and create a file. 44 00:02:11,430 --> 00:02:13,020 It might take a second. 45 00:02:13,020 --> 00:02:14,970 So let's wait for it to load. 46 00:02:14,970 --> 00:02:16,110 There it goes. 47 00:02:16,110 --> 00:02:18,600 Make sure you're in your correct repository 48 00:02:18,600 --> 00:02:19,620 and then you can name it. 49 00:02:19,620 --> 00:02:22,443 So I'm gonna say Module Zero. 50 00:02:23,610 --> 00:02:24,510 I guess we're not at module... 51 00:02:24,510 --> 00:02:25,860 We're at Module One, right? 52 00:02:26,700 --> 00:02:28,380 Click Okay. 53 00:02:28,380 --> 00:02:32,160 And then when I go to my repository, 54 00:02:32,160 --> 00:02:34,380 I can click Module One. 55 00:02:34,380 --> 00:02:36,117 It'll say "Unsaved changes." 56 00:02:37,290 --> 00:02:39,930 If there's nothing in the script editor that you need, 57 00:02:39,930 --> 00:02:43,050 you can just say Yes, abandoned changes. 58 00:02:43,050 --> 00:02:47,010 So now here is my script called M1. 59 00:02:47,010 --> 00:02:50,313 That's in my RS_Foundation's folder. Great. 60 00:02:51,300 --> 00:02:53,970 So next let's go to... 61 00:02:53,970 --> 00:02:55,410 Oh, I did wanna say... 62 00:02:55,410 --> 00:02:57,210 So all of the scripts that you write 63 00:02:57,210 --> 00:02:58,210 will be in this 64 00:03:00,270 --> 00:03:02,220 upper repository called Owner. 65 00:03:02,220 --> 00:03:05,077 So these are all the ones that you personally have written. 66 00:03:05,077 --> 00:03:07,080 There's also a folder called Writer. 67 00:03:07,080 --> 00:03:10,650 So these are scripts that maybe somebody else owns, 68 00:03:10,650 --> 00:03:13,650 but they have allowed you to edit them. 69 00:03:13,650 --> 00:03:14,640 Reader. 70 00:03:14,640 --> 00:03:17,010 These are scripts that somebody else wrote. 71 00:03:17,010 --> 00:03:18,810 You can't edit them, but you can read them. 72 00:03:18,810 --> 00:03:22,680 So one of the Reader repositories that I have 73 00:03:22,680 --> 00:03:23,640 is actually for the book. 74 00:03:23,640 --> 00:03:28,640 So the book tells you how to access this Reader repository. 75 00:03:29,460 --> 00:03:32,970 And then I also wanted to point out this Examples repository 76 00:03:32,970 --> 00:03:34,950 because it's pretty cool. 77 00:03:34,950 --> 00:03:38,620 There's just different examples of codes 78 00:03:42,413 --> 00:03:45,210 that you could run and see. 79 00:03:45,210 --> 00:03:47,220 You could sort of decipher what they're doing 80 00:03:47,220 --> 00:03:48,420 and how they work. 81 00:03:48,420 --> 00:03:50,190 So it's pretty useful. 82 00:03:50,190 --> 00:03:53,370 You could just click through these and learn a lot. 83 00:03:53,370 --> 00:03:54,920 Now that I've done that though, 84 00:03:56,149 --> 00:03:58,200 I've been kicked out of my R One script. 85 00:03:58,200 --> 00:04:00,600 So I'm gonna click back, there you go. 86 00:04:00,600 --> 00:04:02,280 Okay, so let's go to Docs. 87 00:04:02,280 --> 00:04:05,463 Docs, in my opinion, super underrated. 88 00:04:07,830 --> 00:04:11,430 This tab shows you all of the different functions 89 00:04:11,430 --> 00:04:13,830 that you can do in Google Earth Engine, 90 00:04:13,830 --> 00:04:17,820 which is pretty crazy that it's all in one place. 91 00:04:17,820 --> 00:04:20,943 It can be a little overwhelming to scroll through it all. 92 00:04:22,200 --> 00:04:27,200 It's organized by sort of buckets. 93 00:04:27,240 --> 00:04:29,040 So these are all the algorithms, 94 00:04:29,040 --> 00:04:30,840 these are all the classifiers. 95 00:04:30,840 --> 00:04:33,120 All the things that you can do directly to an image 96 00:04:33,120 --> 00:04:36,963 would be in this sort of folder. 97 00:04:38,304 --> 00:04:41,040 And let me go down to an sort of easy function 98 00:04:41,040 --> 00:04:42,633 that we can do to an image. 99 00:04:43,980 --> 00:04:44,880 Clip. 100 00:04:44,880 --> 00:04:48,900 So this clip is basically when you have a geometry... 101 00:04:48,900 --> 00:04:50,340 You have an image, and you have a geometry 102 00:04:50,340 --> 00:04:53,550 and you wanna clip that image to your geometry. 103 00:04:53,550 --> 00:04:56,730 So you want the image to only be within that geometry. 104 00:04:56,730 --> 00:04:58,380 You'd use this clip function. 105 00:04:58,380 --> 00:05:00,900 And if you click on this, it tells you what it is. 106 00:05:00,900 --> 00:05:03,370 It clips an image to a geometry 107 00:05:05,250 --> 00:05:08,583 and then it also tells you what it returns. 108 00:05:09,428 --> 00:05:11,250 So after you do this function, 109 00:05:11,250 --> 00:05:13,500 it'll give you a clipped image 110 00:05:13,500 --> 00:05:15,090 and then tells you what the arguments are. 111 00:05:15,090 --> 00:05:18,130 So Arguments are basically like extra information 112 00:05:20,340 --> 00:05:22,200 that go into a function. 113 00:05:22,200 --> 00:05:25,740 So a function is like a verb, a variable is like a noun. 114 00:05:25,740 --> 00:05:30,300 So you do functions on variables. 115 00:05:30,300 --> 00:05:32,193 An image can be a variable. 116 00:05:34,290 --> 00:05:36,570 And so in this clip function, 117 00:05:36,570 --> 00:05:39,720 basically, you would need an image 118 00:05:39,720 --> 00:05:41,820 and you would need a geometry. 119 00:05:41,820 --> 00:05:43,740 Sometimes arguments are optional, 120 00:05:43,740 --> 00:05:45,240 sometimes they're required. 121 00:05:45,240 --> 00:05:46,890 So just keep that in mind. 122 00:05:46,890 --> 00:05:50,730 I also wanna say that you can search in the Docs, 123 00:05:50,730 --> 00:05:52,530 so you can say add. 124 00:05:52,530 --> 00:05:54,900 If you for example, wanted to add two images 125 00:05:54,900 --> 00:05:57,990 and you wanted more information about how to do that. 126 00:05:57,990 --> 00:06:00,390 You could go to image and then add 127 00:06:00,390 --> 00:06:02,073 and see what it says about that. 128 00:06:03,120 --> 00:06:04,860 Super useful. 129 00:06:04,860 --> 00:06:06,393 I use Docs all the time. 130 00:06:07,230 --> 00:06:08,063 Assets. 131 00:06:08,063 --> 00:06:09,590 So assets are... 132 00:06:11,430 --> 00:06:15,660 Usually, they're things that are shape files or CSVs, 133 00:06:15,660 --> 00:06:20,100 or like image raster files that are on your desktop 134 00:06:20,100 --> 00:06:23,340 that you want to import into Google Earth Engine. 135 00:06:23,340 --> 00:06:26,460 You import them and then they're called Assets. 136 00:06:26,460 --> 00:06:28,050 And in order to import them, 137 00:06:28,050 --> 00:06:33,050 say you have like a shape file of your hometown, 138 00:06:33,120 --> 00:06:36,240 or of a bunch of points that you collected in the field, 139 00:06:36,240 --> 00:06:40,020 you would import them by going to New, maybe Shape file. 140 00:06:40,020 --> 00:06:42,360 And then this box will come up. 141 00:06:42,360 --> 00:06:46,140 You can select the source files, you can name the Asset. 142 00:06:46,140 --> 00:06:48,810 You can add some Properties if you want, 143 00:06:48,810 --> 00:06:50,520 or add some Advanced options, 144 00:06:50,520 --> 00:06:52,170 and then you would say Upload. 145 00:06:52,170 --> 00:06:57,170 And then you can use that file within Google Earth Engine. 146 00:06:57,420 --> 00:06:58,500 Great. 147 00:06:58,500 --> 00:07:01,140 Okay, so this box in the middle is your code editor, 148 00:07:01,140 --> 00:07:02,580 which I'll come back to. 149 00:07:02,580 --> 00:07:06,420 I also wanted to point out that this search bar 150 00:07:06,420 --> 00:07:10,470 is where you search for all of the... 151 00:07:10,470 --> 00:07:12,630 I don't know, thousands of data products 152 00:07:12,630 --> 00:07:15,450 that Google Earth Engine has. 153 00:07:15,450 --> 00:07:17,130 So if we say... 154 00:07:17,130 --> 00:07:18,393 I don't know, land. 155 00:07:19,800 --> 00:07:23,590 It'll show you the top 156 00:07:24,840 --> 00:07:27,030 data sets that that come up. 157 00:07:27,030 --> 00:07:30,420 So places, Lander, Wyoming. 158 00:07:30,420 --> 00:07:31,920 You could click that and it'll... 159 00:07:31,920 --> 00:07:34,803 Yeah, it'll tell you where Lander is. 160 00:07:36,630 --> 00:07:38,340 And then there's a bunch of raster data sets. 161 00:07:38,340 --> 00:07:41,853 So image data sets, there's a bunch of table data sets, 162 00:07:43,730 --> 00:07:45,510 and I'll just click on one. 163 00:07:45,510 --> 00:07:47,310 So this is a data set 164 00:07:47,310 --> 00:07:50,760 that is included within Google Earth Engine. 165 00:07:50,760 --> 00:07:54,420 Here's a bunch of information about it. 166 00:07:54,420 --> 00:07:58,140 We'll talk more about this in a future code tutorial. 167 00:07:58,140 --> 00:08:03,140 But just so you know, that's how you search for data sets. 168 00:08:04,890 --> 00:08:07,110 And then going to the right side of the screen. 169 00:08:07,110 --> 00:08:11,520 By the way, these scrollers... 170 00:08:11,520 --> 00:08:13,980 Don't be afraid if they get stuck, 171 00:08:13,980 --> 00:08:15,280 you can just pull 'em out. 172 00:08:17,370 --> 00:08:18,393 Inspector. 173 00:08:19,230 --> 00:08:20,250 When you click on that, 174 00:08:20,250 --> 00:08:21,610 it gives you this little 175 00:08:24,120 --> 00:08:28,593 plus sign and you can use it to click on things in your map. 176 00:08:29,481 --> 00:08:30,720 So if you had an imagery here 177 00:08:30,720 --> 00:08:32,310 and you clicked on your imagery, 178 00:08:32,310 --> 00:08:34,860 it would tell you about that specific pixel 179 00:08:34,860 --> 00:08:35,700 that you clicked on. 180 00:08:35,700 --> 00:08:38,130 So it would give you the value, 181 00:08:38,130 --> 00:08:39,630 if it had multiple bands, 182 00:08:39,630 --> 00:08:43,680 it would give you the values for each of those bands. 183 00:08:43,680 --> 00:08:46,980 'Cause I don't have any imagery loaded in here right now. 184 00:08:46,980 --> 00:08:48,570 It's just gonna tell me the longitude, 185 00:08:48,570 --> 00:08:50,070 latitude, the zoom level. 186 00:08:50,070 --> 00:08:52,920 So that's how zoomed in I am, so let's zoom out a bit. 187 00:08:52,920 --> 00:08:54,390 So that was 10, this is eight. 188 00:08:54,390 --> 00:08:56,460 If I zoom out more, it'll just keep on... 189 00:08:56,460 --> 00:08:57,860 The zoom level will go down. 190 00:08:59,340 --> 00:09:01,743 And the scale, which is the meters per pixel. 191 00:09:03,660 --> 00:09:05,280 The Console. 192 00:09:05,280 --> 00:09:08,370 I'll show you more about that in a second. 193 00:09:08,370 --> 00:09:11,370 Basically, when you have information in the script 194 00:09:11,370 --> 00:09:15,780 that you wanna print out, it'll print into the console. 195 00:09:15,780 --> 00:09:17,130 That's like kind of text data. 196 00:09:17,130 --> 00:09:20,400 So if you have maps, obviously, 197 00:09:20,400 --> 00:09:22,140 it'll print into this map here. 198 00:09:22,140 --> 00:09:25,740 But if you, for example, have some number that you generated 199 00:09:25,740 --> 00:09:26,820 and you wanna print it out, 200 00:09:26,820 --> 00:09:29,520 it'll be printed and show up here. 201 00:09:29,520 --> 00:09:30,783 And then Tasks. 202 00:09:31,650 --> 00:09:34,140 Usually, this is when you're like exporting an image 203 00:09:34,140 --> 00:09:37,803 and sometimes it can take like a minute or 15 minutes. 204 00:09:39,750 --> 00:09:41,100 It'll show up in this task bar 205 00:09:41,100 --> 00:09:42,660 and it'll just show you the progress. 206 00:09:42,660 --> 00:09:44,137 And it's kind of helpful to see like, 207 00:09:44,137 --> 00:09:45,810 "Yep, it's still running." 208 00:09:45,810 --> 00:09:47,670 Or like, "Oh, it finished running." 209 00:09:47,670 --> 00:09:50,883 So that's where this Task window comes up. 210 00:09:51,755 --> 00:09:56,220 This map, I've already been sort of playing around in it, 211 00:09:56,220 --> 00:10:00,100 but you can view it as a sort of 212 00:10:02,460 --> 00:10:04,710 a map with some abstract terrain. 213 00:10:04,710 --> 00:10:07,770 You can see a little bit more terrain if you click on that. 214 00:10:07,770 --> 00:10:12,420 You can look at satellite imagery if you want, 215 00:10:12,420 --> 00:10:14,250 which is kind of helpful. 216 00:10:14,250 --> 00:10:15,810 And then over here... 217 00:10:15,810 --> 00:10:18,150 Right now I'm on the little hand tool, 218 00:10:18,150 --> 00:10:22,020 but if we wanted to create geometry, we would use these. 219 00:10:22,020 --> 00:10:25,020 We're gonna do more geometry stuff next week, 220 00:10:25,020 --> 00:10:28,110 so I'm gonna ignore that for now. 221 00:10:28,110 --> 00:10:31,293 But those are the icons that you would click on. 222 00:10:32,700 --> 00:10:36,363 Okay, so let's just do a few things in the code editor. 223 00:10:38,130 --> 00:10:40,350 So for those who have coded before, 224 00:10:40,350 --> 00:10:42,840 maybe in different softwares. 225 00:10:42,840 --> 00:10:45,060 JavaScript is kind of unique. 226 00:10:45,060 --> 00:10:48,993 I've coded in a variety of languages. 227 00:10:49,933 --> 00:10:52,200 JavaScript is not my favorite, 228 00:10:52,200 --> 00:10:55,000 but I don't mind using it 229 00:10:55,920 --> 00:10:58,833 because of how powerful Google Earth Engine is. 230 00:11:00,570 --> 00:11:02,250 It's worth the struggle. 231 00:11:02,250 --> 00:11:05,220 And I will say, you'll get used to it. 232 00:11:05,220 --> 00:11:09,090 It's not so hard and there's so much help resources 233 00:11:09,090 --> 00:11:11,670 and help around Google Earth Engine that... 234 00:11:11,670 --> 00:11:13,293 Don't be afraid you can do it. 235 00:11:15,780 --> 00:11:17,940 So in your code editor, 236 00:11:17,940 --> 00:11:21,120 there are things that are part of you the code that run. 237 00:11:21,120 --> 00:11:23,270 So if I had a variable... 238 00:11:24,326 --> 00:11:25,623 I'll just do this. 239 00:11:27,268 --> 00:11:30,180 My_name and I'll set it to Eva. 240 00:11:30,180 --> 00:11:32,700 So that's part of the code that I run. 241 00:11:32,700 --> 00:11:34,800 But sometimes you write code that you don't wanna run. 242 00:11:34,800 --> 00:11:37,830 So for example, if I wanna say like... 243 00:11:37,830 --> 00:11:40,300 This code was created by Eva Kinnebrew 244 00:11:41,610 --> 00:11:43,953 on the 8th of January. 245 00:11:46,380 --> 00:11:49,170 So I would comment that out. 246 00:11:49,170 --> 00:11:50,790 So I don't want it to run in my code, 247 00:11:50,790 --> 00:11:52,860 but I want it to be a part of my code. 248 00:11:52,860 --> 00:11:55,290 And so the way that I commented it out, 249 00:11:55,290 --> 00:11:57,360 so that's there but it doesn't run, 250 00:11:57,360 --> 00:11:59,553 is I use these two slashes. 251 00:12:02,220 --> 00:12:03,810 Commenting super important. 252 00:12:03,810 --> 00:12:05,200 So you can comment 253 00:12:06,730 --> 00:12:09,420 to help you understand like what you're doing in your code. 254 00:12:09,420 --> 00:12:11,550 So I might, for example, comment here 255 00:12:11,550 --> 00:12:14,876 and say, "Defining my name." 256 00:12:14,876 --> 00:12:18,720 So right here I've just created a variable called my_name 257 00:12:18,720 --> 00:12:20,373 and I've assigned it to Eva. 258 00:12:21,480 --> 00:12:23,640 And so if I wanna print something into the console, 259 00:12:23,640 --> 00:12:24,890 I can say print(my_name). 260 00:12:27,038 --> 00:12:27,990 I can say Run. 261 00:12:27,990 --> 00:12:30,390 And then this Console thing shows up orange 262 00:12:30,390 --> 00:12:31,890 'cause it says something is in here. 263 00:12:31,890 --> 00:12:34,710 So if I click on that, great, it says Eva. 264 00:12:34,710 --> 00:12:36,070 We can also add 265 00:12:37,200 --> 00:12:40,440 other like text information when we're printing things, 266 00:12:40,440 --> 00:12:43,980 which can be useful to know like what you've printed. 267 00:12:43,980 --> 00:12:47,180 So I can say, "My name is" in quotations, 268 00:12:49,080 --> 00:12:52,560 so that means that it's text quotations. 269 00:12:52,560 --> 00:12:54,480 And then my name. 270 00:12:54,480 --> 00:12:56,180 So I can run that and it shows up. 271 00:12:57,630 --> 00:12:59,580 Another fun thing about Google Earth Engine 272 00:12:59,580 --> 00:13:04,580 and a lot of code like editors use this, 273 00:13:05,100 --> 00:13:06,570 is they have different... 274 00:13:06,570 --> 00:13:10,320 Google Earth Engine has different colors 275 00:13:10,320 --> 00:13:12,753 for like different data types. 276 00:13:14,430 --> 00:13:18,660 So text is typically red. 277 00:13:18,660 --> 00:13:20,610 Or it's not typically. Text is red. 278 00:13:20,610 --> 00:13:21,870 And then if you have a number, 279 00:13:21,870 --> 00:13:23,850 so if I want to say... 280 00:13:23,850 --> 00:13:27,123 If I'm really interested in knowing what 4 + 4 is? 281 00:13:28,560 --> 00:13:29,970 I can write this here 282 00:13:29,970 --> 00:13:32,880 and you can see that numbers show up blue. 283 00:13:32,880 --> 00:13:37,290 And then print is a function and so it shows up purple. 284 00:13:37,290 --> 00:13:41,313 And then the text that I've commented out, shows up green. 285 00:13:43,014 --> 00:13:47,340 So it's pretty useful if you're sort of typing away 286 00:13:47,340 --> 00:13:49,200 and you're getting confused about 287 00:13:49,200 --> 00:13:51,993 what your code types are, look at the color. 288 00:13:52,950 --> 00:13:55,330 So I'll print that just to make sure that 289 00:13:56,310 --> 00:13:59,373 Google Earth Engine can do math and it can. 290 00:14:00,587 --> 00:14:03,210 I'll stop for now. 291 00:14:03,210 --> 00:14:05,460 This was again sort of just a broad overview 292 00:14:05,460 --> 00:14:06,910 of Google Earth Engine 293 00:14:09,019 --> 00:14:10,170 and all the different parts of it. 294 00:14:10,170 --> 00:14:13,440 If you have any questions, please let me know. 295 00:14:13,440 --> 00:14:17,040 I think some of this will be reiterated 296 00:14:17,040 --> 00:14:21,153 in the reading tutorial that you have for this week, 297 00:14:23,010 --> 00:14:26,280 but you should learn a few new things from that as well. 298 00:14:26,280 --> 00:14:28,503 Okay, thanks. See you next week.