Time Series Display of Soil Moisture Data and Spatial Interpolation GIS in Water Resources Exercise 8 2014 By Ayse Kilic, Univ. Nebraska-Lincoln In this exercise we will learn how to tie time series of measurements made at a number of spatially distributed measurement sites to the site locations in ArcMap and then produce two types of animations of those time series in space. The animations help us to visualize the dynamic nature of the data in time and in space. Data Set: The data set is comprised of soil water content measured at 12 sites in a rainfed grass field in Central Nebraska. The data were measured on an hourly basis during the summer of 2014 and have been provided by Dr. Suat Irmak of BSE at UNL. A Bowen ratio energy balance system (BREBS) was setup in the center of field to determine evapotranspiration. The water content data were measured at 12 sites distributed in the field as shown in the figure below, where sites were labeled as BRES1, BREBS 2, and so on. 1 For this exercise, we will only analyze the soil moisture data collected at the shallowest depth (10 cm below the ground surface). With this exercise, you are going to learn: 1) How to create a query table that joins a spatial feature to a time series data table (a one to many join operation) 2) How to create an time enabled layer 3) How to create animation of data at specific points inside ArcMap 4) How to create time-based surfaces of a measurement using Python scripting. We will modify an existing code to create the spatial patterns of soil moisture over time using an inverse distance weighting (IDW) interpolation method. 5) We will use the time slider to produce animations of the spatial maps of soil moisture Data layers 1. watermark_sites.xls. This excel file stores location information for the 12 Watermark sites. 2. timeseries.xls. This is a time series of measurements of water content at the 10 cm depth, only for the period May 29 to August 7, 2014. The watermark sensor measures soil water potential (this is how ‘tightly’ water is held in the soil. The soil water potential (WM) needs to be converted into soil water content using a ‘characteristic curve’ for the specific soil. Units for WM are in kPa. The following equation was used to convert from KPa to an equivalent volumetric soil water content in percent (Eq. from Dr. Suat Irmak): SM (%Vol) =65.519*WM^-0.292 where WM is the soil water potential (KPa) The following steps will bring the data into ArcMap and then setup for the animations. Adding Data Layers in ArcMap Go to ArcCatalog and create a geodatabase and name it as “soilmoisture.gdb” 2 Back in ArcMap, create a map document and save your mxd as Exe8. Also go to FileMap Document Properties and make sure that you check ”store relative paths” . This will allow you to take your mxd setup to other computers and run it: Add The Watermark_sites.xls to ArcMap and import “sheet1.” The added feature should look like the following (12 rows with latitude and longitude data and site names): 3 Display X,Y data and select “Sensor ID” as the z field. On the same menu, select edit, and select Geographic Coordinate System of NAD 1983. The following display should appear for the sites feature: 4 Add imagery as a basemap: The result should look like the following (green symbols are used via the symbology menu): 5 Note that the soil sampling sites are laid out in a ‘cross’ pattern for representative sampling around the BREB equipment. The BREB equipment are visible just below the soil site that is the third one in from the right. Note also the variable pattern of vegetation. This is why it is important to sample a number of sites to get a representative soil water content for the area. In Arcatalog, create a feature dataset and call it projected_dataset. We are doing this so that all other data layers can be stored to the same projection. We will choose Projected Coordinate System WGS 1984 Zone 14N (since we are in Nebraska) 6 7 Save the sheet1 layer as a permanent feature named “sites” under soilmoisture.gdb The field type is “file and personal Geodatabase feature classes.” Now we will load the time series data. Add the timeseries.xls table that has soil water content for the top 10 cm for the 12 sites that were introduced as earlier as sites data. The data are in the “sheet1” sheet. The resulting table should have 20617 rows of data and look like the following: 8 There will be 12 sets of time series data placed “back-to-back” in this table. The sensor site number is labeled “Sensor_ID”. You need to save this table under the same geodatabase in which “sites” are located. You can remove all the files other than the ones located under soilmoisture.gdb. Keep the world imagery as your background image. 9 Now we are going to join these two tables using one to many join operation. The sites layer represents ”space” and the timeseries represents a “time” based data. We will be using the “Make Query Table” tool. For background on these following steps, you can refer to Arc Help at http://support.esri.com/en/knowledgebase/techarticles/detail/37544 10 We need to use the drop down icon in the input tables box twice: First, for the sites layer, and secondly for the time series layer, in that order. We are using “sites” as the spatial basis and we will be joining to it. Therefore, it must be first as shown above. The same tool menu is shown again below, where we are now checking the sensor_ID field from both tables because the join will be based on sensor_ID. Each sensor ID is a location in the field that is being monitored. Notice that each of the sensor ID names are preceded by the table name. 11 Click “OK” and take two sips of coffee while you wait for the tables to join. This will create a layer called “query table” with about 247,404 records (!!). We have one problem in this ‘joined’ query table. Each of the 12 time series of water contents have been joined to each of the sites. Therefore, we have 12 times too many entries. The 247,404 records need to be reduced to only 20,124 records that represent one time series per site. We will do this by using the Select By Attributes tool. Select the QueryTable and then Select by Attributes from the top menu. 12 Type the following equation that will select, in the table, only those entries where the sites_sensor_ID is equal to the timeseries_sensor_ID. This will associate the correct time series with the correct site. This will select only the combinations in the table that we want. Now, let’s export these 20,000 selected records to a new feature. Let’s call it “sites_with_time_series” and save it under the geodatabase. 13 This will create the new feature. Open it and make sure that it has the 20,124 records. As a check, the site 1 data should end at row 1693: Preparation for animation Now we are going to prepare the feature for animation. We need to add a new field to the table that represents the time at the end of each period. We need this for continuity in the data series so that we can do a time animation. Call this new field “endtime”. 14 Now, Search for “End Time” tool. We will use that tool to calculate the ending time for each time period. 15 The illustration below is from ArcGIS help file and shows how an End_time field has been populated. Enter the name of input table as “Sites_with_time_series”. And specify the start time field as the “timeseries_DateTime” or whatever name you may have used. You should point to these names using dropdown boxes, rather than typing them. Also point to the “EndTIme” field as the End Time Field. This is the field that we just created and currently it is null. It is also important that you select the “sites_ObjectID” field so that the tool identifies each row as a unique entry. 16 The resulting table should now have the EndTime field populated with a date/time that is one hour later than the starting time, and is the same as the starting time of the next row: 17 Animation We will first do a simple animation of each soil sampling site by varying the ‘size’ of the symbol at each site according to the magnitude of the soil water content. Go to Properties for the Sites_with_time_series table and go to Symbology. Under ‘show’ select Quantities Graduated symbols. Select the WSM_10cm time series. The other settings can be left as the default values: We need to set the time properties of the sites_with_time_series feature as shown below so that a) time is ‘enabled’ and b) each feature has a start and end time field, c) the names of the start time and stop time; and d) the time step interval is 1 hour. You can set this to “calculate” to optimize the timing of animation. 18 Save this as a layer file so that we can read it using python. The result should look as follows: 19 Go open the time slider tool from the menu bar so that you can set up the animation. 20 Press the red circled icon on the right to begin the animation. The sizes of the symbols at each of the 12 sites will change as the water content varies. The animation may progress too slow. In that case, click the ‘options’ tool on the slider: And select a longer time interval, for example, 4 hours. You can also select the ‘playback’ tab and increase or decrease the speed: 21 You can see the impact of rain events adding moisture to the soil sites. You can also see some differences in the rehydration (response) of the individual sensors. The soil water dries out near the end of the measuring period, so that the symbols become very small. 22 Using Python to create time series of ‘surfaces’ of water content data in preparation of animation Our next step is to do a similar animation, but with 2-D surfaces of water content. We will create these as a series of raster images produced using the inverse distance weighting (IDW) interpolation method. We will use some Python code to produce the rasters. The python code creates the rasters in ArcCatalog. The code we are using was provided by Dr. David Tarboton of Utah State University. Additional documentation was added by Ayse Kilic and Babu Kamble of UNL. To operate the code, the names of folder paths and file names, as well as names of the parameter to be animated, need to be changed in the code. 23