I do seismic processing, and recently have been moving into doing contours.

I have watered down my problem so that I can understand from 'first principles'. I have checked out Creating contours for specific elevations as well, since it is similar.

Input: I have a uniformly sampled 2-dimensional (x,y) spatial grid, of size M by N. I have P random points within the grid, making up say, 1% of all the M*N points. Each of those points has a positive z value. All the rest of the points are at z=0.

Output: Based on this information, I would like to know, from an algorithmic / signal processing perspective, the steps needed to make a contour plot.

My problem is somewhat nested:

My questions are the following:

  1. Do I need to first perform a 2D interpolation of my data, so as to fill up all those z=0 values, as a necessary pre-processing step before being able to make a basic contour plot?

    1a. If that is the case, then how does one do this 2D interpolation? I am familiar with linear regression, but it seems from my trials that this was not adequate. Nearest neighbours interpolation also does not seem like it would yield good looking contours.

  2. If a 2D interpolation is not a necessary pre-processing step before being able to make a contour, then how exactly, from an algorithmic perspective, are those z=0 values being filled? It seems to me that this is totally necessary first, and if so, I would like to know how this is done.

I am very new to contouring.

closed as too broad by PolyGeo Jan 13 '18 at 21:02

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • We would need more information to make direct referral. Is your desired contour from an observable data; elevation, bathymetry? or a sensor value? If the latter then you probably need to ask about some modeling techniques on another website. stackoverflow as one. stackoverflow.com/questions/tagged/data-modeling – Brad Nesom Aug 11 '14 at 17:24
  • @BradNesom Hi Brad: Yes, this would be from sensor data, specifically, measuring total rain fall across an area in southern Spain, over a period of 1 week. So each z value has total rain fall at some location in the past week. Cheers. – TheGrapeBeyond Aug 11 '14 at 17:33
  • I want to know what software are you using or have knowledge/access. – Pau Aug 12 '14 at 16:10

Generally, 2d interpolation to make 3d data is only accepted for interval interpolation.
In other words...
If you have 3d data that would yield 100m contours. You can use specific 2d points in between to interpolate the 3d values in between for say 25m or 50m.

I would be very hesitant to use normal elevation interpolation methods on rainfall modeling (There are methods for rainfall it is an ongoing research industry in my region).
There is always an elevation value where you don't have data. The last known value is either trending up or down and you are going to hit the actual ground. However rain can fall in one spot and not in another.
If I am not mistaken the industry method is to use radar (precip) scenes and validate amounts from accumulated pixels at one location (event movement) with a valid sensor (mesonet). Then extrapolate some regional totals to other areas that were covered by similar pixel values and times.
I know that here in the Midwest (US) there are so many sensors that not much of that has to be done for broad modeling.
They may do special studies for extrodinary events that have more local impact and they want to see into causes or factors.
Other data may be found here at the USGS website.
To more directly address your question.
You can contour from either vector point data, or from raster data, or from both.
Once you have data that you can trust and know the boundaries of the data. you can easily use any contour package to create contours. Most of them will provide methods to set boundaries, masks and breaks. (Which is either where you don't want to guess what your data could have done, or that you know there is no event or data.)


I think that you have a wrong use of the language, what you need to do is interpolation not contouring, also you can search for geostatistics. The most common methods are TIN,IDW, natural neighbor, spline, kriging.

You need to follow the next steps:

  1. Separate the points with z value.
  2. Interpolate the points from (1) to a raster
  3. Extract the z value from the raster (2)

There is many software you can use ArcGis, R project, QGIS, etc.

If you have enought points you can validate your model (raster).

Not the answer you're looking for? Browse other questions tagged or ask your own question.