- #1
ProPatto16
- 326
- 0
Hi there,
I have 1024,1024 arrays (lots of them) which are really roughly 600,800 (it changes) and then buffered by zeros all the way around something like
000000000000000000
000000000000000000
000xxxxxxxxxxxxx000
000xxxxxxxxxxxxx000
000xxxxxxxxxxxxx000
000000000000000000
000000000000000000
i want to delete all the zeros
i can use numpy.all then numpy.delete but i can only make it work with 4 while loops... essentially one from each direction and its just long and untidy.
i can empty all the 0 elements with trim_zeros but then can't find a nice neat way to delete them.
I havnt tried boolean masking yet since i need the element values.
ideas?
thanks
I have 1024,1024 arrays (lots of them) which are really roughly 600,800 (it changes) and then buffered by zeros all the way around something like
000000000000000000
000000000000000000
000xxxxxxxxxxxxx000
000xxxxxxxxxxxxx000
000xxxxxxxxxxxxx000
000000000000000000
000000000000000000
i want to delete all the zeros
i can use numpy.all then numpy.delete but i can only make it work with 4 while loops... essentially one from each direction and its just long and untidy.
i can empty all the 0 elements with trim_zeros but then can't find a nice neat way to delete them.
I havnt tried boolean masking yet since i need the element values.
ideas?
thanks