 Hello, I'm Stacey. 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 Services Modeling Toolkit. In this episode, we'll talk about creating watersheds. 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 QGIS, and we'll be working with some sample data, which is linked to on the webpage for this video. Also in this episode, we'll be using one of the Invest tools, so make sure that Invest is installed and working. 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 a QGIS session saved from those earlier episodes in Nepal, you can use it again now. If you don't, that's totally fine too. Just open up a new 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 a QGIS session before continuing. Creating watersheds is the last step in processing the hydrology related layers that go into Invest models. As a reminder of the workflow, we usually start out with raw DEM tiles, which we merge into a mosaic. Then we check the mosaic for missing data. We project it to the project's coordinate system, fill sinks, and verify that it makes an acceptable stream network. At this point, we probably feel comfortable using it for our analysis, so we can commit to creating the watershed that we'll use for our area of interest in the model. A watershed represents the upslope area that creates streams that drain into a particular point on the landscape. Often when we are running hydrology models, we are interested in evaluating the landscape that provides water, sediment or nutrient to a reservoir, a drinking water facility, a community, or some other point of interest. This point is called the outlet of the watershed, and it's indicated by a star in the map that you see here. And in this map, that's actually the town of Belmopon, the capital city of Belize. Even if we are not focused on a specific point, most of the hydrology models recommend that we provide an entire watershed as the area of interest. Because if we don't use a watershed, but instead use something like an administrative boundary, it will probably artificially cut off some of the drainage area. Interrupting the flow path so that the result does not capture all of the water, sediment or nutrient is actually contributing to water quality or water quantity in the streams within the landscape that you're studying. In the example that you see here, we were working with partners in the western part of Belize, and we were informing policy that would only affect Belize. But there was a focus on water related services. And it turns out that a large part of the watershed draining into the city of Belmopon is actually in Guatemala. There's even one major river, the Mopon, down here in the southern part that starts out in Belize, travels into Guatemala, and then comes back into Belize. So the water quality and quantity that arrives to Belmopon is actually very much dependent on what happens in Guatemala too. So even though we were informing policy in Belize, we actually modeled this whole watershed that you see. And if you look at where the border is, if we had only modeled hydrology inside of the border of Belize, we would only be seeing part of the picture. So we can see how the rivers would be artificially cut off. And especially we would be missing the effect of the Mopon River, which would just drain off the map, instead of contributing water to Belmopon. One side note is that right now we are only talking about watersheds. But two of the urban models flood risk and stormwater retention can take either watersheds or sewer sheds as the area of interest. Now where a watershed represents natural topography flowing to a single point, a sewer shed represents an area in an urban landscape where all of the sewers drain to a single point. Maps of sewer sheds are not based solely on topography or digital elevation model, so we will not be covering them in this tutorial. What we will cover is creating watersheds from a DEM using the invest tool delineated. Now, of course, there are many other tools that we can use to create watersheds, including those provided by our GIS software. And if you have a favorite one that works for you, great, feel free to use it. I use delineated because it is simple to use, it works well, and it can generate watersheds that overlap, which is sometimes useful for ecosystem service analysis, like when your points of interest all lie on the same river. The geospatial inputs to the tool are a digital elevation model or DEM and the point location of the outlet or outlets that you're generating watersheds for. It's important to make sure that you use the same DEM to create your watershed as you are using as input to the hydrology model. So in other words, the same DEM as you're using as input to the SDR, NDR, or seasonal water yield models. Because if you use a different source for your watershed, it might not line up correctly with hydrology that is generated by the model, and the results that are aggregated within that watershed will not be accurate. Delineated also takes in a threshold flow accumulation or TFA value, which is used to create the stream network. Threshold flow accumulation is a number that defines the number of upstream pixels that must flow into a particular pixel for it to be considered part of the stream. Another way of thinking about this is that it defines the upslope contributing area that's required for a stream to form. Large values of TFA create a stream network with fewer tributaries, like you see in the picture on the top, and a small values of TFA create a stream network with more tributaries, like you see in the image on the bottom. For creating watersheds, it's important to choose this value so that the streams are created in the right place to correspond with your points of interest. The next input, snapping distance, is also related to streams. It's very common that the location of our outlet point is not exactly on top of a stream generated by the model. This can happen for a variety of reasons, but when it does happen, the watershed that is created by the tool tends to be extremely small, much smaller than in real life, because it's not recognizing the whole stream network flowing to that point. The snapping distance allows the tool to search for the nearest stream around the outlet point and move or snap the outlet point to that stream so that a correct watershed can be generated. If you are only using one or a small number of outlets in the tool, you could instead manually edit the location of the outlet so that it lies exactly on the stream that the model generates. But if you have a lot of points, or you just don't want to manually edit the points, you can use this feature. The output of delineated are the watersheds flowing to your outlet points. And as you can see in this map, it can make many watersheds at a time, or it can just make one if that's all you need. For one of our projects, I made thousands of watersheds using this tool. What you'll notice about many of the watersheds in this particular example is that they do run up against the country border of Mozambique. But in reality, they drain across many other African countries. Now for this project, the stakeholders decided only to model within the border of Mozambique with the understanding that most of the water flowing to these dams originates outside of its borders. We actually did this differently than we did in Belize. Okay, let's go look at our sample data in the GIS. All right, let's open a file explorer to the sample data folder, which is called creating watersheds data. And inside this folder are two layers. The DEM that we've prepared for use and invests, and a shape file with a point location for a dam, which we will create a watershed for. Let's bring both of these layers into the GIS. DEM filled dot TIF, and dam intake dot SHP. I'll change the symbology for the dam intake so we can see it better. So right click and choose properties. And then I'm going to change the size to four millimeters. And give it a color of yellow, and then click okay. Now let's use these layers as inputs to delineate it. You can launch delineate it in the same way that you do other invest tools. I'll do this through the window start menu. And if you're using Mac, then you'll know how to do it a bit differently. So we'll just go into the invest model folder. And scroll down to delineate it and open that tool. All right, for the workspace, let's navigate to where we want our output files to be written. Let's create a new folder. And I'm going to call it delineate it, delineate it underscore output. Okay, you can call it something different if you like, but I'm going to create a new folder called delineate it output and select that as your workspace. For the results suffix, let's keep it simple and just enter the string down dam. So for digital elevation model, let's drag in the layer dem filled dot tiff from our file explorer. And then this next box detect poor points, we're going to leave this box unchecked. If you select detect poor points, the model will try to find outlets based on where streams flow off the edge of the raster. But we have our own outlet point already created. So we'll use that instead, and we'll put that in the outlet features box. So let's drag in dam intake dot shp. We will check the box next to skip invalid geometries. This way, if the tool finds an outlet point or polygon that is invalid, it will skip it and move on to the next one. If this box unchecked, then the tool throw an error if it encounters an invalid geometry, and it will not continue. Right, we will also check the box next to snap points to the nearest stream. As I mentioned earlier, it is common that our outlet points are close to, but not quite on top of the streams that are generated by invest. We can tell the tool to snap our points to the nearest stream before delineating the watershed. When we check this box, now two more inputs are required. The first is the threshold flow accumulation, which is the same that we use in the water models. And for this example, we're going to use a value of 1000. Next is the pixel distance to snap outlet points. The value is given in a number of pixels, and we will give it a value of five. This means that the tool should search for five pixels in all directions of the outlet point to find the nearest stream. Since our pixels are 30 meters in size, this equates to searching in a radius of 150 meters around each point. Sometimes you need to try several values for this input before all of your outlet points snap correctly, so just note that you may need to play with this. All right, let's hit run. As with other tools that process hydrology layers, delineate it can take a while to run. So feel free to pause this video until yours is finished. Once that tool is finished, let's click the open workspace button in the output folder. The first three rasters are related to hydrology processing, the field DEM, the flow accumulation, and the flow direction. The next output is pre processed geometries, which is in G package format. This is the set of outlet geometries that the model found to be valid and created watersheds for. Now we'll look at the rest of the outputs in the GIS. First, let's bring in streams underscore damn dot tip and check it out. Now as usual when zoomed out like this the streams look very chopping. But if we zoom in, we see that they're actually continuous, which is good. If they were not continuous, we would need to do work on our DEM. And there are separate video tutorials that cover the DEM and creating streams. So please see those for more information. Now let's look at the watershed created by the tool. Back in our file explorer, bring in watersheds underscore damn dot G package into the GIS. And also bring in snapped outlets down. Right, and I'm going to zoom back out to the watershed layer. Let's change the symbology of the watershed layer so that we can see the streams underneath. I'm going to do a fill color of transparent fill. And I'm going to make the out edge a little bit thicker. And I'm going to choose a bright color that I can see relatively well so you can choose whatever colors work for you. So once we've zoomed to the watershed layer, we can see what it looks like. The tool created a rather large basin that looks reasonable to me based on the stream network. So if you happen to know what the basin should look like, you can critique the watershed that the tool creates, and either adjust some of the input parameters to get a better fit. Or it may be that you need to use a different DEM, because this one doesn't represent your hydrology very well. But for now, we'll just call this watershed good. Let's zoom way in to look at the snapped outlet point. I'm going to change the symbology of mine so that we can see it better. Let's see for this one, I'm going to pick a bright pink. And let's also make sure that the original DEM intake point is visible. So I just moved mine up to the top of the drawing stack. Notice how the original point which is in yellow on my screen was close to but not right on top of the streams that are generated by delineate it. And the snapped outlet which is in pink here is right on the stream. So a good watershed could be created. For homework, I suggest that you rerun delineate it without snapping the original DEM point location. That way you can see the small, strange looking watershed that's often created when the outlets and the streams don't overlap. So that's your homework. Rerun delineate it without snapping the outlet point and look at the difference. Now that we've created the watershed that we use as inputs in the model, we'll generally want to use it to clip our other spatial inputs to the same area of interest. What I usually do is clip the DEM using this same watershed polygon. Then I create a new polygon with a small buffer around the watershed, which I use to clip the other spatial inputs. This is especially important if any of your other spatial inputs are coarse in resolution. This is often the case with climate data, for example. So let's look at a globally available reference evapotranspiration layer from CGIAR. All right, let's go back to our file explorer window. And in the sample data folder is a sub folder called ET0 CGIAR. Now here I've provided just one of the raw datasets from CGIAR, which represents reference evapotranspiration for the month of January. This raster could be used as input to the seasonal water yield model or the urban cooling model. So let's bring this layer into the GIS. And then we're going to zoom back to the extent of the watershed layer. So the resolution of this raster is 30 arc seconds, which is approximately one kilometer at the equator. This is much coarser than 30 meter resolution of our DEM. So let's see what happens when we clip the ET0 raster using the watershed that we just generated. Let's go to the raster menu. And then down to extraction. And open the tool clip raster by mask layer. Our input layer will be the ET0 raster. And then the mask layer is watersheds down, which may already be selected for you like it is for me. And then we can leave all of the other inputs as their defaults. But we need to scroll down to the clipped entry. Which is where we specify our output file. So let's say save to file and navigate to wherever you want to save your output files. I'm going to keep them here in my main tutorial folder for creating watersheds. And I'm going to name the file ET0 underscore 01 underscore clip.tif. And a reminder that the 01 in the file name refers to the data being for the month of January. So it is important to keep this information. Right, let's click save and click on run. Once it's done, click on the close button. And let's look at the clipped ET0 layer. All right, I'm going to turn off some of our other layers so we can really focus on the ET0. In general, it looks pretty good to me. But let's zoom in to look around the edge of the watershed. And I'm going to make sure the watersheds are on top of this ET0 layer. Since the pixel size for the ET0 layer is large, when it is clipped, we end up with a lot of missing data around the edge of the watershed. And this is actually a problem for the model because we want to include all of the area within the watershed so that we capture all of the hydrology correctly. Now by comparison, let's do the same thing and clip the DEM layer to the watershed polygon and see how it looks. So let's open that tool again. Let's go to raster and extraction and clip raster by mask layer. This time our input layer is the DEM. And again, the mask layer is the watershed. Now we'll scroll down to the clipped entry and say save to file. And I'm going to name this file DEM underscore clip dot tiff and click run. Let's give the DEM a new color so we can see it a little bit better. I'm going to go into the symbology and say single band pseudo color. And I'm just going to leave it with this purple color that's there by default. Okay, it doesn't matter which one you choose. Now what we can see here is how well the DEM fills the edges of the watershed. Now this is not surprising since the watershed was created from the DEM. So if we turn on and off the DEM layer, we can really see this difference. And maybe let's move the DEM under our ET zero layer so that we can see the purple from the DEM poking up in the gaps, where we are missing ET zero data. We can see that there are a lot of gaps along the edge where we have DEM, but we have no evapotranspiration data. To fill these gaps, we can create a buffer around the watershed and use it to clip our course input rasters. So let's do that. Let's go to the vector menu and select geo processing tools, and then buffer for input layer. Let's enter our watershed layer. So it should be watershed down. For distance, let's enter two kilometers. This will create a two kilometer buffer around the watershed, which is the distance of two pixels in our ET zero layer. I usually make the buffer size equal to one or two times the largest pixel size of my input layers. In this case, the ET zero layer has a pixel size of one kilometer. So I'm specifying a buffer size of two kilometers. And we'll leave the other inputs as their default. We'll go down to the buffered entry and say save to file. Let's call it watershed underscore two kilometer underscore buffer dot SHP and hit run. All right, we can close this window. And again, I'm going to change the symbology so we can see things better. Let's call color of transparent fill and then set my color to some nice bright value. See maybe something orange. Okay. And say okay. Now we can re clip the ET zero layer with this buffered watershed. So let's go back to the raster menu. I'm going to go ahead and select extraction. And open the tool clip raster by mask layer. The input layer is the original layer, which is ET zero B three zero one dot tip. The mask layer. We want to make sure that we have the buffered watershed so watershed two kilometer buffer. We'll leave the rest of our inputs as default and go down to the clipped entry where we will say save to file. And let's name it ET zero underscore zero one underscore buffer underscore clip dot tip and hit run. And I'm going to move this down so that we can see our watershed outlines more clearly. So if you look closely at the edge of the original watershed, which is shown on my screen in blue, we see that the ET zero layer now completely fills it. There are no gaps of missing data around the edge of the watershed. And that's what we want. We want to make sure that you still need to re project this layer to match the projected coordinate system of the other layers before it can be used in the models, but we won't do that now. And when you enter data into the hydrology model, you will provide the DEM that is clipped to the original watershed, which is our purple one here. We want to provide the coarser layers like ET zero that are clipped to the buffered watershed. So they completely fill the watershed outline. And don't worry that this ET zero layer is now larger than our DEM and larger than the watershed. We have two calculations where all of our input layers have data. So the results should only cover the extent of the DEM, which covers the extent of the watershed, and that is hydrologically complete. Okay, that's enough for this session. We've now covered all of the major steps in creating hydrology inputs to invest models. We've processed the DEM, evaluated the stream network and created the watershed that will be our area of interest. If you have any questions or comments about this episode, we'd love to hear from you on our community forum. There's a link 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 Nat Cap will see your post, and we will respond as soon as we can. Thanks for following along.