Part 6b: The effect of scale on raster calculations mean local relief and slope

Similar documents
Lab 12: Sampling and Interpolation

STUDENT PAGES GIS Tutorial Treasure in the Treasure State

Raster Suitability Analysis: Siting a Wind Farm Facility North Of Beijing, China

Raster Suitability Analysis: Siting a Wind Farm Facility North Of Beijing, China

Using GIS to Site Minimal Excavation Helicopter Landings

Lab 12: Sampling and Interpolation

Lab 10: Raster Analyses

Lab 10: Raster Analyses

Biomapper file preparation and preliminary analysis 6 steps to create 1 0 (Boolean) files for species data in Arc Map

GY301 Geomorphology Lab 5 Topographic Map: Final GIS Map Construction

Lab 11: Terrain Analyses

Lab 10: Raster Analyses

I CALCULATIONS WITHIN AN ATTRIBUTE TABLE

T H E I N T E R A C T I V E S H E L L

Lab 11: Terrain Analyses

Customizing DAZ Studio

GIS Tools for Hydrology and Hydraulics

WORD PROCESSING ASSIGNMENT # 1 ~ FILENAME: FONTS

Lesson 8 : How to Create a Distance from a Water Layer

PART 7. Getting Started with Excel

Downloading and Repairing Data

The first thing we ll need is some numbers. I m going to use the set of times and drug concentration levels in a patient s bloodstream given below.

GEOG 487 Lesson 4: Step-by-Step Activity

Assembling Datasets for Species Distribution Models. GIS Cyberinfrastructure Course Day 3

Ex. 4: Locational Editing of The BARC

Lecture 20 - Chapter 8 (Raster Analysis, part1)

Importing GPS points and Hyperlinking images.

A Second Look at DEM s

Using Microsoft Excel

Lab 18c: Spatial Analysis III: Clip a raster file using a Polygon Shapefile

DOING MORE WITH EXCEL: MICROSOFT OFFICE 2013

CMSC 201 Fall 2018 Lab 04 While Loops

Select the Parks within Forest Acres

CS 1110, LAB 1: PYTHON EXPRESSIONS.

Module 7 Raster operations

Working with Attribute Data and Clipping Spatial Data. Determining Land Use and Ownership Patterns associated with Streams.

Exercise 1: An Overview of ArcMap and ArcCatalog

Lab 3: Digitizing in ArcMap

QUICK EXCEL TUTORIAL. The Very Basics

Basics of Using LiDAR Data

Raster GIS applications

This tutorial shows how to extract longitudinal profiles using ArcMap 10.1 and how to plot them with R, an open-source software.

2. Getting Started When you start GeoGebra, you will see a version of the following window. 1

Raster Data Model & Analysis

GIS LAB 8. Raster Data Applications Watershed Delineation

Lab 1: Landuse and Hydrology, learning ArcGIS

Making Yield Contour Maps Using John Deere Data

Use the Move tool to drag A around and see how the automatically constructed objects (like G or the perpendicular and parallel lines) are updated.

ii. From the Tools menu choose Multi-Extract

Instructions for Using the Databases

Stream network delineation and scaling issues with high resolution data

Use signatures in Outlook 2010

Introduction to GIS 2011

MIS 0855 Data Science (Section 006) Fall 2017 In-Class Exercise (Day 18) Finding Bad Data in Excel

CS 051 Homework Laboratory #2

Objectives Learn how GMS uses rasters to support all kinds of digital elevation models and how rasters can be used for interpolation in GMS.

Steps for Modeling a Proposed New Reservoir in GIS

OPTIONAL EXERCISE 2 Creating a Fusion Project Part B

Data Assembly, Part II. GIS Cyberinfrastructure Module Day 4

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

GEOG 487 Lesson 7: Step- by- Step Activity

Lastly, in case you don t already know this, and don t have Excel on your computers, you can get it for free through IT s website under software.

Spatial Analysis with Raster Datasets

INTRODUCTION TO GIS WORKSHOP EXERCISE

Field-Scale Watershed Analysis

GEO 465/565 Lab 6: Modeling Landslide Susceptibility

Using Microsoft Excel

GSSHA WMS Basics Loading DEMs, Contour Options, Images, and Projection Systems

Geography 281 Mapmaking with GIS Project One: Exploring the ArcMap Environment

Matlab for FMRI Module 1: the basics Instructor: Luis Hernandez-Garcia

Excel Basics Rice Digital Media Commons Guide Written for Microsoft Excel 2010 Windows Edition by Eric Miller

COMP : Practical 9 ActionScript: Text and Input

HOW TO BUILD YOUR FIRST ROBOT

Microsoft Excel 2007

FrontPage 98 Quick Guide. Copyright 2000 Peter Pappas. edteck press All rights reserved.

How to import text files to Microsoft Excel 2016:

Exercise Lab: Where is the Himalaya eroding? Using GIS/DEM analysis to reconstruct surfaces, incision, and erosion

CS1 Lecture 3 Jan. 22, 2018

Spatial Ecology Lab 6: Landscape Pattern Analysis

Tips and Guidance for Analyzing Data. Executive Summary

Lab 11-1 Lab User Profiles and Tracking

Geology & Geophysics REU GPS/GIS 1-day workshop handout #2: Importing Field Data to ArcGIS

Getting to Know ModelBuilder

WORD PROCESSING FOR SALE. By Shel Silverstein

Converting AutoCAD Map 2002 Projects to ArcGIS

Importing and Coordinating Models

Put the Graphs for Each Health Plan on the Same Graph

SECTION 1: INTRODUCTION. ENGR 112 Introduction to Engineering Computing

5 R1 The one green in the same place so either of these could be green.

Workshop. Import Workshop

Introduction to Geographic Information Systems Spring 2016

Introduction to GIS & Mapping: ArcGIS Desktop

Using IDLE for

Geography 281 Mapmaking with GIS Project One: Exploring the ArcMap Environment

Lab 3. Introduction to GMT and Digitizing in ArcGIS

EVALUATION COPY. Unauthorized Reproduction or Distribution Prohibited EXCEL INTERMEDIATE

FastAttach Release Notes

Watershed Sciences 4930 & 6920 GEOGRAPHIC INFORMATION SYSTEMS

Microsoft Excel 2007 Lesson 7: Charts and Comments

Creating Contours using ArcMap

Transcription:

Part 6b: The effect of scale on raster calculations mean local relief and slope Due: Be done with this section by class on Monday 10 Oct. Tasks: Calculate slope for three rasters and produce a decent looking graph comparing them. Turn in: Nothing, but I ll know if you re not done. Overview of your tasks: 1) Clip the DEMs to be the same size covering the same area. 2) Project the DEMs to a projected coordinate system. 3) Calculate a slope raster for each DEM. 4) Make histograms of the reclassified slope rasters. (More) Detailed directions 1) Your first task, as outlined above, is to clip all the grids to the same size. Search for the clip tool and use the one appropriate for rasters (hint, it isn t the one you used to clip the roads or counties in the tsunami lab). Fill in the output extent with the smallest DEM you have. Put your clipped rasters into a logical and well named location. 2) Now you need to project your rasters. Using the appropriate project tool AFTER you make sure they are all defined, project them to the correct UTM zone with a WGS1984 datum. Be sure to use bilinear for the resampling technique. 3) The next step is to calculate the distribution of slopes in each DEM. You ll do this in 3 steps: create a slope raster, reclassify the raster, and create a histogram. We will start by running the full instructions for the 15 data. If you are feeling ambitious, you may want to write a Python script to run the other files. a. Search for slope and choose the appropriate tool. What did you choose? Why? b. Open the Slope (Spatial Analyst) tool. Put in your input raster, name your output raster. Click ok. Nothing else needs to be changed. What units will your slope output in? c. We need to make a histogram now. Using the technique you did to view histograms in the tsunami lab, open the attribute table for the slope raster and look at the histogram. You probably didn t get very far because slope is a float raster. Look in ArcGIS help to see what float means in the context of a raster. Explain it in your own words below:

d. We need to have an integer raster to create a histogram. There are a few ways you can do this. One option is to use a tool that turns the raster from a float to an integer. This loses some information (everything between 0.5 and 1.5 will become 1) but takes up a lot less space and lets us make a histogram. We will do this using a tool called the Raster Calculator. Search for Raster Calculator and open the tool. e. On the right hand side, scroll down to Int under Math. Double click on it. f. Now double click on your slope (mine is called proj_slope). g. Give your output raster a good name and location. h. When it is set up like the picture below (it should say Int( proj_slope ) in the box in the middle, click OK. How long did it take to run this tool? i. Your new slope raster with only integer values will be added to your map. j. Open the attribute table for your new file (now it opens. Yeah!). k. Now you are going to see two ways to create a graph. The first one is in Arc and the second is to export the data to Excel. l. To create a graph in Arc: i. Click on the table properties in the upper left corner (the same place you added a field to your tables in the tsunami lab) and choose Create Graph. ii. Choose your integer slope raster as the Layer/Table, Count as your value field, value as your X field, and uncheck the box that says Add to legend. It should look like the picture on the next page:

iii. Click next. Give your graph a new title in the right box. If you want to rename any of the axis labels (say to turn count into slope (degrees), do that as well). Then click finish. iv. Voila! You have a histogram of your slope. Here s mine: v. Save your map if you haven t already been doing that regularly. vi. Right-click the graph and Add to Layout before closing the graph window. Alternately, you can export your data to excel from the attribute table (click the

button on the upper right and choose export to a.dbf file, then open it in Excel) and make the histogram there. m. To create a graph in Excel: i. Open the attribute table. ii. Choose Export from the dropdown menu under the word Table in the upper left. iii. Export the table as a text file give it a name and location you will remember. Be sure to give it.csv not.txt as the extension. iv. Now open Excel. v. In the file > open tool box, navigate to your file location. Open your file. vi. You now have the number of cells at each slope. You can plot this as a bar or line plot. 4) Repeat the above steps for the other DEMs. 5) We are now going to make a plot that has all your slope data as three different lines on a single Excel plot. a. Export tables from all three slope files into Excel. b. Open them all up. c. Because your DEMs have different number of cells, we are going to calculate the frequency that each slope is represented rather than the total number of cells. d. For each file, in a column to the right of the one with the number of cells (should be column B, and assuming your data start in the second row), type =b2/sum(b:b). You can then drag this down the entire column (or double click on the lower left corner to auto fill). e. Now you should have the frequency of each slope reading for each DEM. f. Make a line plot showing all three lines on a single file. Ask the internet or a classmate how to add more lines to your excel plots if you don t know how. (Hint: right click on data points and choose select data ). 6) Think back to what we talked about as the definition of mean local relief from the paper and in class. What is mean local relief in terms of operations? 7) Right. Mean local relief is the difference between the maximum elevation within a specified area and the minimum elevation. We ll use a tool called focal statistics to do the minimum and maximum calculations and then we ll subtract them with the raster calculator. 8) Instead of running all the relief calculations by hand, you are going to write a function in Python to do this.

Exercise 4 September 16, 2016 1 Functions In this exercise you will be making your own tool for calculating mean local relief. This will involve creating your own function. In past exercises you have applied many functions, and looked at the documentation surrounding functions. This should leave you well prepared to make your own functions. But before we begin, lets look at some examples. 1. Go back to some of the folders you downloaded for previous Python exercises. In the folder there should be the exercise_x.py file that you worked with. 2. At the top of that file is a line saying something like import [file_name] as XX. This loads in functions that are defined in the file file_name.py which is in the same folder. 3. Open up one of the file_name.py files in the exercise folder and look around. 4. Notice that the file is almost entirely comprised of blocks of Python script that start with something like def function_name(input_1, input_2,...): This is a function definition, something like a miniature script. It describes a set of instructions to be preformed every time the function is called, as well as a list of inputs, variables that the instructions can reference. In typical Python style, the body of the function, the set of instructions that belong to a function, is indented directly below the declaration line. 5. Now start to think about a function to calculate mean local relief. What inputs would it need? What other functions would be used in the body of the function? 6. Before class on Monday turn in some notes planning out a potential mean local relief function. This should include what inputs you want your function to have, and then the functions or tools you think you will need to 1

call, listed in the order you will need to call them. If there are intermediate files you will need to re-use. Make sure you include labeling them as a step. 2 Raster Calculator in Scripts Raster Calculator is slightly more complex than other tools. It doesn t just have an input file or two, a couple checkboxes or a dropdown list, and maybe an output location; instead, it takes a Map Algebra expression. In fact, Raster Calculator is really a tool that evaluates these expressions. In Python, you don t need a function to evaluate these expressions, you can write them directly like you would any line. The result will be a new raster, the output of the expression. Look over this page of ArcGIS documentation about using Map Algebra in Python. Pay close attention to how rasters you create with this method are saved. 3 Your first function 1. Open up IDLE and create a new Python document (File->New) 2. Save the document as my_relief.py. 3. Now begin your script with import arcpy. 4. On a new line enter your function header: def then the name of your function, the inputs you want to use in parentheses, and then : 5. Next you will write the body of your function based on the notes you wrote previously. For each ArcGIS tool you use, consult the online documentation page to figure out exactly how to call each tool. 4 Using functions Now that you ve written your function it s time to use it! However, before you can you need to know how to use functions that are defined in another file somewhere. The first way is by importing files, something that all other scripts have done. When a Python file says import arcpy, it searches through a predefined list of directories for arcpy.py and runs that script and loads in the functions and variables defined in the file. This allows us to run tools like arcpy.selectlayerbylocation_management. When python executes an import statement it also searches the current working directory, which is the folder that Python is working in, and it considers all files as relative to it. When you run the interactive IDLE prompt, it has a specific preset current working directory, and when you run a file like exercise_3.py, the current working directory is the same as the directory that the file is in, which is why in when it says import selection_script 2