keller-mark / pizzarr

Slice into Zarr arrays in R 🍕
https://keller-mark.github.io/pizzarr/
MIT License
25 stars 2 forks source link

Test with negative step #41

Open keller-mark opened 10 months ago

dblodgett-usgs commented 2 weeks ago

I was looking at what this would mean and couldn't figure out what you mean by a "negative step"

keller-mark commented 2 weeks ago

Sorry, should have added more context. I was referring to the numpy / python ability to provide a negative step value:

import numpy as np
a = np.array(range(1, 20))
# array([ 1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19])

a[5:0:-1]
# array([6, 5, 4, 3, 2])

# also, can provide negative start/end
a[-5:0:-1]
array([15, 14, 13, 12, 11, 10,  9,  8,  7,  6,  5,  4,  3,  2])