[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Anisotropic smoothing operations
Craig Markwardt wrote:
> Question by an idiot:
You are decidedly not an idiot. You must have meant 'for' not 'by'.
> couldn't you use KRIG2D/TRIANGULATE/TRIGRID for
> this? They're designed to take irregular points to a regular grid and
> filling in the gaps.
Yes and no. This is my same old question about gridding data that a ship
collected along a 300km long straight line. The ship stopped every 10-20km
and dropped a thermometer into the water, measuring temperature (and other
things) every 0.5m.
KRIG2D: I would love to use this, but (a) it is very slow for more than
300ish data points and (b) I really don't know how to set the input parameters
so they have a physical meaning.
TRIGRID: This is what we have been using... because the temperature casts are
different lengths the triangulation introduces interpolation where it is
unreasonable to expect any, thus we have to introduce ad hoc masking. This is
identical to the problem Liam encountered recently using MODIS data. In
general terms, this method works (when we mask) for measurements of fields
that have soft and sharp gradients (temperature, salinity) but not so well for
spikes and discontinuities (pigments, plankton cells per unit volume, doughnut
crumbs per unit volume.)
A while back, when I called the newsgroup-hotline for help, quite a number of
nice ideas were suggested. We are simply exploring some other techniques.
Liam provided two different approaches: inverse distance weighting and region
growing (that is the one we are trying now.) You had suggested coming up
with a response function that 'follows' each cast line downward. We haven't
tried that yet
We have seen nice results with the region growing (repeated smoothing) method,
except that the smoothing window must be square. In the water column, vertical
gradients are sharped than horizontal ones; hence the desire to using a
rectangualr smoothing window. I thought, ever the optimistic programmer,
that I would just slip the CONVOL function in the place of SMOOTH. Bonk.
Actually, Jaco, hit on something, the counter (counts the number times a
cell/pixel has been sampled) holds the key. FIRST, start with the entire grid
as ZERO rather than the user defined MISSING value. At the end of the
sprinkle/smooth iterations, simply examine the counter cells that hold '0',
these will be filled with the USER defined MISSING value.
Something like the following is pretty much what the code that Liam sent me
does (except it uses SMOOTH instead of CONVOL). I would add the missing check
at the end.
grid = FltArr(nx,ny)
count = fltarr(nx,ny)
kernal = replicate(1.0, winX, winY)
scale = total(kernal)
For i = 0, n_iterations-1 Do Begin
grid[dataX, dataY] = dataZ
count[dataX, dataY] = count[DataX, dataY] + 1.0
grid = CONVOL(grid, kernal, scale, /edge_truncate)
count = CONVOL(count, kernal, scale, /edge_truncate)
;check for missing values
A = where(count eq 0.0, missing_count)
If missing_count GT 0 Then Grid[A] = missing
248 Lower Round Pond Road
Bristol, ME 04539
Tel: (207) 563-1048