Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

statistics on 2d grids: control the bin_centers #2418

Open
vadmbertr opened this issue Mar 7, 2024 · 0 comments
Open

statistics on 2d grids: control the bin_centers #2418

vadmbertr opened this issue Mar 7, 2024 · 0 comments

Comments

@vadmbertr
Copy link

Hi,

I have a question regarding a usecase of mine (maybe it is a common one, I don't know).

Let's say df (a pandas.DataFrame) holds scalar values for a variable observed at different time, latitude and longitude. I can compute the variable mean over time, binned by longitude and latitude on a NxM grid as:

df_vx = vaex.from_pandas(df)
gridded_mean = df_vx.mean("variable", binby=["longitude", "latitude"], shape=(N, M))

The shape allows me to control the underlying grid resolution, knowing the spatial extent of the observations.
However, I would like to directlly control the resulting bin_centers of the underlying grid, in the case of a regular grid, such that they match another grid. So far, I am achieving this by adding fake rows to df with the appropriate latitude and longitude coordinates. Is there a better / more direct way to do it?

Thanks.
Vadim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant