mmspy.compute.particle.interpolate.interpolate_distribution#
- mmspy.compute.particle.interpolate.interpolate_distribution(ds, grid, variable='f', mode='mean', method='histogram', roll=None)#
Interpolate a particle distribution function onto a regular grid.
- Parameters:
ds (
Dataset) – Dataset containing thevariableand the coordinates used to interpolate.grid (
dictofParticleGrid) – Dictionary containing the coordinates (keys) and the regular grid (values) used for interpolation.variable (
str) – Variable used for interpolation.mode (
{'mean', 'spread', 'error'}) – Only applicable formethod='histogram'. Use ‘mean’ to calculate the mean of thevariablein each bin, ‘spread’ to calculate its standard deviation, and ‘error’ to propagate error.method (
{'histogram', 'nearest', 'linear', 'cubic'}) – Method of interpolation. ‘histogram’ is performed withscipy.stats.binned_statistics_dd. Other methods are performed withscipy.interpolate.griddata.roll (
int, optional) – Whether to roll the data in time before interpolation. Set to specify the rolling window.
- Returns:
da (
DataArray) – Interpolated data array defined ongrid.