Feature request: add a custom grid creation for spat_df
@MJosso created a function to build spat_df from a custom grid (pairs of y and z). This seems extremely useful, I'd like to implement it.
His code:
def gen_cust_grid(ys, zs, comps=[0, 1, 2]):
"""Generate spat_df (all turbulent components and grid defined by x and z)
Notes
-----
0=u is downwind, 2=w is vertical and 1=v is lateral (right-handed
coordinate system).
"""
ks = np.array(comps, dtype=int) # sanitizing
xs = np.zeros_like(ys) # all points in a plane
col_names = [f'{"uvw"[k]}_p{ip}' for ip in range(xs.size) for k in ks]
spat_arr = np.c_[np.tile(comps, xs.size),
np.repeat(np.c_[xs.T.ravel(), ys.T.ravel(), zs.T.ravel()],
ks.size, axis=0)].T # create array using numpy
return pd.DataFrame(spat_arr, index=_spat_rownames, columns=col_names)