Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OrcaSong
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Machine Learning
OrcaSong
Commits
b45ac582
Commit
b45ac582
authored
3 years ago
by
Stefan Reck
Browse files
Options
Downloads
Patches
Plain Diff
concatenate: keep exact same chunksize, not only first axis
parent
0449ad6c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!27
Adjust chunks
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
orcasong/tools/concatenate.py
+7
-4
7 additions, 4 deletions
orcasong/tools/concatenate.py
tests/test_concatenate.py
+1
-1
1 addition, 1 deletion
tests/test_concatenate.py
with
8 additions
and
5 deletions
orcasong/tools/concatenate.py
+
7
−
4
View file @
b45ac582
...
...
@@ -144,11 +144,15 @@ class FileConcatenator:
chunks
=
self
.
comptopts
[
"
chunksize
"
]
if
isinstance
(
chunks
,
dict
):
chunks
=
chunks
[
dset_name
]
else
:
# if chunk is an integer, its the first dimension and same
# chunks for all datasets
chunks
=
(
chunks
,)
+
folder_data
.
shape
[
1
:]
output_dataset
=
f_out
.
create_dataset
(
dset_name
,
data
=
folder_data
,
maxshape
=
dset_shape
,
chunks
=
(
chunks
,
)
+
folder_data
.
shape
[
1
:],
chunks
=
chunks
,
compression
=
self
.
comptopts
[
"
complib
"
],
compression_opts
=
self
.
comptopts
[
"
complevel
"
],
shuffle
=
self
.
comptopts
[
"
shuffle
"
],
...
...
@@ -267,8 +271,7 @@ def get_compopts(file):
the concatenated output files.
A compression level is only available for gzip compression, not lzf!
chunksize : None/dict
Specifies the chunksize of each dataset for axis_0 in the
concatenated output files.
Specifies the chunksize of each dataset in the conc output files.
shuffle : bool
Enable shuffle filter for chunks.
...
...
@@ -276,7 +279,7 @@ def get_compopts(file):
with
h5py
.
File
(
file
,
"
r
"
)
as
f
:
dset_names
=
strip_keys
(
list
(
f
.
keys
()))
comptopts
=
{}
comptopts
[
"
chunksize
"
]
=
{
d
:
f
[
d
].
chunks
[
0
]
for
d
in
dset_names
}
comptopts
[
"
chunksize
"
]
=
{
d
:
f
[
d
].
chunks
for
d
in
dset_names
}
# for reading the other comptopts, take first datset thats not indexed
for
dset_name
in
dset_names
:
dset
=
f
[
dset_name
]
...
...
This diff is collapsed.
Click to expand it.
tests/test_concatenate.py
+
1
−
1
View file @
b45ac582
...
...
@@ -31,7 +31,7 @@ class TestFileConcatenator(unittest.TestCase):
cls
.
compt_opts
=
{
"
complib
"
:
"
gzip
"
,
"
complevel
"
:
1
,
"
chunksize
"
:
{
"
numpy_array
"
:
5
,
"
rec_array
"
:
5
},
"
chunksize
"
:
{
"
numpy_array
"
:
(
5
,
7
,
3
)
,
"
rec_array
"
:
(
5
,)
},
"
shuffle
"
:
False
,
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment