Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add selection mode to select method #4312

Open
philippjfr opened this issue Mar 23, 2020 · 2 comments
Open

Add selection mode to select method #4312

philippjfr opened this issue Mar 23, 2020 · 2 comments
Labels
type: enhancement Minor feature or improvement to an existing feature

Comments

@philippjfr
Copy link
Member

philippjfr commented Mar 23, 2020

In #3842 @jonmmease made a nice proposal for adding an argument to control a selection_mode to the Dataset.select method. The problem is that .select for connected entities like Curve/Area/Spread etc. will introduce gaps in the data which will simply be connected if there are no nans in the data. For linked_selections we therefore implemented a Interface.mask method. To generalize this we should expose the option to mask from .select. I'll also reproduce the original proposal here:

To handle selections on continuous elements (Curve, Area, etc.) it is important to maintain NaN value(s) where data were rejected by the selection criteria, otherwise it's not possible to break the element properly. Here's an example of the problem that arises with an Area element with the default selection behavior.

area * area.select(y=(0.5, None))

Screen Shot 2019-07-23 at 6 39 24 AM

The proposal here is to add a new kwarg to .select to control how rejected data is handle. Naming is still up for discussion, but something like selection_mode, with three options

  • 'filter': Remove all rows that don't satisy the criteria (current and default behavior)
  • 'mask': Replace values in all rows that don't satisfy criteria with NaNs. This would behave somewhat like the pandas where method.
  • 'nan_join': Replace contiguous blocks of rows that don't satisfy criteria with a single row containing NaNs. This is what the selection framework would use.
area * area.select(selection_mode='nan_join', y=(0.5, None))

Screen Shot 2019-07-23 at 10 28 48 AM

@philippjfr philippjfr added the type: enhancement Minor feature or improvement to an existing feature label Mar 23, 2020
@jbednar
Copy link
Member

jbednar commented Mar 23, 2020

Sounds great to me. Supporting Curve seems very important.

@alexbraditsas
Copy link
Contributor

alexbraditsas commented May 9, 2020

Hello, we cannot find the Interface.mask method that you are talking about. Maybe you refer to Interface.select_mask method? Thanks in advance. @philippjfr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Minor feature or improvement to an existing feature
Projects
None yet
Development

No branches or pull requests

3 participants