Skip to content

Python and C++ API: dims, values, and variances properties (continued) #290

@SimonHeybrock

Description

@SimonHeybrock

In #291 we change the values and variances properties to return py::array_t.

  • This is not possible for non-POD types (std::string, Dataset, boost::small_vector, ...).
  • In the current implementation we are still returning the flattened VariableView (or span) in those cases. This is inconsistent and should be changed to return something equivalent to a numpy.ndarray (in terms of the basis interface provided, such as shape and index access).
  • Doing so might be much easier if we also make this change on the C++ side, i.e., provide a shaped alternative to VariableView. However, this may be tricky since the view type might depend on the number of dimensions (since it affects, e.g., the return type of operator[]), so it is not clear whether this is a desirable change on the C++ side.
  • Once this is complete, change the dims property to match the behavior of that in xarray.DataArray, i.e., include only the labels, not the shape (done, without underlying C++ change).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions