Skip to content

Commit

Permalink
npz: do not sort keys, use archive/zip.File order
Browse files Browse the repository at this point in the history
  • Loading branch information
sbinet committed Nov 19, 2020
1 parent 55042cb commit cea961e
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
4 changes: 2 additions & 2 deletions npz/npz_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ func ExampleOpen() {
fmt.Printf("arr1: %v\n", f1)

// Output:
// arr0.npy: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[2 3]}}
// arr1.npy: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[6 1]}}
// arr0.npy: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[2 3]}}
// arr0: [0 1 2 3 4 5]
// arr1: [0 1 2 3 4 5]
}
Expand Down Expand Up @@ -82,8 +82,8 @@ func ExampleReader() {
fmt.Printf("arr1: %v\n", f1)

// Output:
// arr0.npy: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[2 3]}}
// arr1.npy: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[6 1]}}
// arr0.npy: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[2 3]}}
// arr0: [0 1 2 3 4 5]
// arr1: [0 1 2 3 4 5]
}
Expand Down
3 changes: 0 additions & 3 deletions npz/reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (
"fmt"
"io"
"os"
"sort"

"github.com/sbinet/npyio/npy"
)
Expand Down Expand Up @@ -69,7 +68,6 @@ func Open(name string) (*Reader, error) {
for i, f := range rz.File {
keys[i] = f.Name
}
sort.Strings(keys)

return &Reader{
r: r,
Expand All @@ -91,7 +89,6 @@ func NewReader(r io.ReaderAt, size int64) (*Reader, error) {
for i, f := range rz.File {
keys[i] = f.Name
}
sort.Strings(keys)

return &Reader{
r: r,
Expand Down
8 changes: 4 additions & 4 deletions testdata/data_float64_corder.npz.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
================================================================================
file: testdata/data_float64_corder.npz
entry: arr0.npy
npy-header: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[2 3]}}
data = [0 1 2 3 4 5]

entry: arr1.npy
npy-header: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[6 1]}}
data = [0 1 2 3 4 5]

entry: arr0.npy
npy-header: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:false, Shape:[2 3]}}
data = [0 1 2 3 4 5]
8 changes: 4 additions & 4 deletions testdata/data_float64_forder.npz.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
================================================================================
file: testdata/data_float64_forder.npz
entry: arr0.npy
npy-header: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:true, Shape:[2 3]}}
data = [0 1 2 3 4 5]

entry: arr1.npy
npy-header: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:true, Shape:[6 1]}}
data = [0 1 2 3 4 5]

entry: arr0.npy
npy-header: Header{Major:1, Minor:0, Descr:{Type:<f8, Fortran:true, Shape:[2 3]}}
data = [0 1 2 3 4 5]

0 comments on commit cea961e

Please sign in to comment.