Feature #276

grdblend should operation on complete grids instead of rows

Added by Florian almost 5 years ago. Updated almost 5 years ago.

Status:NewStart date:2013-05-15
Priority:LowDue date:
Assignee:-% Done:


Target version:-


This is a low-priority task. Currently grdblend processes grids by row. There was a discussion to change this to processing entire grids with some concerns about memory consumption. However, I believe we don't have to store more than three grids at the same time because a weighted mean can be calculated cumulatively. Here is a short awk example about what I mean:

for ((i=1;i<5;i++)); do echo $i; done | gawk '{sum=sum+$1; mean=(mean*(NR-1)+$1)/NR} END {print sum, NR, sum/NR, mean}'

So there are two possibilities:
  1. For each blend iteration keep a grid of weighted cumulative sums and the sum of weights. Each iteration loads a new grid (including grdsample), and updates the two aforementioned grids. In the last step you divide one by the other.
  2. As 1. but each time divide the cumulative sums by the sum of all weights so that you permanently update a cumulative weighted mean instead (I believe blockmean does this).

The drawback of 1 is that you need more memory and get possible overflows with the sums. The 2nd has the advantage that it needs to store only the grid of the cumulative mean and the current grid.


#1 Updated by Paul almost 5 years ago

  • Priority changed from Normal to Low

Changed to low priority.

Also available in: Atom PDF