# [SciPy-User] Calculation of weights depending on area

Charles R Harris charlesr.harris@gmail....
Tue Aug 30 09:42:33 CDT 2011

```On Tue, Aug 30, 2011 at 7:47 AM, Charles R Harris <charlesr.harris@gmail.com
> wrote:

>
>
> On Tue, Aug 30, 2011 at 4:01 AM, Andreas H. <lists@hilboll.de> wrote:
>
>> Hi,
>>
>> again a question coming from analysis of geodata. Say, I have 3d
>> (lat/lon/z) data, in the easiest case on a rectangular grid. Now I would
>> like to re-grid these data to a new (again rectangular, in the simplest
>> case) grid by calculating the volume-weighted mean of the original grid.
>>
>> So for each cell of the new grid, the algorithm should take the
>> volume-weighted average of those grid cells from the first grid which "are
>> part of" the new cell.
>>
>> Is there any algorithm in SciPy to do this? If not, do you have any
>> suggestion on where to start? Perhaps there's some library from a more
>> low-level language that could be wrapped?
>>
>> Any help is greatly appreciated :)
>>
>>
> Sounds vaguely like the drizzle algorithm from astronomy. Another approach
> would be to subsample and convolve, or smooth and resample. Choosing a
> suitable method will depend on the smoothness/sampling of the original data.
>
> For the original approach, if your sample points are on an evenly spaced
> grid you can use an fft approach. The sampled data gives rise to a periodic
> spectrum, multiplication by the transform of a rectangular spot gives the
> data convolved by 'pillars', essentially subsampling in the Fourier Domain.
>
> Or you can compute the overlaps as you originally proposed. I don't know of
> any software for that but someone is bound to have done it before.
>
>
I should mention that if you have a rectangular grid and the overlap is with
a rectangle of the same shape as the basic grid, then I think bilinear
interpolation will do what you want.

Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20110830/b2ac23c2/attachment-0001.html
```