Skip to content

Commit

Permalink
rename interpolation_options to interpolate_kw
Browse files Browse the repository at this point in the history
  • Loading branch information
Niclas Wüstenbecker committed May 27, 2024
1 parent 8bfc875 commit 820c029
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
10 changes: 4 additions & 6 deletions src/traffic/core/flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -1658,7 +1658,7 @@ def resample(
self,
rule: str | int = "1s",
how: None | str | dict[str, Iterable[str]] = "interpolate",
interpolation_options: dict[str, Any] = {},
interpolate_kw: dict[str, Any] = {},
projection: None | str | pyproj.Proj | "crs.Projection" = None,
) -> Flight:
"""Resample the trajectory at a given frequency or for a target number
Expand All @@ -1681,7 +1681,7 @@ def resample(
``"interpolate"``, ``"ffill"``) and names of columns as values.
Columns not included in any value are left as is.
:param interpolation_options: (default: ``{}``)
:param interpolate_kw: (default: ``{}``)
- A dictionary with keyword arguments that will be passed to the
pandas :py:method:`pandas.Series.interpolate` method.
Expand All @@ -1691,7 +1691,7 @@ def resample(
pass the following dictionary:
.. code-block:: python
interpolation_options = {"method": "polynomial", "order": 5}
interpolate_kw = {"method": "polynomial", "order": 5}
:param projection: (default: ``None``)
Expand Down Expand Up @@ -1742,9 +1742,7 @@ def resample(
for meth, columns in how.items():
if meth is not None:
idx = data.columns.get_indexer(columns)
kwargs = (
interpolation_options if meth == "interpolate" else {}
)
kwargs = interpolate_kw if meth == "interpolate" else {}
value = getattr(data.iloc[:, idx], meth)(**kwargs)
data[data.columns[idx]] = value

Expand Down
2 changes: 1 addition & 1 deletion tests/test_flight.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,7 +524,7 @@ def test_resample_how_argument() -> None:
resampled_interpolate_quadratic = Flight(df).resample(
"1s",
how="interpolate",
interpolation_options={"method": "polynomial", "order": 2},
interpolate_kw={"method": "polynomial", "order": 2},
)
pd.testing.assert_frame_equal(
resampled_interpolate_quadratic.data[["altitude", "fake"]],
Expand Down

0 comments on commit 820c029

Please sign in to comment.