The purpose of this chapter is to bring in climate data from weather stations or aquatic monitoring stations that are often in a text files or from spreadsheet software. These files often may be numerous separate files that you only want to summarize by station, annually, monthly, or some other time period. We are going to show you how to bring these files into R, clean up data, and create your own GIS layer for use in modeling efforts. The example used is from a project that attempted to predict snowshoe hare (Lepus americanus) presence or absence in Pennsylvania and determination of how habitats occupied may change due to changes in climate and temperature.

We obtained shapefiles from a variety of sources (see Section 2.1 for details) and weather station data from the National Oceanic and Atmospheric Administration's National Climatic Data Center and cleaned up data outside of R (see Section 2.2 for details). Data were collected from 102 weather stations in and around Pennsylvania in order to determine mean snow depths (SNWD), mean maximum temperatures (TMAX) and mean minimum temperatures (TMIN) for the month of January from 1995 to 2005. Data were used only from stations with records for at least 10 of the 11 Januaries covered by the time range. For each weather station, records for each of the three climate variables were included only if the data covered at least 95 percent of total January days. These criteria resulted in data from 66 stations for snow depth, 69 stations for maximum temperature, and 68 stations for minimum temperature. This data was edited outside of R and the resulting text files were then combined in R (Section 2.3). Alternatively, we can obtain data directly from NOAA (section 2.4) and clean it up in R prior to moving forward thus eliminating the need for Section 2.3.

We entered spatial coordinates for the weather stations along with climate data that met the selection criteria into program R a geographic information system ((Section 2.5; ArcMap 9.3). Data from these stations were then used to create maps that showed the range of mean snow depth, mean maximum temperature, and mean minimum temperature for the month of January across the state. This was accomplished with interpolation using the kriging method in ArcMap. The interpolations included data from a total of 46 weather stations outside Pennsylvania in order to avoid errors associated with boundary issues. The interpolated maps were then used to assign the appropriate climate data for each location sampled for presence of snowshoe hare in 2004.

These data were then used to select a model for predicting occupancy probability of snowshoe hare. Tested models examined occupancy as a function of habitat type and one of four additional correlated variables (elevation, minimum Jan temp, max Jan temp, and Jan snow depth). The model including mean minimum temp (TMIN) was found to be the best one, and the co-efficients for that model, which varied by habitat type, were included as a shapefile (county param) to calculate occupancy probability based on habitat type and TMIN across the range of snowshoe hare counties (Figure 4).