pyrfu.pyrf.resample module#
- pyrfu.pyrf.resample.resample(inp, ref, method: str = '', f_s: float | None = None, window: int | None = None, thresh: float = 0)[source]#
Resample inp to the time line of ref. If sampling of X is more than two times higher than Y, we average X, otherwise we interpolate X.
- Parameters:
inp (xarray.DataArray or xarray.Dataset) – Time series to resample.
ref (xarray.DataArray) – Reference time line.
method (str, Optional) – Method of interpolation “spline”, “linear” etc. (default “linear”) if method is given then interpolate independent of sampling.
f_s (float, Optional) – Sampling frequency of the Y signal, 1/window.
window (int or float or ndarray, Optional) – Length of the averaging window, 1/fsample.
thresh (float, Optional) – Points above STD*THRESH are disregarded for averaging
- Returns:
out – Resampled input to the reference time line using the selected method.
- Return type:
Examples
>>> from pyrfu import mms, pyrf
Time interval
>>> tint = ["2015-10-30T05:15:20.000", "2015-10-30T05:16:20.000"]
Spacecraft index
>>> mms_id = 1
Load magnetic field and electric field
>>> b_xyz = mms.get_data("e_gse_fgm_srvy_l2", tint, mms_id) >>> e_xyz = mms.get_data("e_gse_edp_fast_l2", tint, mms_id)
Resample magnetic field to electric field sampling
>>> b_xyz = pyrf.resample(b_xyz, e_xyz)