[MUSIC] >> Hello again and welcome back. In this lecture, we're going to go through a lot of the concepts we went through in the last lecture but from the perspective of how we actually handle this in ArcGIS. So I have a toolbox similar to the one you created in a previous assignment. And if I right click on the Create Streamlines Tool and go to Edit and bring it in so you could see it. It's a not simple but not incredibly complicated tool here. So, as we talked about, we generate the flow direction raster, but we generate that from the fill tool. So, we have our DEM going into fill, as we said that happens first. So we fill any sinks or holes in the raster. Then we go and create a flow direction raster from that filled DEM. And then we create the flow accumulation raster. And then we nullify any cells that are less than our threshold that we specify saying how many cells make up a river or how many upstream cells are required before we have a river. So we nullify the non-river cells and then with the remaining cells that aren't null, we can use stream link and stream to feature to give the streams individual IDs. Basically turn any distinct segment of stream into its own ID. And then turn all those unique IDs into stream segments. So let's look at it in action now. So to start with let's set our surface raster to our Navarro river DEM that we have in this document. And once I do, the rest of the model is ready to run. And, if we just look so that we're familiar with the DEM, this is what we're looking at. And the rest of the model is ready to run. And we have parameters for the final output location. We have a parameter for the number of SQL cells and then a parameter for the input service roster. So let's the number of cells that are required to make a river. And I'm going to set it to 10,000 because on a ten meter DEM where each cell is 100 meters squared. Then a 10,000 meter or 10,000 cells equals a square kilometer. Because if we multiple 10,000 by 10 we get 100,000 and if we multiply it again by 10 we get a million. And a million square meters is a kilometer. A thousand meters by a thousand meters on each side. So I'll leave that. And let's make sure we set our output location and its my default data base and I'm going to call it navarro_streams_10000. Click OK and now let's run this bit by bit. So let's start with the fill tool, we'll run it. Okay and it's completed so let's add it to our display so we can take a look, minimize this. And not a whole lot is immediately obvious here So, let's try doing a subtraction here, and see what the difference between them is. So I could use raster calculator or I could go to math and go to minus and just directly subtract them. So it subtracts the value of the second input raster from the value of the first. So we'll use our navarro DEM, as our second, and we'll use our fill as our first. And I'll just use the default name. And let's see what the differences between these two are, where it filled. And, well, it looks like that this DEM was already filled prior to us obtaining it. So, the fill step was unnecessary in this instance. And we could verify that we the subtraction tool, with the minus tool. But in general, you want that in your hydrologic processing workflows to make sure any sinks are filled. So remember that these are in your DEM because of just errors when you create any sort of model. That 30 meter squared cells or ten meter squared cells are going to ultimately have some spots that are slightly lower than their surroundings even though they aren't real life. Just because of the way things are sampled. So you get these sorts of errors in your landscape and if water flowed in them, it would never go out in our model. So, now lets run flow direction based on our filled DEM and it's running now. Completed and now let's take a look at it. So, add it to the display. I always think these things look pretty cool, just the way it's displaying them. They're almost like hill shades, just kind of colorized. And I'll turn this off and this off for faster rendering. And let's just zoom in and take a look at it. And if we look down in one of these valleys here. Kind of where the lines are could be either ridge top or a valley bottom. Those are the spots that direction tends to change. And so if we remember that it starts this kind of brownish means it flows to the right so it's falling that way. This means down and right, and then green means it's falling down. And then light blue means down and left, and the red means it's flowing to the left. And then 64, the purplish, means it's flowing up and left, and once we hit the yellow means it's flowing up. We can sort of look at this and get a sense for which way it's flowing. Pink, red and yellow kind of mean it's flowing left or up and left or up or up and right. And then the brownish this kind of means it's flowing this way so it's flowing through here. Here this way and then down this way. And we could look and just verify that, yeah, this makes sense. So, we have this raster with values that indicate which way water's flowing in any given spot. And we calculate that with the hydro-logic slope calculation that I showed you previously. So, what we can do with this is we feed that directly into the flow accumulation tool. So, flow accumulation really only needs the flow direction raster and then we can weight it and say what type of output or what type of data the output is. But other than that, it just needs to be able to chain together those cells using the flow direction as we saw before with that kind of network we made. And we can run Flow Accumulation. Okay, and that finishes. And let's take a quick look at it. So, we've seen this a bit before. And we can't see a whole lot of detail in it, but if we go to Properties, We can change this from Percent Clip, or we can instead of getting statistics from the data set, we can get it from the current display extent. Which doesn't really help here. But as we zoom in, it helps us see a bit more about what's going on, because it keeps updating the color ramp, or the ramp here as we zoom in, so we can see more of the cells. We could also just mess with the histograms here. And try Histogram Equalize from the current display extent and then we could see a bit more at even as we zoom out okay. So, what do we see? Well, we see something that looks a lot like rivers already. We see these tendrils kind of going up. And if we turn this off and turn off the Flow Direction we can see that these roughly follow the low spots on the landscape that we've seen in the digital elevation model. So that's to be expected. And if we look at the values the values are huge they go from zero all the way up to seven point nine times ten to the sixth power. So if ten to the sixth power is a million we're talking about 7 point 9 million cells flowing into it. And we could bet that that's near the outlet here. That the value of these cells is, Right there we're getting 8.1 million and that's because we zoomed over here so it got new statistics. So over here we're getting 8.1 million as our high value and that again makes sense because we have all of the cells flowing out through here. But if we go back to the main area here. And kind of zoom in we can see much smaller areas where they branch and so if we have this cell here. Which has 732,000 cells flowing into it and this one here which has 760,000 cells flowing into it. Down here we should get about double that about 1.4 million and that's exactly what we get. 1,493,000 cells flowing in, so these two branches are merging and then as we go down stream of them, their sums get totally. And that's happening in every cell, is all the cells upstream get summed and there are these merge points. Where these branches come together and start forming larger and larger values which is why once we get down here after we've merged we should have almost all of the cells in the raster flowing out through here. So once again we visually have a stream network with these increasing cell values. The major difference in value between the cells in these bright whites here and the cells in the dark here is the difference between being a stream and not a stream. And if we look at these values here in fact the pixel value of 423 wouldn't qualify as a stream in our threshold of 10,000 upstream cells. This doesn't have that many cells draining into it something like this. So what we need to do is run that thresholding now. And that's what the Set Null operation does. So, if we look at it, we're setting to null. Basically we're taking the output accumulation raster and setting to null the values that make this SQL expression that's this parameter here. And so we're setting to null all of the cells that are less than 10,000. So that means in this case if we're taking a flow communication raster that we're setting to null all the cells with fewer than 10,000 cells flowing into them. So let's run it. And it's done. And now let's take a look at this. And if we turn off the underlying cells here. And what we get is a new raster with a low value of 10,000 and a high value of that max that we saw before. And if I zoom into one of these ends here this should still retain its value as about 10,000. It could be above it, it doesn't have to hit 10,000 on the head maybe this was a merging point of multiple branches that summed to more than 10,000 but all the values below it are null. We're looking at the DEM below it and it kept the cells as actual cell values only where it added up to more than 10,000 here. So we have a bunch of null values in this raster and a bunch of cells that represent our streamlines now, that's what we're left behind with. As we already said, these are streams they have more than 10,000 cells flowing into them more than a kilometer up stream squared kilometer upstream so this is a streamline here. Well how do we actually get this to be a streamline instead of just a raster network? Well, we start with the stream link tool. So if we run that now, It's going to take all of these individual segments in between the various merge points of the stream raster here that we created. And give us a new one that replaces the actual flow accumulation values with IDs representing what stream segment it is. So if I add it to the display, I now have values 1 to 445. And I can symbolize it so I could see those values a little better as just unique values. And I'll click OK, and now we can see that in between some junctions here, we have this streamline flowing in and this streamline flowing in, and once they merge we get a new segment here with a different value. And this other stream flows in and it merges with that and we get a new segment with a new value here too. And we needed to separate encoding because when we convert the raster to lines it will help with the actual turning it into features to indicate where lines should start and end. Otherwise we might not necessarily know whether this line become this or this become this. So to have separate segments, separate features for each underlying segment here is useful. So, we then feed this tool in to stream to feature or this output in to stream to feature. And run it. And it runs pretty quickly. And what we get back are lines now. And what we should have is 445 of those. Which we do because remember our raster had 445 underlying values so that we could get a streamline segment for each one of those. And if I were to select a feature I would see that it ends at any given junction here. So just like we saw before with those different values. We see that each feature ends at the junctions. Okay so that's it. We're done working with hydro-logic tools in ArcGIS. I've used it, as I've said before, because I think that this algorithm helps show you a bunch of different tools including raster processing. But also domain specific tools that are necessary to get processing done. So you need to be able to chain these together and conceptualize your completion. You need to see your end goal and have an idea of the set of tools that gets you from the inputs you have, the digital elevation model, all the way to the streamlines at the end. And the tools are how you explain what you want to the computer. So this type of thought process works in all different ways and works in non-hydro-logic applications, naturally. But this one is a good one that I know very well, naturally, so that I could explain to you what's going on and we can work through building an algorithm and seeing it through together. So I hope it has helped and I will see you next time.