Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cdo
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Contributor 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
mpim-sw
cdo
Commits
6f21b9fd
Commit
6f21b9fd
authored
7 months ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Moved set_compression_type() to cdo_settings.cc
parent
90214970
No related branches found
No related tags found
1 merge request
!267
M214003/develop
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cdo.cc
+1
-36
1 addition, 36 deletions
src/cdo.cc
src/cdo_settings.cc
+35
-0
35 additions, 0 deletions
src/cdo_settings.cc
src/cdo_settings.h
+1
-0
1 addition, 0 deletions
src/cdo_settings.h
with
37 additions
and
36 deletions
src/cdo.cc
+
1
−
36
View file @
6f21b9fd
...
...
@@ -168,41 +168,6 @@ cdo_init_is_tty()
if
(
S_ISCHR
(
statbuf
.
st_mode
))
{
cdo
::
stderrIsTerminal
=
true
;
}
}
static
void
define_compress
(
const
std
::
string
&
arg
)
{
size_t
len
=
arg
.
size
();
if
(
arg
==
"szip"
)
{
Options
::
cdoCompType
=
CDI_COMPRESS_SZIP
;
Options
::
cdoCompLevel
=
0
;
}
else
if
(
arg
==
"aec"
||
arg
==
"ccsds"
)
{
Options
::
cdoCompType
=
CDI_COMPRESS_AEC
;
Options
::
cdoCompLevel
=
0
;
}
else
if
(
arg
==
"jpeg"
)
{
Options
::
cdoCompType
=
CDI_COMPRESS_JPEG
;
Options
::
cdoCompLevel
=
0
;
}
else
if
(
arg
.
starts_with
(
"zip"
))
{
Options
::
cdoCompType
=
CDI_COMPRESS_ZIP
;
Options
::
cdoCompLevel
=
(
len
==
5
&&
arg
[
3
]
==
'_'
&&
std
::
isdigit
(
arg
[
4
]))
?
std
::
atoi
(
&
arg
.
c_str
()[
4
])
:
1
;
}
else
if
(
arg
.
starts_with
(
"zstd"
))
{
int
filterIdZstd
=
32015
;
int
zstdLevel
=
(
len
>=
6
&&
len
<=
7
&&
arg
[
4
]
==
'_'
&&
std
::
isdigit
(
arg
[
5
]))
?
std
::
atoi
(
&
arg
.
c_str
()[
5
])
:
1
;
if
(
Options
::
filterSpec
.
size
()
>
0
)
{
cdo_abort
(
"Filter specs already defined! Only one filter specs is allowed."
);
}
Options
::
filterSpec
=
std
::
to_string
(
filterIdZstd
)
+
","
+
std
::
to_string
(
zstdLevel
);
}
else
{
cdo_abort
(
"Compression type '%s' unsupported!"
,
arg
);
}
}
static
void
define_chunktype
(
const
std
::
string
&
arg
)
{
...
...
@@ -927,7 +892,7 @@ setup_cli_options()
CLIOptions
::
option
(
"compression_type"
,
"z"
)
->
describe_argument
(
"aec|jpeg|zip[_1-9]|zstd[1-19]"
)
->
set_category
(
"Compression"
)
->
add_effect
([
&
](
const
std
::
string
&
argument
)
{
define
_compress
(
argument
);
})
->
add_effect
([
&
](
const
std
::
string
&
argument
)
{
cdo
::
set
_compress
ion_type
(
argument
);
})
->
add_help
(
"aec AEC compression of GRIB2 records"
,
"jpeg JPEG compression of GRIB2 records"
,
"zip[_1-9] Deflate compression of NetCDF4 variables"
,
"zstd[_1-19] Zstandard compression of NetCDF4 variables"
);
...
...
This diff is collapsed.
Click to expand it.
src/cdo_settings.cc
+
35
−
0
View file @
6f21b9fd
...
...
@@ -313,4 +313,39 @@ set_filterspec(const std::string &arg)
else
{
cdo_abort
(
"Filter spec missing!"
);
}
}
void
set_compression_type
(
const
std
::
string
&
arg
)
{
size_t
len
=
arg
.
size
();
if
(
arg
==
"szip"
)
{
Options
::
cdoCompType
=
CDI_COMPRESS_SZIP
;
Options
::
cdoCompLevel
=
0
;
}
else
if
(
arg
==
"aec"
||
arg
==
"ccsds"
)
{
Options
::
cdoCompType
=
CDI_COMPRESS_AEC
;
Options
::
cdoCompLevel
=
0
;
}
else
if
(
arg
==
"jpeg"
)
{
Options
::
cdoCompType
=
CDI_COMPRESS_JPEG
;
Options
::
cdoCompLevel
=
0
;
}
else
if
(
arg
.
starts_with
(
"zip"
))
{
Options
::
cdoCompType
=
CDI_COMPRESS_ZIP
;
Options
::
cdoCompLevel
=
(
len
==
5
&&
arg
[
3
]
==
'_'
&&
std
::
isdigit
(
arg
[
4
]))
?
std
::
atoi
(
&
arg
.
c_str
()[
4
])
:
1
;
}
else
if
(
arg
.
starts_with
(
"zstd"
))
{
int
filterIdZstd
=
32015
;
int
zstdLevel
=
(
len
>=
6
&&
len
<=
7
&&
arg
[
4
]
==
'_'
&&
std
::
isdigit
(
arg
[
5
]))
?
std
::
atoi
(
&
arg
.
c_str
()[
5
])
:
1
;
if
(
Options
::
filterSpec
.
size
()
>
0
)
{
cdo_abort
(
"Filter specs already defined! Only one filter specs is allowed."
);
}
Options
::
filterSpec
=
std
::
to_string
(
filterIdZstd
)
+
","
+
std
::
to_string
(
zstdLevel
);
}
else
{
cdo_abort
(
"Compression type '%s' unsupported!"
,
arg
);
}
}
};
// namespace cdo
This diff is collapsed.
Click to expand it.
src/cdo_settings.h
+
1
−
0
View file @
6f21b9fd
...
...
@@ -20,6 +20,7 @@ void set_digits(const std::string &arg);
void
set_default_filetype
(
std
::
string
filetypeString
);
void
set_default_datatype
(
const
std
::
string
&
datatypeString
);
void
set_filterspec
(
const
std
::
string
&
arg
);
void
set_compression_type
(
const
std
::
string
&
arg
);
};
// namespace cdo
...
...
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