 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 is used by the Invest Ecosystem Services modeling toolkit. This episode provides an introduction to working with digital elevation models. 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. And in several previous episodes, 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, then 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 an ArcGIS session before continuing. The digital elevation model or DEM is a raster with an elevation value for each pixel. A DEM is required by the freshwater models NDR or nutrient, SDR or sediment, and seasonal water yield. And for these models, it's important that the DEM represent the areas hydrology correctly. Coastal vulnerability also requires a DEM, but it's not as important to get the hydrology correct for that model. A DEM can be obtained from many different sources, and often these sources have global coverage like NASA or hydro sheds. And if you compare multiple DEMs in the same place, you'll find that each one is different, some more accurate than others in that particular location. Then if you look at a different location, you may find that some other DEM is more accurate. So they are highly variable, but one thing that's pretty much guaranteed is that none are perfect. I have never found a DEM that perfectly matches a real-world stream network, and many don't even come close. So be aware that you may need to try several before finding one that works well enough for your purposes. Regardless of the DEM that you decide on, you'll probably need to do several steps of preparation before it's ready to be used with an investment model. These steps include merging raw DEM tiles into a mosaic, checking for missing data in that mosaic, projecting to whatever coordinate system you're using for your analysis, filling sinks, verifying the stream network that's created from that DEM, and creating watersheds that will be the area of interest that you use for your modeling. Now in this tutorial, we will work through the first four of these steps, and to keep each episode from being too long, we'll cover the next steps like creating the stream network and watersheds in separate videos. Along with this video, the Invest User Guide has a section called Working with the DEM, which provides an overview of the different steps involved, as well as the methods and GIS tools that can be used. A link to that User Guide chapter is included in this video's webpage. Alright, let's go to a GIS session now and work through some of these steps. Open a file explorer window to the folder containing our sample data. The sample data folder is called Preparing the DEM data. Inside of this folder are five rasters with Aster G DEM data, along with a paper describing the dataset. I downloaded these tiles from NASA, the US Spacia Agency, which provides several global DEM products. Now let's drag and drop all five of these two layers into our GIS. The DEM data can be pretty large. It is broken up into smaller tiles. And so we often need to download multiple tiles to cover our entire study area. In this case, for the area that we're modeling in Nepal, we need five tiles to cover the whole watershed that we're interested in. Well, because the invest models require just a single DEM raster as input, we will need to combine these tiles into one raster. To do this, we'll use the mosaic to new raster tool. So let's go to data management tools, and then raster, and then raster dataset. And then we're going to open up the tool that's called mosaic to new raster. The first input are the input rasters. So we're going to drag all five of these rasters into the tool. Now, in this case, the output location only refers to the folder where you want to save the output raster. It does not refer to the raster itself, and this can be a little confusing. So let's navigate to whatever wherever you want to save your data. I'm going to save it in the same place that I have my sample data. And I'm going to create a new folder. That's called DEM underscore output. Now, of course, you can name it something different, but this is what I'll name it. And we'll just single click on that folder and then say add. Next is the actual raster file name. Often I am a big fan of giving very explanatory file names, but let's keep it short for right now and I'm going to call it just DEM underscore mosaic. Now, we're going to save this as a TIFF file. Now the spatial reference is the coordinate system that we want the output to be in. And for now we won't set that. We'll do the reprojection step separately, and we have a good reason for doing that. All right, for pixel type, we need to choose the same type that the input rasters have. And for some reason, by default, ArcGIS does not pick up on this. So let's just right click on one of these tiles. Any one of them is fine and go down to the properties. And if we click on the source tab, we can look at the pixel type, which is signed integer, and the pixel depth, which is 16 bit. All right, so now we know that the data type is a 16 bit signed integer. All right, we can cancel this. And under the pixel type, let's choose 16 bit signed. All right, for the cell size, we don't need to specify this. It's optional because the tool will detect it automatically. For number of bands, we will type in a value of one. And since this raster, the rasters only have one band, and that band contains the elevation data. For the last two entries, I usually leave them as the defaults. Sometimes it's useful to choose a different mosaic operator, especially if you run the tool and the output maps have problems along the edges, where the tiles are stitched together. Now, usually this is not a problem. So we're going to leave them as the default. Let's click OK to run the tool. And then we can close this window. Now we have a stitched together DEM raster. One thing that it's worth doing at this point is to make sure that there are no holes or areas of missing data in the map. One quick way to do this is through symbology. So let's open up the properties window and click on the symbology tab. And there's an option in this window called display no data as. And we can pick a color. And if you set this to a very bright, very obvious color, it will let us see if any pixels have a value of no data within our study area. This is a color that works well for you. I'm going to choose this very bright pink color and say OK. Now we can take a quick scan around the map. The first thing we can see is that there are areas of no data right along the edges of the map. And of course, in this big area where we have no DEM data. And that's perfectly fine. What we're concerned about is if there are any no datas within the area where we have elevation data. So we can zoom in a little bit, and we can do a quick pan around, and we can verify that it looks like we aren't missing any data within our area of interest. So that's great. Now if we did find no data within the study area, then we'd need to consider how to fill them, since having holes can cause lots of problems with hydrology models. Sometimes it causes them to throw an error. And even if there is not an error, the missing data will interrupt the flow path in that part of the watershed, which will lead to incorrect results. Now learning how to fill holes in DEM data is a whole other world that we won't get into right now, since it's not required very often. But you can get ideas for how to deal with them by reading the user guide section, working with the DEM. Now that we have our mosaic tiles, the next step is to re-project this DEM to have the same projected coordinate system that we are using for our analysis. So let's open up the re-project tool by going to the toolbox, projections and transformations, raster. Now we're going to open up the tool, project raster. Our input raster is the mosaic DEM that we just created. And I called this DEM mosaic.tif. So I'm going to drag that into the interface. To do that, the tool will automatically populate the input coordinate system for us. And we can see that currently it has this very standard geographic coordinate system of WGS 1984. All right, next we'll define the output data set. So again, let's navigate to the folder where we're storing our tutorial data. I'm going to keep using the folder that I just created called DEM underscore output. And I'm going to call this output raster DEM underscore projected.tif. All right, so DEM underscore projected.tif. And hit save. So we talked about coordinate systems in a previous episode. Suffice to say now that it is up to you to choose the coordinate system that you will use for your project. And you need to make sure that all of your spatial data uses it. The data models and invest require that all layers have the same projected coordinate system, not a geographic coordinate system. And one very standard projected coordinate system is UTM. And that's what we'll use now. So over here next to output coordinate system, click on this box. This area in Nepal is in UTM zone 45 north. So the easy way to do this is to type this in at the search bar at the top of the window. So type in UTM zone 45 N. And then hit your enter key. All right, so it will provide you with whatever options you have that it has that fit your search string. So we'll expand this projected coordinate system tab. Then we'll expand UTM and WGS 1984. Northern Hemisphere and there we go. We have UTM zone 45 north. Now let's click okay. We don't need to supply a geographic transformation. So in this case, it is very important to select a different resampling technique, even though it says that it's optional. Because by default, the tool use nearest neighbor resampling. And that works great for categorical data like land use, and it can be used in many cases, but it should not be used for resampling DEM data. So in this example DEM data with nearest neighbor, the hydrology layers that are derived from the DEM like flow direction and flow accumulation will probably have this weird grid pattern to them that is very incorrect. And that leads to the creation of bad flow patterns, bad streams and bad model output. So I usually use bilinear. So in this case, let's just select bilinear. Next is the output cell size. From reading the Aster G DEM documentation, which is included in the tutorial sample data, I know that the data resolution is 30 meters. Now the tool automatically populates with a value that is very close to 30, but not quite. Similarly, I prefer my data resolution to be in nice round numbers. So I'm going to type in 30 for the X cell size and 30 for the Y. It's a good time to note that the freshwater models that use a DEM, which is SDR and ER and seasonal water yield. For example, all of your other spatial inputs to match the resolution of the DEM. And your output rasters will have the same resolution as your DEM. So just remember that. Now finally we do not need to set a registration point. So we can just click OK. Right, I'm going to turn off some of these other layers. Now one thing to note is that the output raster has slightly different high and low values than the input mosaic did. That's a result of the bilinear resampling that's done during reprojection, and that's generally okay. Now the last thing we'll do in this tutorial is fill sinks in the DEM. These are errors in the DEM data where one pixel is much higher or much lower in elevation than the pixels around it, and that's not how it really is on the landscape. Now sinks cause all sorts of problems when modeling hydrology, but we can usually fix them using the ArcGIS fill tool. So let's go down to spatial analyst and under the hydrology section. We have a tool called fill. Let's open up the fill tool. Now the input surface raster is our projected DEM. And for output surface raster. We'll do the same thing of navigating to our output folder. We're going to call it DEM underscore fill dot TIF. DEM underscore fill dot TIFF. And I've never had a reason to use the Z limit option. So we're just going to leave that blank. Now click okay. The fill tool can take a long time to run, especially if you are using a DEM that's very large, or that's very high resolution. Now I'll just hang out here for a minute while it runs, but feel free to pause the video if yours is taking longer. All right, again, we can look at the high and low elevation values. It now looks like the low value is much different. So the tool seems to have filled the pixels that have those negative elevation values. And that's probably a good thing because we are working in the Himalaya. And so we probably don't have any areas that are below sea level. Now one thing to do is to click on and off the filled layer. When you do that, can you see these dark areas right in here where my mouse is circling. I'm going to zoom in the projected layer, but they're not so visible in the filled layer. Let's zoom into one of those and let's see what's going on. I'm going to zoom into these spots right here, but it doesn't really matter where you zoom into just pick some of these areas that are very dark. And let's use the identify tool to see what the different values are. Right now we're just going to look at the DEM projected layer and I have turned off the filled layer. So let's see what the original value is inside one of these really dark pixels with very low elevation values. The elevation value inside of this for the pixel I clicked on is 568 meters. Now if we click just outside of this area, the elevation value is 5,422 meters. Now that is a really big difference. And even though we're working in the Himalaya, it's probably not what's actually happening on the landscape. So let's close that and turn back on this filled layer. Now if we click inside of this area, we see that the filled value is now around 5100 meters. And that's significantly different than the 568 meters that it was before being filled. Right, so that 5100 meter value seems much more reasonable. But of course we do need to keep in mind that this is the Himalaya. So if you this was a real world project, one thing you could do to verify would be to use a satellite base map to visually inspect this area. Right, but we won't do that now, you can do that on your own for homework. Okay, that's enough for this session. Now that the DEM is prepared, the next steps involve creating a good stream network and delineating the watershed that is your area of interest, and we will cover these in future episodes. 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'll respond as soon as we can. Thanks for following along.