|Spherekit: A Tutorial|
In this tutorial you will be using a software package called SphereKit developed by Cort Willmott, Robert Raskin, Chris Funk and Scott Webber for the NCGIA. This package is unique in that it uses actual distances on the sphere (great circle distances) derived via spherical geometry. The difference between actual great circle distances and distances on a 2-D cartographic projection can become quite siginificant at continental and global scales. In this lab you will use a canned dataset for the country of China. The data has precipitation, elevation, and temperature values for a large number of points scattered about the country of China. SphereKit produces a complete estimated field of all of these values via any number of different interpolation techniques. It also produces a field of error estimates at all points in the field. The error estimation procuedures it uses is a method called "cross-validation". We will examine this process as well as the following interpolation methods: Inverse Distance Weighting, Kriging, Splines, and Multiquadric interpolation.
Follow these steps:
This file should look like:
51.716667 126.650000 244.000000 3.0 -27.7 48.766667 121.916667 823.000000 4.0 -23.1 49.216667 119.750000 610.000000 2.0 -29.7 50.500000 121.466667 1067.000000 4.0 -30.0 49.166667 125.233333 305.000000 2.0 -28.6 47.383333 123.916667 152.000000 1.0 -23.3 47.433333 126.966667 244.000000 4.0 -22.9 47.233333 131.983333 91.000000 5.0 -20.3 46.816667 130.283333 122.000000 0.0 -22.7 45.283333 130.950000 152.000000 0.0 -20.2
These columns correspond to latitude, longitude, elevation, monthly precipitation and average monthly temperature for 160 weather stations in China.
In this tutorial we will interpolate the temperature values.
Spherekit allows you to manipulate eight different kinds of objects. Click on the little graphic icons that line up on the left of the Spherekit window. Read each of the messages for each of the eight objects. This should familiarize you with the Spherekit data types.
Spherekit allows you to organize your work into projects, each project corresponds to a sub-directory off of your Spherekit work directory.
Create a new work directory by selecting
When prompted for a name, enter 'tutorial' and hit return. tutorial will now become the current project, and all data objects will be stored in this location. Later, if you would like to return to this workspace, choose
Now we will create a Location Object in spherekit. Spherekit store locations independently of sets of values. This allows multiple sets of values to refer to the same set of locations. To import a set of locations choose:
When the dialog box appears, do the following steps to import the data.
China.netin the first field.
This should generate a Network object called China.net. This object should appear in the Network section. Click on the object's name 'China.net', and examine its metavalues. Every new object should be examined in this manner.
Now we're ready to read some data values. Go to
Set the name field to 'Temperature'. Click on the ?????? in the locations field. ?????? is Spherekit's generic symbol for 'need this value'. Select china.net from the drop down menu. If the 'china.dat' file is not specified, select that file. Then click OK.
This should generate an Observations object called termperature. Click on Temperature and examine the metavalues.
Two "Spherekit Objects" should now be in the interface window now. One is named "Temperature" which is a temperature dataset for 160 weather stations in China. The second is called "China.net" which is the latitude and longitude of the nodes of the weather station network.
Now we will create a dot map of the temperature field.
This opens a dialog box that looks like this -->
Under the Display Field heading click on the ?????? and select Temperature. Under the Projection heading Pick an appropriate projection for China. You may have to experiment with this parameter until you get a projection you think is good. Click OK when you have selected the display field and the projection. You should get a map of the Temperature data points for China that will look different based on the projection you choose, in any case the image below gives you a clue as to what it might look like:
This is the data from which you will be generating interpolated fields of Temperature. Before we can perform these interpolations we must create an interpolation method and a grid. What you are doing when you are creating an interpolation method is setting a bunch of parameters for the standard interpolation methods that Spherekit supports. For example, Inverse distance is one of the interpolation methods supported by Spherekit. When an inverse distance interpolater is run some things need to be decided. For example, if we are interpolating Temperature in the continental United States how many points do we want to use to interpolate a Temperature value in Tucumcari New Mexico? Should we use data from Seattle? How far away should we keep using points for. This problem is called the "Neighbor Selection problem" You need to provide parameters like how many neighbor points should be used?, within what radius?, etc. Another parameter to be set is the exponent of the inverse distance weighting. Gravity turned out to have a value of exactly 2.0. That is the default, but some processes optimize at values other than 2.0 and you can set that parameter also.
To create your interpolation method, do the following:
This should produce a dialog box that looks like -->
Range Modes Sets the method of selecting neighbors.
The default settings for this method will select between 4 and 10 points and usually 7.
The Function Definition specifies a specific type of inverse distance weighting created by a gentleman named Shepard. These defaults are fine. Click OK to accept them. This creates a new method called Shep1 that should appear in the Spherekit window.
In Spherekit a grid is simply a set of locations arranged at a regular distance (in degrees) form one another. To create a grid select:
You should see a dialog box like the one below:
You could play with these parameters, i.e. the resolution of the grid, the extent of area that you want to interpolate to, etc. For this example just accept the defaults by clicking OK. This will create an object called Grd1 that will show up in the Spherekit window.
Hooweee. Now we are ready to perform an interpolation.
This will estimate a value at each of the cells
in the grid you have just defined. To do this choose the
This produces, you guessed it: yet another dialog box that looks like the one to the right.
Fill in this dialog thusly:
After interpolation occurs, the display dialog box will appear. Select a Display Field that is the interpolated field object that you just created (It should be the default), Select a Graph Type that appeals to you (fool around here, grid plots and Isolines are different). Grid plots simply provide the value of the grid cell, while a contour plot smooths the image based on a Delaunay triangulation procedure.
Now choose the Options that appeal to you (we suggest super impose data values, and base scale on source). Then click OK. An image will appear. This can be printed if you like, by selecting print from the ghostview file menu.
Spherekit contains a rather limited set of online help topics. Begin this section by selecting
This will bring up a list of the available help topics. Select Cross-Validation-At-Net and read the help message. Repeat this for Cross-Validation-At-Grid.
To make an image of the estimated error field select the following:
Complete these steps to fill in the field:
When the display dialog window shows up just click OK. This should bring up a ghostview representation of the estimated error.