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:
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?
Hi,
I have a question regarding a usecase of mine (maybe it is a common one, I don't know).
Let's say
df
(apandas.DataFrame
) holds scalar values for avariable
observed at differenttime
,latitude
andlongitude
. I can compute thevariable
mean overtime
, binned bylongitude
andlatitude
on aN
xM
grid as: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 resultingbin_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 todf
with the appropriatelatitude
andlongitude
coordinates. Is there a better / more direct way to do it?Thanks. Vadim