xvariable_masked_view

Defined in xframe/xvariable_masked_view.hpp

template<class CTV, class CTAX>
class xvariable_masked_view : public xt::xview_semantic<xvariable_masked_view<CTV, CTAX>>, private xf::xvariable_base<xvariable_masked_view<CTV, CTAX>>

View on a variable which will apply a mask on the variable, given an expression on the axes.

The xvariable_masked_view class is used for applying a mask on a variable, avoiding assignment to masked values when assigning a scalar or an other variable to the view. The mask is created given an expression on the axes.

Template Parameters
  • CTV: the closure type on the underlying variable.

  • CTAX: the closure type on the axes function.

Public Functions

template<class V, class AX>
xvariable_masked_view(V &&variable_expr, AX &&axis_expr)

Builds an xvariable_masked_view.

Parameters
  • variable_expr: the underlying variable.

  • axis_expr: the axis expression.

template<class EV, class EAX>
auto xf::where(EV &&variable_expr, EAX &&axis_expr)

Apply a mask on a variable where the axis expression is false.

e.g.

// Will only assign 36 to values where the ordinate label is lower than 6
where(var, var.axis<int>("ordinate") < 6) = 36;

// Will only add 2.4 to values where the abscissa is not equal to 'm' and the ordinate is not equal to 1
where(
     var,
     not_equal(var.axis<char>("abscissa"), 'm')) && not_equal(var.axis<int>("ordinate"), 1)
) += 2.4;
Return

an xvariable_masked_view.

Parameters
  • variable_expr: the variable.

  • axis_expr: the axis expression.