xframe
xframe copied to clipboard
A variable with non matching shapes for coordinates and data should throw an error?
Creating a variable with non matching shapes for coordinates and data should throw an error.
Example with 3x3 data and 1x3 coordinates
using fstring = xtl::xfixed_string<55>;
using data_type = xt::xoptional_assembly<xt::xarray<double>, xt::xarray<bool>>;
using coordinate_type = xf::xcoordinate<fstring, data_type::size_type>;
using variable_type = xf::xvariable<coordinate_type, data_type>;
using variable_view_type = xf::xvariable_view<variable_type&>;
using saxis_type = xf::xaxis<fstring, std::size_t>;
using iaxis_type = xf::xaxis<int, std::size_t>;
fstring abscissa = "abscissa";
fstring ordinate = "ordinate";
// Shape 3x3
data_type data1 = {{ 1., 2., 3.},
{ 4., 5., 6.},
{ 7., 8., 9.}};
// Shape 1x3 for the coordinates
auto var1 = variable_type(
data1,
{
{abscissa, saxis_type({"a"})},
{ordinate, iaxis_type({1, 2, 4})}
}
);