I need some histogram magic - gridding very large dataset [message #84169] |
Thu, 02 May 2013 02:02 |
rjp23
Messages: 97 Registered: June 2010
|
Member |
|
|
I'm fairly sure this can be done using HISTOGRAM but I can't figure out how.
I have some global (irregularly spaced) satellite data which I want to average into 2 degree lat/lon boxes.
Previously my dataset was only 10,000 or so elements large so I just looped over the lat and lon and used WHERE to find all the data values in the grid box and then averaged them.
Something along these lines:
FOR j=0, n_lon-1 DO BEGIN
FOR k=0, n_lat-1 DO BEGIN
lon= lon_min + j * lon_grid
lat= lat_min + k * lat_grid
temp=where(data_lon GE lon AND data_lon LT lon + lon_grid AND data_lat GE lat AND data_lat LT lat + lat_grid)
mean_data[i,j]=mean(data[temp])
ENDFOR
ENDFOR
This worked fine but now I have a dataset with upwards of 20 million datapoints and this way is taking far too long.
Any HISTOMAGIC suitable for this one?
|
|
|