das-developers / das2java

The original das2 library. Provides interactive publication-ready 2-D plotting
https://das2.org
GNU Lesser General Public License v3.0
4 stars 0 forks source link

QDataSet slice1 of zero-length array shows index out of bounds #103

Open jbfaden opened 3 months ago

jbfaden commented 3 months ago

Sadie has a Jython script which loads data and then uses slice1 to get separate components, and this fails with an index-out-of-bounds. This is an equivalent script:

xy= randn(0,2)
x= xy[:,0]
y= xy[:,1]

This should be supported because QUBE datasets allow for length(0) to be called when there is no zeroth record.

What makes this ticket-worthy is it's not clear what should happen when the data is a non-qube. The logic is the old behavior, but I'm sure there are many non-qubes which slice1 property when they have at least one record.

jbfaden commented 3 months ago

Datasets identified as qubes will slice properly now.