Skip to content

Masking interpolations

2 messages · Wesley Roberts, Paul Hiemstra

#
Hi Paul,

Many thanks for the reply. I am not sure about the convex hull approach as I am not sure how to implement it as part of my program. Is the code you wrote below replacing the following statements? Would I then pass grd to the autoKrige statement as shown in the original code below?

************************************************************************************************************************************************************************************************************
************************************************************************************************************************************************************************************************************

I have uploaded some pics of my points and interpolations to flickr. 

Link 1 shows the timber compartment with the lidar points overlayed and the bounding polygon used to subset the point data set. You cant really see the irregularity of the points but trust me, they are all over the place. Average distance between points is about 17cm so a 10cm interpolation resolution should be okay. 
Link 1
http://www.flickr.com/photos/35273872 at N07/3283623165/

Link 2, is the height interpolation using the parameters you suggested on Friday. As you can see the lack of points outside the polygon results in a type of edge effect at the boundaries. I can mask the rest out but would prefer to limit the interpolation to minimize errors at the boundaries.
Link 2
http://www.flickr.com/photos/35273872 at N07/3283623941/

Finally link 3 shows what I think is the kriging variance although I cant be sure. When I import the tiff written by writeGDAL there are three bands (using GRASS). The first is the interpolated variable, the next two are a mystery to me. If this is indeed the krig variance then limiting the interpolation based on kriging variance seems like a good idea? What do you think?
Link 3
http://www.flickr.com/photos/35273872 at N07/3284446466/

Many thanks,
Wesley

Wesley Roberts MSc.
Researcher: Earth Observation (Ecosystems)
Natural Resources and the Environment
CSIR
Tel: +27 (21) 888-2490
Fax: +27 (21) 888-2693

"To know the road ahead, ask those coming back."
- Chinese proverb
Hi Wesley,

You could take a look at using a convex hull. I'm not sure if this will 
fix your problem as we cannot see how exactly your points are irregular. 
The latest version on my website (0.5-2) uses a convex hull off the data 
if you don't pass a new_data object. You could try this. The function 
making the convex hull is:

create_new_data = function(obj) {
# Function that creates a new_data object if one is missing
        convex_hull = chull(coordinates(obj)[,1],coordinates(obj)[,2])
        convex_hull = c(convex_hull, convex_hull[1]) # Close the polygon
        d = Polygon(obj[convex_hull,])
        new_data = spsample(d, 5000, type = "regular")
        gridded(new_data) = TRUE
        return(new_data)
}

If you want to call it directly from the package use 
automap:::create_new_data.

cheers,
Paul
Wesley Roberts wrote:
-- 
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone: 	+31302535773
Fax:	+31302531145
http://intamap.geo.uu.nl/~paul
#
Hi,

A convex hull should do the trick, if you have the latest automap 
version (>0.5-2) you don't have do to anything to get a convex hull. 
Just omit grd (new_data argument) and automap will automatically use a 
convex hull.

cheers,
Paul
Wesley Roberts wrote:
This is indeed the kriging variance.