I have a file with two columns, X and Y positive, and non-gridded, data points (> 10^5 points).
1 0.9
0.9 1.1
0.5 1.25
2.6 0.9
3.1 2.6
2.9 2.55
4.1 0.9
1.2 6
5.5 2.5
6 4
4 7.2
. .
. .
I would like to generate an X-Y grid (of size binsize
) in a selected range of those points. Besides, I would like to add a third column indicating the count of the original data points contained in a square area (binsize
x binsize
) of each of the vertices of the grid.
If binsize=5
2.5 2.5 7
2.5 7.5 2
7.5 2.5 2
. . .
. . .
I would like to pass to the AWK program the range of data and the binsize
.
I would appreciate your help very much.
EDIT:
The binsize is to determine the range of values in which I have to count the XY datapoints. The range input is to select the x and y values to count, for example, If I select x in [0,5]
and y in [0,5]
then I only will consider the binning of the first eight xy points. My real dataset is very big
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…