glidertools.mapping.grid_data
- glidertools.mapping.grid_data(x, y, var, bins=None, how='mean', interp_lim=6, verbose=True, return_xarray=True)
Grids the input variable to bins for depth/dens (y) and time/dive (x). The bins can be specified to be non-uniform to adapt to variable sampling intervals of the profile. It is useful to use the
gt.plot.bin_size
function to identify the sampling intervals. The bins are averaged (mean) by default but can also be themedian, std, count
,- Parameters:
x (np.array, dtype=float, shape=[n, ]) – The horizontal values by which to bin need to be in a psudeo discrete format already. Dive number or
time_average_per_dive
are the standard inputs for this variable. Hasp
unique values.y (np.array, dtype=float, shape=[n, ]) – The vertical values that will be binned; typically depth, but can also be density or any other variable.
bins (np.array, dtype=float; shape=[q, ], default=[0 : 1 : max_depth ]) – Define the bin edges for y with this function. If not defined, defaults to one meter bins.
how (str, defualt='mean') – the string form of a function that can be applied to pandas.Groupby objects. These include
mean, median, std, count
.interp_lim (int, default=6) – sets the maximum extent to which NaNs will be filled.
- Returns:
glider_section – A 2D section in the format specified by
ax_xarray
input.- Return type:
xarray.DataArray, shape=[p, q]
- Raises:
Userwarning – Triggers when
x
does not have discrete values.