I've got a data set of hot-wire measurement velocity amplitudes at a given frequency bin (time data that has already been transformed to the frequency domain and I am just considering data for a given frequency bin) that have been sequentially recorded on specific locations in the xz-plane with a traverse-system. The problem is that the data does not represent a full uniform grid, but is sparsly sampled. Actually, the traversing process was performed in a way to get several locations within a given, more or less rectangular area, while avoiding hitting a circular obstacle within this area. Additionally, the regions close to the obstacle were sampled more densely as compared to regions farther away from the obstacle.
As a result the data set to start my problem with looks like the following matrix (3 columns and e.g. 400 rows):
x z values (3 columns)
x1 z1 value1
x2 z2 value2
x3 z3 value3
. . .
. . .
. . .
(each value representing the velocity amplitude, e.g. at 500 Hz)
But the problem is:
- The data was collected in some wierd order, e.g. the first 6 coordinates (x-component) are [-5; -5; -3; 10; 10; 0.8; ...] and the first 6 coordinates (z-component) are [0.2; 0.3; 5; 3; 2; -1; ...] ...
- The data does not represent a uniform and equally spaced grid: all data (for example) lies within the range [-5 <= x <= 10] and [-2 <= z <= 6], but it is possible that there are 8 z-positions for one x-position, while at another x-position there are only 3 z-positions and at several other x-positions there are no z-positions at all (as within the obstacle region).
- There is a greatest common divisor with respect to the grid resolution, e.g. 0.1 so all x and z-coordinates are positive or negative multiples of 0.1. This means it would be possible to generate a (probably) huge matrix (xz-plane) that includes all possible locations. I think this could help somehow.
What I basically want:
A simple contourf plot of the data within the xz-plane and areas that have not been recorded (obstacle region) are either interpolated or even better filled with NaNs (or Zeros) or something like that. Actually, I know the coordinates of the obstacle and might just draw it as overlay later.
Do you know how to get the desired result in a convenient manner?
I've been trying for ages now, but I just don't find a solution that solves my problem. I am pretty sure that it can be solved with some combination of reshaping, ndgrid/mesh, sorting or gridded interpolation with built-in (image processing?) functions but I just don't get it to work.