r.resample, r.coarsen

Michael Shapiro wrote:

GRASS only does nearest neighbor resampling, you're right. Would you
consider contributing r.coarsen?

I'd like to polish the source code and then send it to CERL. The current
r.coarsen is a ragged modification of r.neighbors, with variable names not
appropriate to r.coarsen... It was an ad hoc solution for our need in a
project.

Please note that my original post mentioned the bilinear resampling and cubic
convolution resampling. R.coarsen, too, does NOT include these two options.
I merely borrowed the neighborhood operation methods from r.neighbors for
aggregation. I believe a combination of r.coarsen and any of the resampling
methods - nearest neoghbor, bilinear, convolution - can solve most aggregation
problems. I may or may not try to code the other two resampling options
depending on my schedule and possible contributions to done by others.

I received more than dozen requests for the code since I post. I thank all
of you for your interest in the module, and look forward to hear your
comments and bug reports.

Jianping Xu
jianp@ocean.rutgers.edu

In <9306112059.AA13489@dune.rutgers.edu> jianp@dune.rutgers.edu (Jianping Xu) writes:

>First, it seems to me, GRASS has only one resampling option, nearest neighbor.
>It does not have bilinear and cubic convolution options.

>Second, if you want to aggregate images/raster maps with a very fine resolution
>(e.g. 10, 20, 30 meters) to a very coarse resolution (e.g. 80, 1000 meters),
>you would not get a result you expected because of the nearest neighbor method
>(and even all the above three). R.resample picks up information by skipping
>many raster cells, yet assigns collected values back to those skipped portions
>in the resultant map.

>We have a simple raster program, "r.coarsen", which aggregate the input map
>to coarser resolutions, but allowing various aggregation methods - mean,
>mode, max, min, ... - taken from the standard "r.neighbors" program. Unlike
>r.neighbors which moves the working window (not the region!) one cell a time,
>r.coarsen moves the window one full window a time. Send us a mail privately,
>I'll provide you the code.

>*****
>Jianping Xu Email: jianp@ocean.rutgers.edu
>Center for Remote Sensing and Spatial Analysis Phone: (908) 932-9631
>Rutgers University Fax: (908) 932-8644
>New Brunswick, NJ 08903-0231

--
Michael Shapiro shapiro@zorro.cecer.army.mil
U.S. Army CERL (217) 373-7277
P.O. Box 9005
Champaign, Ill. 61826-9005