Skip to content
Snippets Groups Projects

add limit parameter to interpolation functions

Closed David Schäfer requested to merge interpol-params into develop
2 unresolved threads

The functions interpolate and linear currently don't expose the parameter limit which makes the unsuitable to do interpolations in a classical sense, i.e. fill all missing values. This MR introduces the parameter and sets them to None.

After we decided on !645 (closed), I would also like to expose extrapolate.

Edited by David Schäfer

Merge request reports

Pipeline #157448 passed

Pipeline passed for d22dd37e on interpol-params

Test coverage 77.00% (0.00%) from 1 job

Closed by David SchäferDavid Schäfer 2 years ago (Mar 21, 2023 10:01pm UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
40 40 self: "SaQC",
41 41 field: str,
42 42 freq: str,
43 limit: int | str | None = None,
  • I have a general Subjection to this change:

    linear is our shorthand function for doing linear harmonisation, right? (So is it introduced in tutorials and stuff).

    1. as we advertise harmnisation (shift, interpolation, resampling), it works so, that it replaces the data with a new frequency grid (resamples it), and fills only those new frequency points , that have a preceeding and a succeeding value within freq range - this preserves the gap structure of the original data in the best posssible way. This working internally translates to limit always equaling 2. Thats the reason 2 was hard-coded in the "wrap". I find adding the parameter confusing for the user, because it adds a parameter, that is superfluent in the context of the intended function use and blows up the function signature.

    2. If you insist on having that parameter in the signature, i would insist on having it defaulting to 2, since default None will not result in , uhm, our "harmonisation as we know it/introduced it" - so any linear harm call would be blown up to:

    qc = qc.linear(field, freq, limit=2)
  • Please register or sign in to reply
  • 70 If `None` is passed, no Limit is set.
    71
    65 72 Returns
    66 73 -------
    67 74 saqc.SaQC
    68 75 """
    69 reserved = ["method", "order", "limit", "downgrade"]
    76 reserved = ["method", "order", "downgrade"]
    70 77 kwargs = filterKwargs(kwargs, reserved)
    71 return self.interpolateIndex(field, freq, "time", **kwargs)
    78 return self.interpolateIndex(
    79 field=field, freq=freq, method="time", limit=limit, **kwargs
    80 )
    72 81
    73 82 @register(mask=["field"], demask=[], squeeze=[])
    74 83 def interpolate(
  • I think there is a missunderstanding stemming from the functions names. Those are not usual interpolations, although they seem to be judging from their names, but those are the harmonisation functions.

    When module structure was required to be included in the call, this was more obveous, since the call was:

    qc = qc.resampling.linear(...)
    qc = qc.resampling.interpolation(...)

    with resampling being an operation closely related to what we call harmonisation

    Now with the module exposure removed (wich is good) - the naming feels ambigue. So i think the best thing would be a renaming of those functions to avoid the confusion.

  • mentioned in issue #399 (closed)

  • Closing in favor of !648 (merged)

  • Please register or sign in to reply
    Loading