hm8
hm8

Reputation: 1513

Recreate NCL bin_avg function in python

I am trying to recreate NCL's bin_avg function in python. The function takes in a list of latitudes, longitudes, and observation values at those points, and calculates the average value of the observations contained within each box in some grid.

The closest I could come up with is using scipy.spatial.cKDTree.query_ball_point, but this finds all points within a radisu rather than within a grid box...

Upvotes: 0

Views: 75

Answers (1)

hm8
hm8

Reputation: 1513

Looks like what I was looking for is in scipy.stats.binned_statistic

Upvotes: 0

Related Questions