Scripting and Geoprocessing for Raster Analysis Multiyear Crop Analysis

Similar documents
Geospatial Data Model for Archaeology Site Data

GIS CONCEPTS ARCGIS METHODS AND. 3 rd Edition, July David M. Theobald, Ph.D. Warner College of Natural Resources Colorado State University

Assessment of Physical status and Irrigation potential of Canals using ArcPy

Geospatial Data Sources. SLO GIS User Group June 8, 2010

GIS CONCEPTS ARCGIS METHODS AND. 2 nd Edition, July David M. Theobald, Ph.D. Natural Resource Ecology Laboratory Colorado State University

Yanbo Huang and Guy Fipps, P.E. 2. August 25, 2006

Analyzing the Earth Using Remote Sensing

Geospatial Technologies for the Agricultural Sciences

Watershed Delineation

ArcGIS Enterprise: What s New. Philip Heede Shannon Kalisky Melanie Summers Sam Williamson

Python Raster Analysis. Kevin M. Johnston Nawajish Noman

GIS Quick Facts. CIVL 1101 GIS Quick Facts 1/5.

Visualization of Origin- Destination Commuter Flow Using CTPP Data and ArcGIS

Outcrop suitability analysis of blueschists within the Dry Lakes region of the Condrey Mountain Window, North-central Klamaths, Northern California

Department s. With Model Builder

ArcGIS Enterprise: What s New. Philip Heede Shannon Kalisky Melanie Summers Shreyas Shinde

SoilView: Development of a Custom GIS Application for Publishing Soil Surveys

Outline. Chapter 1. A history of products. What is ArcGIS? What is GIS? Some GIS applications Introducing the ArcGIS products How does GIS work?

GIS Boot Camp for Education June th, 2011 Day 1. Instructor: Sabah Jabbouri Phone: (253) x 4854 Office: TC 136

An Internet-based Agricultural Land Use Trends Visualization System (AgLuT)

NR402 GIS Applications in Natural Resources

Introduction to the 176A labs and ArcGIS Purpose of the labs

Harrison 1. Identifying Wetlands by GIS Software Submitted July 30, ,470 words By Catherine Harrison University of Virginia

Targeted LiDAR use in Support of In-Office Address Canvassing (IOAC) March 13, 2017 MAPPS, Silver Spring MD

Display data in a map-like format so that geographic patterns and interrelationships are visible

GIS IN ECOLOGY: ANALYZING RASTER DATA

Spatial Data Analysis with ArcGIS Desktop: From Basic to Advance

Esri UC Talking Points. Harmful Algae Blooms (HABs) Rapid growth, blooming of toxin producing algae

GIS IN ECOLOGY: ANALYZING RASTER DATA

Title: High resolution geographical information system for assessing vineyard site suitability

Rio Santa Geodatabase Project

DROUGHT ASSESSMENT USING SATELLITE DERIVED METEOROLOGICAL PARAMETERS AND NDVI IN POTOHAR REGION

Course overview. Grading and Evaluation. Final project. Where and When? Welcome to REM402 Applied Spatial Analysis in Natural Resources.

Terrain and Satellite Imagery in Madre de Dios, Peru

Exercise 6: Working with Raster Data in ArcGIS 9.3

Urban Growth Analysis: Calculating Metrics to Quantify Urban Sprawl

Fusion of Geodesy and GIS at NOAA s National Geodetic Survey

Generating Scheduled Rasters using Python

Introduction. Project Summary In 2014 multiple local Otsego county agencies, Otsego County Soil and Water

DP Project Development Pvt. Ltd.

An Introduction to the Community Maps Information Model

10/13/2011. Introduction. Introduction to GPS and GIS Workshop. Schedule. What We Will Cover

COURSE SCHEDULE, GRADING, and READINGS

Lecture 2. A Review: Geographic Information Systems & ArcGIS Basics

Leon Creek Watershed October 17-18, 1998 Rainfall Analysis Examination of USGS Gauge Helotes Creek at Helotes, Texas

IMPERIAL COUNTY PLANNING AND DEVELOPMENT

Louisiana Transportation Engineering Conference. Monday, February 12, 2007

Development of a Web-Based GIS Management System for Agricultural Authorities in Iraq

GeoWEPP Tutorial Appendix

Chapter 6. Fundamentals of GIS-Based Data Analysis for Decision Support. Table 6.1. Spatial Data Transformations by Geospatial Data Types

The GeoCLIM software for gridding & analyzing precipitation & temperature. Tamuka Magadzire, FEWS NET Regional Scientist for Southern Africa

Introduction to Spatial Data Resources and Analysis for research in Urban Design and Planning

Modeling the Rural Urban Interface in the South Carolina Piedmont: T. Stephen Eddins Lawrence Gering Jeff Hazelton Molly Espey

The Geodatabase Working with Spatial Analyst. Calculating Elevation and Slope Values for Forested Roads, Streams, and Stands.

CHAPTER VII FULLY DISTRIBUTED RAINFALL-RUNOFF MODEL USING GIS

Automated Map Book Production Workflow: Using ArcGIS and Python Programming

Spatial Analysis in Your Browser

Visualization of Commuter Flow Using CTPP Data and GIS

Introduction to the 176A labs and ArcGIS

Performing Advanced Cartography with Esri Production Mapping

Drought Estimation Maps by Means of Multidate Landsat Fused Images

Using Geographic Information Systems and Remote Sensing Technology to Analyze Land Use Change in Harbin, China from 2005 to 2015

Delineation of high landslide risk areas as a result of land cover, slope, and geology in San Mateo County, California

Land-Use Land-Cover Change Detector

Geostatistics and Spatial Scales

Improvement of the National Hydrography Dataset for US Forest Service Region 3 in Cooperation with the National Forest Service

Geodatabase An Introduction

Administering your Enterprise Geodatabase using Python. Jill Penney

SWAMP GIS: A spatial decision support system for predicting and treating stormwater runoff. Michael G. Wing 1 * and Derek Godwin

Delineation of Watersheds

The 2020 Census Geographic Partnership Opportunities

Examining the relationship between snow cover and reservoir storage in the American River basin

Investigation of the Effect of Transportation Network on Urban Growth by Using Satellite Images and Geographic Information Systems

Introduction INTRODUCTION TO GIS GIS - GIS GIS 1/12/2015. New York Association of Professional Land Surveyors January 22, 2015

4. GIS Implementation of the TxDOT Hydrology Extensions

Geographical Information Systems

HYDROLOGIC AND WATER RESOURCES EVALUATIONS FOR SG. LUI WATERSHED

The Emerging Role of Enterprise GIS in State Forest Agencies

Sources of Imagery and GIS Data Layers (Last updated October 2005)

Monitoring Vegetation Growth of Spectrally Landsat Satellite Imagery ETM+ 7 & TM 5 for Western Region of Iraq by Using Remote Sensing Techniques.

Environmental Systems Research Institute

Software requirements * :

ArcGIS Pro: Analysis and Geoprocessing. Nicholas M. Giner Esri Christopher Gabris Blue Raster

SIE 509 Principles of GIS Exercise 5 An Introduction to Spatial Analysis

Welcome to NR502 GIS Applications in Natural Resources. You can take this course for 1 or 2 credits. There is also an option for 3 credits.

ArcGIS for Desktop. ArcGIS for Desktop is the primary authoring tool for the ArcGIS platform.

Introducing GIS analysis

GIS Semester Project Working With Water Well Data in Irion County, Texas

Lecture 9: Reference Maps & Aerial Photography

MERGING (MERGE / MOSAIC) GEOSPATIAL DATA

Introduction to Geographic Information Systems (GIS): Environmental Science Focus

Erosion Susceptibility in the area Around the Okanogan Fire Complex, Washington, US

Giant Kangaroo Rat Dispersion Analysis

Hydrology and Watershed Analysis

Python Scripting for Regional Land Use Data Management and QC Workflow

Acknowledgments xiii Preface xv. GIS Tutorial 1 Introducing GIS and health applications 1. What is GIS? 2

Write a report (6-7 pages, double space) on some examples of Internet Applications. You can choose only ONE of the following application areas:

Time Series Analysis with SAR & Optical Satellite Data

WHAT MAKES A GOOD GIS LAB EXERCISE? Robert N. Martin

A Comprehensive Inventory of the Number of Modified Stream Channels in the State of Minnesota. Data, Information and Knowledge Management.

Transcription:

Authors: David T. Hansen and Barbara Simpson Scripting and Geoprocessing for Raster Analysis Multiyear Crop Analysis Presented by David T. Hansen and Barbara Simpson at the ESRI User Conference, 2012, San Diego California, July 26, 2012 Abstract Python scripting and the ArcGIS geoprocessing environment provide the ability to rapidly process raster data along with vector data for evaluation and analysis. Scripts or tools developed for the analysis are readily transferable for use in other geographic areas or for other time periods of interest. This presentation discusses the use of scripting and geoprocessing tools for analysis of irrigation and cropping patterns in a portion of the Central Valley of California between 1999 and 2005. While this particular application relied on TM 30 meter satellite scenes at monthly time steps for the time period of interest, the tools have also been applied with other imagery sets for other parts of the Central Valley and other areas. Introduction Imagery is a common source of data for use in the GIS environment. There is a massive amount of public domain imagery available for processing and analysis with other GIS data including vector data. This raster data can be valuable for evaluating change for an area. Raster data from the same source has consistency in data structure, data format, and coordinate system. Scripts can be easily set up to manipulate the separate image files to perform a sequence of analysis for different time periods. This consistency can assist in addressing the same or similar image sources for entirely different areas as well as different time periods. Irrigation status and land use change in the Central Valley of California has been of interest for the U.S. Bureau of Reclamation (Reclamation). One area of interest for the time period 1999 to 2005 is near Stockton, California in San Joaquin County. The California Department of Water Resources (DWR) does periodic mapping of crops for agricultural areas of California. This crop mapping at a scale of 1:24,000 has been an excellent source of crop information for the year in which the DWR survey is done. The most recent survey for this particular area was 1993. By 2011 when Reclamation was attempting to collect irrigation and land use information, the area had experienced considerable urbanization and changes in cropping patterns. The only consistent source of information for the time period 1999 to 2005 is LandSAT 30 meter TM imagery from LandSAT 5 and LandSAT 7. This is supplemented with 1 meter NAIP imagery for 2005. Available monthly TM imagery for the period of interest (1999 to 2005) was downloaded from the USGS GLOVIS data site (http://glovis.usgs.gov ) as single band data. Bands 3 (red band) and 4 (near infrared band) are processed with the raster calculator tool to produce a raster of a calculated normalized difference vegetation index (NDVI) for each 30 meter raster cell for the entire scene. The monthly NDVI rasters are then processed

further for particular areas of interest and summarized based on representations of field borders. A similar process was followed for a portion of Fresno County for the time period of 2009 to 2011. Processing for periods of interest were facilitated by the development of script tools to produce the monthly NDVI rasters and summary statistics for a particular area of interest. The flexibility of the geoprocessing environment with script tools and model builder permits the application of these tools from one area to another as well as from one time period to another time period. Figure 1 shows the approximate areas within the Central Valley where these script tools were applied. Raster Analysis with Script Tools and Map Algebra For both areas of interest, single monthly TM scenes were downloaded from the USGS data site. Each scene was downloaded with a single raster for each TM band. For the separate time periods of interest, some scenes were not available due to cloud cover, fog,

or smoke. The effective areas of interest were covered by one scene. Relying on one scene meant that merging of adjacent scenes was not required and a scripting tool was not developed to address this situation. During the sequence of satellite passes over an area, the effective path of the scenes migrates. Scenes from different time periods will not match. However, since NDVI values were to be calculated on a monthly basis and not between months, a snap and extent raster to ensure common registration of the cells were not defined for this initial processing. This process step is suitable for developing a script tool. The process step is repeated several times for different scenes and different time periods. Scripting permits additional control in standardizing conventions of data outputs for additional processing. The following is an example of a script tool developed for this initial step. # Script for processing tables of crop data # D. hansen # Development of an NDVI raster based on the input of rasters of near infrared # and red bands of imagery # April 7, 2011 import arcpy import sys, os, string from arcpy.sa import * ## For variables and assignment of variables # Identify Year and Month # year assignment as value list for tool yrimg = sys.argv[1] # month assignment as value list for tool (03_mar, 09_sept) moimg = sys.argv[2] # Identify workspace location for imagery tmpath = sys.argv[3] ### Envonment settings for geoprocessor arcpy.env.overwriteoutput = True arcpy.env.mask = "" pathstr = tmpath + "/" + moimg print pathstr arcpy.addmessage( pathstr) # arcpy.env.workspace = pathstr outimg = "ndvi" + yrimg + "_" + moimg + ".tif" print outimg arcpy.addmessage("ndvi Raster will be: " + outimg) arcpy.checkoutextension("spatial") imglist = arcpy.listrasters("*", "TIF") for ras in imglist: firstf = string.find(ras, "_B30.TIF") if firstf > -1: print ras band3 = ras print str(firstf) arcpy.addmessage(str(firstf)) secondf = string.find(ras, "_B40.TIF") if secondf > -1: print ras band4 = ras print str(secondf) arcpy.addmessage(str(secondf))

print "Band 3 is: " + band3 print "Band 4 is: " + band4 arcpy.addmessage("band 3 is: " + band3) arcpy.addmessage("band 4 is: " + band4) try: if not arcpy.exists(outimg): print "Band 3 is: " + band3 print "Band 4 is: " + band4 arcpy.addmessage("band 3 is: " + band3) arcpy.addmessage("band 4 is: " + band4) if arcpy.exists(band3): print "Band 3 exists" band3float = Float(band3) print "Band 3 float created as temporaty file" if arcpy.exists(band4): band4float = Float(band4) print "Band 4 float created as temporary file" minusrast = Minus(band4Float, band3float) plusrast = Plus(band4Float, band3float) print "First part of expression calculated" ndvitemp = Divide(minusRast, plusrast) print "Temporary raster of NDVI calculated" ndvitemp.save(outimg) except: print "Error in try block" arcpy.addmessage("problem in attempting to calculate NDVI raster. Check for existance of rasters") arcpy.addmessage(arcpy.getmessges()) This script makes use of the system raster calculator tool under the Map Algebra toolset in the Spatial Analyst toolbox. The key statement in the script is: ndvitemp = Divide(minusRast, plusrast) This is a complex expression which is simplified with two other raster calculator expressions. minusrast = Minus(band4Float, band3float) plusrast = Plus(band4Float, band3float) The temporary raster generated is then saved to a new raster. ndvitemp.save(outimg) The output raster has a standardized name based on the year and month of the image. The rest of the statements in the script evaluate the rasters available in a particular directory. TM data typically has standardized names when downloaded. The list of available rasters in a directory goes through a loop to identify band 4, near infrared, and band 3, red for the calculation of NDVI. This generates a new raster with values of -1.0 to 1.0 based on ratio of (Near IR Red) / (Near IR + Red). Key arguments for this script tool are the year, month, and workspace.

yrimg = sys.argv[1] # Year moimg = sys.argv[2] # Month tmpath = sys.argv[3] # Workspace Figure 2 is the NDVI raster image generated from the TM data for August, 2005 The rasters of NDVI values are now available for further processing. In this case, it is the generation of zonal statistics based on a zone raster. Generation of Zonal Statistics with Script Tools The rasters generated from the initial tool indicate some clear patterns particularly in agricultural areas. Where a clean field border feature class exists, this can be used to generate summary statistics for a month and then over the year or season for further evaluation. For the San Joaquin County area, the best available representation of field borders is the 1993 DWR land use feature class. For the Fresno County area, the parcel feature class for the county was suitable as an initial base for field borders. The difference in date between the 1993 DWR feature class and the period of interest, 1999 to 2005 meant that considerable change had occurred from both urbanization and

cropping patterns. In addition, there are extensive areas of orchards and vineyards. Both represent considerable range in NDVI values dependent on variety, age and cultivation methods. Orchards in particular are often mixed in with low density development. They often have irregular boundaries unlike cropped fields. Independent of any geoprocessing tools, the 1993 polygons were evaluated against the 1 meter NAIP imagery available for the area. This evaluation modified the DWR 1993 data for the following items: Areas identified as urban were considered to be urban for 1999 to 2005 time period. Areas identified as urban based on review with the 2005 NAIP imagery were carried as urban for 2005 and further splits were made to the polygons as needed. Orchards identified from the 2005 NAIP imagery were carried as orchard for 2005. Vineyards identified from the 2005 NAIP imagery were carried as vineyard for 2005. Additional splits were made to the 1993 polygons based on review with the 2005 NAIP imagery. The parcel data available for the area of interest in Fresno County was also reviewed with the available 2010 NAIP 1 meter imagery available for the area. This data is from 2011 and required less modification than the DWR polygon feature class. Figures of evaluation of 1993 DWR polygons with NAIP imagery and 2011 Parcel data with 2010 NAIP imagery. With the resulting feature classes representing field borders, a few additional processing steps are required in preparation for generation of zonal statistics. A key step is to add an integer field to contain a unique value for the zones of interest. This could a unique value for each polygon or field. It could also be a unique value for polygons of the same type such as land use type. This field is independent of the feature ID or object ID field maintained by the software for the feature class. Another additional step is to project the field border database to the same coordinate system as the NDVI raster data. In this case, our NDVI data is in WGS84 UTM zone 10. The source polygon feature classes are in NAD83 UTM zone 10. There are minor differences of about 1 meter between these coordinate systems. A common coordinate system assists in maintaining consistency for processing. Another consideration for zonal statistics is the conversion of the polygon field border database into an integer zone raster. In evaluating this step, consideration should be given to identifying the geoprocessing environment for the spatial extent and a snap raster to control raster processing. Generating a zone raster from the field border polygon feature class should improve the processing. For zonal statistics, a temporary raster will be generated each time if a zone raster is not present. Zonal statistics generates summary statistics for each zone. Using one zone raster for each time period of interest does not require a snap or extent raster for these summary statistics. It does ensure consistency in

representation of the zones across the time period. A simple script tool can now be used to generate zonal statistics for the monthly NDVI values. In this case, Zonal Statistics as Table under the Zonal toolset of the Spatial Analyst toolbox is used. The key statement for this script is; outzonalstatistics = ZonalStatisticsAsTable(inZoneData, zonefield, invalueraster, outrast, DATA, ALL ) In is this particular script tool, the zone raster is the same for the time period and is hard coded into the script. The output location is a file geodatabase for the output table. The only argument is the monthly NDVI raster. invalueraster = sys.argv[1] From the name of the NDVI monthly raster, the output table name is generated by extracting the month and year from the string for the NDVI raster. Figure 3 and 4 show a portion of San Joaquin County with NDVI values for May and the NDVI values for fields for 2005. Figures 5 and 6 show the mean NDVI values summarized by fields for May and August, 2005.

Additional Processing for Analysis At this stage additional evaluation and analysis can take place both interactively as well as with additional script tools. This includes identifying continuity for zones in NDVI values between months and over the years with other base data such as the available NAIP imagery. The main objective has been to identify irrigated areas particularly for the summer growing season over the time period of interest. Both the San Joaquin County and Fresno County areas experience dry summers with winter precipitation. Precipitation ranges from less than 8 inches (200 mm) to a little over 12 inches (300 mm) for any given year. Both areas have winter crops such as small grains. For summer cropping, irrigation is required. The San Joaquin area has seen considerable change in urbanization as well as cropping patterns since the base 1993 DWR land use mapping. The Fresno County area of interest has seen less urbanization, but some areas have gone out of crop production due to lack of drainage for this area. For both areas, the appropriate NAIP imagery was relied on to make interpretations of the land use status for end date of the period of interest. For the San Joaquin County area of interest, the following interactive evaluations were made with the 2005 NAIP imagery. Irrigation status for fields for years 1993 to 2004 polygons identified as urban in 2005. Continuity of NDVI values between 1993 and 2005 for polygons identified as orchards or vineyards in 2005. Polygons where high NDVI values during the summer months indicate active vegetation and irrigation. Scripting tools were prepared to tabulate monthly values of the mean NDVI values for the field border polygons and values for each year. This provided a range of values for the main irrigation season of April through August as well as peak values for any given month. Categories can be set up to identify polygons that were irrigated or not irrigated. There is also a large group where the irrigation status for a year is not clear or uncertain.

A variety of tools can be developed such as fuzzy membership and fuzzy overlay in the Overlay toolset of the Spatial Analyst toolbox for further evaluation of the data. For the Fresno County area of interest, the main focus in evaluating the NDVI values was in identifying areas that were no longer irrigated during the summer season between 2009 and 2011. In this case, minimum threshold values were of interest. The script tools developed for the San Joaquin area of interest could be immediately applied to the Fresno County area of interest for a different time period with different TM scenes. Little or no change in the scripts are required for separate analysis of different areas of interest for different time periods. Summary The ArcGIS geoprocessing environment is useful for developing script tools for data analysis and processing. This application with script tools relied on several tools available in the Spatial Analyst toolbox. These scripts were developed to perform a sequence of repetitive complex tasks and to standardize a sequence of data outputs. Scripts have the flexibility in the geoprocessing environment for application to other areas and in this case to different time periods. This description highlights the use of the raster calculator tool for generation of an NDVI raster based on TM scenes. It also highlights the use of the Zonal Statistic as Table tool to generate summary statistics based

on a zone raster. Additional tools related to these tools prepare yearly summary tables of NDVI values. They also assign fuzzy membership and perform fuzzy overlay for zones of interest. While the description of this application identifies a set of tools available in the Spatial Analyst toolbox, these and related scripts make use of other functions and classes available in the ArcPy site package. Python also provides a rich scripting environment with a variety of additional modules for further manipulation of data. Enjoy scripting. References USGS Global Visualization Viewer; Earth Resources Observation and Science Center (EROS); http://glovis.usgs.gov Authors: David T. Hansen, GISP GIS Specialist / Soil Scientist Phone: (916) 978-5268 Email: dhansen@usbr.gov U.S. Bureau of Reclamation Mid-Pacific Region 2800 Cottage Way Sacramento, CA 95825-1898 Barbara Simpson GIS Specialist / Geographer Phone: (916)978-5031 Email: bsimpson@usbr.gov U.S. Bureau of Reclamation Mid-Pacific Region 2800 Cottage Way Sacramento, CA 95825-1898