 Hello, I'm Stacy. I'm a GIS analyst with a natural capital project and I'm glad that you've joined me to learn some techniques for working with the geospatial data that's used by the Invest Ecosystem Service Modeling Toolkit. In this episode, we'll see what goes into creating a good stream network from a digital elevation model. To get the most out of this tutorial, I highly recommend following along in your own GIS session. In this video, we will demonstrate techniques in ArcGIS, and we'll be working with some sample data, which is linked to on the web page for this video. Also, in this episode, we'll be using one of the Invest Tools, so make sure that Invest is installed. In several previous episodes, including preparing the DEM, we worked with data in Nepal, so we will continue with that location in this video. If you happen to have an ArcGIS session saved from those earlier episodes in Nepal, you can use them now. If you don't, that's totally fine too, just open up a new GIS session. So if you haven't already, now is a good time to pause this video, download the sample data, unzip it, and bring up an ArcGIS session before continuing. There are three Invest models that make use of a stream network. The nutrient model, or NDR, the sediment model, SDR, and seasonal water yield. The way these models work, nutrient, sediment, or precipitation runs off of a pixel on the landscape, and moves down slow until it is retained by the landscape, or it reaches a stream. Once it hits a stream, the model stops calculating, since the models do not include in-stream processes. Because the model stops calculating at streams, it's very important that the model create a stream network that represents the real world, at least reasonably accurately. It's also important for creating the watershed that you'll use for your study area, which is a topic that we'll cover in a future tutorial. Streams are derived from the digital elevation model, or DEM, that you provide as input, along with another model input called the threshold flow accumulation, or TFA. The TFA value represents the number of upslope pixels that must flow into a particular pixel in order for it to be considered part of a stream. Another way of thinking about this is that it defines the upslope contributing area that's needed for a stream to form. In the images to the right, you can see the difference between a large TFA value of 10,000 pixels in the top picture, and a small TFA of 100 pixels in the bottom picture. A large TFA value will produce a coarse stream network with fewer tributaries, like we see in the top image. A small TFA value will produce a stream network with more tributaries, like we see in the lower image. Thinking about how the models work, each of these options will produce very different results. In the top map, the yellow pixel is far away from the stream. So there is potentially a lot of vegetation between the pixel and the stream that might retain sediment or nutrient. So it's less likely that erosion or nutrient originating from that pixel will make it all the way to the stream. But in the bottom map, that same pixel is now much closer to the stream. So it's much more likely that sediment or nutrient from that pixel will enter into the stream as export. So then a common question is, what is the correct threshold flow accumulation value to use for my project? The correct TFA value is the value that causes the model to create a simulated stream network that is as close as possible to this real world stream network in the place that you're studying. So this is going to be different in every case. To determine this, you will need a real world stream map of some sort, preferably geospatial, because then it's easy to visually compare with the model streams. But if you only have one that isn't geospatial, that's helpful too. It's just not as easy to directly compare them. And you can also make use of satellite data or other GIS basemats. Now, an important thing to accept is that modeled stream networks are pretty much never exactly the same as the real world. So while we try to choose the DEM and TFA values to create as good of a network as possible, it will not be exactly the same. And it's likely that you'll need to do multiple iterations of creating streams until you find the best TFA value for your needs. Here's an example from an analysis in Bolivia. The first DEM that I tried was from Aster, which I've used in other projects successfully. If you compare the Aster map in the upper left to the national stream layer in the lower right, you'll see that they don't match very well. Next, I tried an SRTM DEM, which is another globally available data set. And it seemed even more inaccurate compared with a real world stream network. Finally, I tried the Hydro Sheds DEM. And while it isn't perfect, it came much closer to matching the real world streams than the others. And that's the one we decided to use for hydrology modeling. Interestingly, I have tried Hydro Sheds in other locations for other projects, and it did not work very well, and we did not use it. But this time it was the best one, which illustrates the point that you might need to try multiple DEMs to find the one that works best in the particular place that you're modeling. One other thing of note while we're here is that it is really, really hard for any model to create a stream network in a very flat place. They rely on elevation change to know where water flows from one pixel to the next. But if there is no elevation change between pixels, like in a very flat place, the model just doesn't know where to route water. This particular area in Bolivia is actually a very large, very flat wetland, which makes it even more difficult to create a stream network that matches the real world. And in reality, streams don't tend to stay the same in flood plains and wetlands anyway. So this is just something to keep in mind if you're working in a very flat landscape. All right, so how can we create streams? Well, of course, the hydrology models themselves will create a stream layer, and you're welcome to just do iterations of the model to determine the correct stream network. However, it can take a while to run a model, especially if we need to do multiple iterations just to look at the streams. So personally, I find it to be faster and more efficient to do this step outside of the model. It is also certainly possible to create a stream layer manually using tools in ArcGIS. But since we're using invest, it's even easier to use a tool that we provide called RouteDem. RouteDem was created to do the DEM and stream processing outside of the model, which makes it faster and more efficient to evaluate how your streams will look and invest, without having the additional overhead of running the whole freshwater model over and over again. And by using RouteDem, you'll also know that you're creating exactly the same stream network as the invest freshwater models, which may not be the case if you make streams using ArcGIS tools. Okay, that's enough background. Let's go to our GIS session. All right, let's go to a file explorer and look for the DEM that we will use to create streams. If you are using the same GIS session from the preparing the DEM tutorial, you'll probably already have the prepared DEM added to the map. So just hang out a minute. If you're starting with a new session, go to the sample data folder, which is called creating streams data. And inside here, there's a file called dem filled.tif. We'll bring that into the GIS. This is Aster DEM data for our study area in Nepal. In the previous tutorial, we mosaic to the raw data tiles together. We projected that to a UTM projected coordinate system and filled sinks. The next step in the process is to see what the stream network looks like. So to create the streams, we're going to use the RouteDem tool and let's launch that now. I'm using Windows, so I will do that through my start menu. If you're on Mac, you can launch it in the same way that you do other invest models. So we'll go down here in the invest toolkit, and we will launch the tool called RouteDem. And note that your version of invest may be different than mine, since we are not updating these videos every time invest updates. But hopefully RouteDem will be the same or similar enough to follow along. The first input is the workspace where the output files will be written. So navigate to wherever it is that you want to keep them. And here I'm going to create a folder called RouteDem underscore output. And I'm going to select this folder. For result suffix, I like to include the threshold flow accumulation value that I'm using for this particular run. Now we'll talk about this in a moment, but we will start with a TFA value of 1000. So for the result suffix, I'm going to enter the string TFA 1000. For digital elevation model, we'll drag in dem underscore filled dot tiff. Now this raster only has one band. So let's type one in the band index. In this case, we won't calculate slope. So leave that box unchecked. Now for routing algorithm. RouteDem provides two choices. D8, which is the default and MFD or multiple flow direction. Each of these will produce stream networks that look rather different. D8 is more simplistic and it assumes that all water running off of a pixel goes into a single downslope pixel that is in one of the eight cardinal directions. And it tends to create streams that are thin lines, which is more like what you would expect from a stream network. MFD is thought to be more accurate since it simulates water flowing in multiple directions from a single pixel. But some of the streams that it creates can be much wider, more like flood plant. So there are trade offs to each one. MFD is the algorithm that the invest freshwater models use. So we will select that one. We will calculate flow direction and flow accumulation before streams can be created. So make sure that there are check marks next to all of the boxes for calculating flow direction, flow accumulation, and stream thresholds. Now once we check on calculate stream thresholds, now we must enter a threshold flow accumulation limit. That defines the number of upslope pixels that must flow into a particular pixel for it to be considered part of a stream. I generally recommend starting with a value of 1000, although that's a fairly arbitrary number. Really, the value that you end up using will depend on the size of your pixels and landscape characteristics, and you'll probably need to try several TFA values before you find the one that makes a stream network that comes close to the real world. So for now, let's just enter a value of 1000. And right now we will not calculate distance to the stream. So leave that box unchecked. And click run. Anytime that we're doing hydrologic modeling in particular, it can take quite a while to do the DEM processing, because it's computationally intensive. For this example data, it might take a few minutes for the tool to run, and it will be different on different computers. So feel free to pause this video until yours is finished. When it's finished, click the open workspace button. Right in this folder, you should see the flow direction, flow accumulation, and the stream layers the route DEM created, along with the log file. Let's bring the stream layer into the GIS. It's called stream mask TFA 1000.tif. Now, when you first look at the streams zoomed out like this, they look very disconnected or very choppy. But once we zoom in, we can see that they're actually continuous. And if your stream work is not continuous, but it is all chopped up when you zoom in, that usually means that the DEM has errors that were not fixed by filling sinks the first time. Route DEM also automatically does a very basic sink filling as part of its processing. But if your streams are all chopped up, you can try filling sinks again. But if the streams are still not continuous after that, that probably means that you need to try a different DEM. So if we move around the map and look at some of the different streams, we can see that the MFD algorithm creates some very wide streams. That can cause problems if you are modeling riparian buffers in your land cover map, or something similar that is based on the stream network, if the streams are not actually that wide in real life. Now this is an issue that we at Matcap are aware of, but we still haven't resolved in the models. If this turns out to be an issue for your modeling, one option is to try burning narrow streams into your DEM. We won't get into stream burning here, and it can be a tricky thing to do. But just know that it's an option, and you can look for more information about it online. Okay, now let's see how this stream network compares with a river layer for Nepal that was created by Isimod from National Topographic Survey Maps. Let's go back to the sample data folder in your file explorer. Inside the folder Nepal rivers is a shapefile and metadata. Let's bring river.shp into the GIS. I'm going to make the lines on mine a little bit wider so we can see them better. Now in this case we're actually quite lucky. The stream network created by the DEM with a threshold flow accumulation value of 1000 follows the real world stream network pretty closely. They're not exactly the same, but they're not bad at all. I'd be happy to use this DEM for an analysis. And we actually did use it for a project that we did in this area. One thing to notice if we look around pretty closely is that the modeled streams often have more tributaries than the national stream layer. And we can see this a little more by turning on and off the river map. In order to improve this, the next step is to rerun route DEM with a larger threshold flow accumulation value, maybe 2000 or maybe 5000 and see how the result compares. I often need to do several iterations of refining the TFA value before I settle on one that creates a stream network that looks good enough. And then if the modeled stream network looks bad no matter what you do, try a different DEM. So this will be your homework. Rerun route DEM with different TFA values until you find one that comes pretty close to the national stream layer. If we were using this for an actual project, we would then use that same TFA value as input to whatever hydrology models were running. That's enough for this session. Now that the DEM is prepared, and we've determined that it makes acceptable streams, the final step will be delineating the watershed that is your modeling area of interest. And we will cover this in another episode. If you have any questions or comments about this episode, we'd love to hear from you on our community forum. Click to the forum in this video's webpage, where you can search for previous posts and create a new post under the category of training. I and other techies at NatCap will see your post and will respond as soon as we can. Thanks for following along.