Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
a551428c
Commit
a551428c
authored
Nov 27, 2009
by
Uwe Schulzweida
Browse files
New operator: splittabnum - Split parameter table numbers
parent
53fe1571
Changes
7
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
a551428c
2009-11-27 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* New operator: splittabnum - Split parameter table numbers
2009-11-19 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* showtime: removed output of date, only print time string hh:mm:ss
...
...
OPERATORS
View file @
a551428c
...
...
@@ -48,6 +48,7 @@ Operator catalog:
Split splitlevel Split levels
Split splitgrid Split grids
Split splitzaxis Split z-axes
Split splittabnum Split parameter table numbers
Splittime splithour Split hours
Splittime splitday Split days
Splittime splitmon Split months
...
...
doc/cdo_refcard.pdf
View file @
a551428c
No preview for this file type
doc/tex/mod/Split
View file @
a551428c
...
...
@@ -5,7 +5,7 @@
@Section = File operations
@Class = File operation
@Arguments = ifile oprefix
@Operators = splitcode splitname splitlevel splitgrid splitzaxis
@Operators = splitcode splitname splitlevel splitgrid splitzaxis
splittabnum
@BeginDescription
This module splits a dataset to several files with names
...
...
@@ -69,16 +69,26 @@ form the output file names.
@EndOperator
@BeginOperator_split
rec
@Title = Split
record
s
@BeginOperator_split
tabnum
@Title = Split
parameter table number
s
@BeginDescription
Splits a dataset into pieces, one for each
record
.
Appends
six
digits with the
record
number to @file{oprefix} to
Splits a dataset into pieces, one for each
GRIB1 parameter table number
.
Appends
three
digits with the
table
number to @file{oprefix} to
form the output file names.
@EndDescription
@c @BeginOperator_splitrec
@c @Title = Split records
@c @BeginDescription
@c Splits a dataset into pieces, one for each record.
@c Appends six digits with the record number to @file{oprefix} to
@c form the output file names.
@c @EndDescription
@BeginExample
Assume an input GRIB dataset with three variables, e.g. code number 129, 130 and 139.
To split this dataset into three pieces, one for each code number use:
...
...
src/Split.c
View file @
a551428c
...
...
@@ -23,6 +23,7 @@
Split splitlevel Split levels
Split splitgrid Split grids
Split splitzaxis Split zaxis
Split splittabnum Split table numbers
*/
...
...
@@ -37,12 +38,12 @@
void
*
Split
(
void
*
argument
)
{
static
char
func
[]
=
"Split"
;
int
SPLITCODE
,
SPLITNAME
,
SPLITLEVEL
,
SPLITGRID
,
SPLITZAXIS
;
int
SPLITCODE
,
SPLITNAME
,
SPLITLEVEL
,
SPLITGRID
,
SPLITZAXIS
,
SPLITTABNUM
;
int
operatorID
;
int
nchars
;
int
streamID1
;
int
varID
;
int
code
;
int
code
,
tabnum
;
int
nrecs
,
nvars
,
nzaxis
,
nlevs
;
int
tsID
,
recID
,
levelID
,
zaxisID
,
levID
;
int
varID2
,
levelID2
;
...
...
@@ -62,11 +63,12 @@ void *Split(void *argument)
cdoInitialize
(
argument
);
SPLITCODE
=
cdoOperatorAdd
(
"splitcode"
,
0
,
0
,
NULL
);
SPLITNAME
=
cdoOperatorAdd
(
"splitname"
,
0
,
0
,
NULL
);
SPLITLEVEL
=
cdoOperatorAdd
(
"splitlevel"
,
0
,
0
,
NULL
);
SPLITGRID
=
cdoOperatorAdd
(
"splitgrid"
,
0
,
0
,
NULL
);
SPLITZAXIS
=
cdoOperatorAdd
(
"splitzaxis"
,
0
,
0
,
NULL
);
SPLITCODE
=
cdoOperatorAdd
(
"splitcode"
,
0
,
0
,
NULL
);
SPLITNAME
=
cdoOperatorAdd
(
"splitname"
,
0
,
0
,
NULL
);
SPLITLEVEL
=
cdoOperatorAdd
(
"splitlevel"
,
0
,
0
,
NULL
);
SPLITGRID
=
cdoOperatorAdd
(
"splitgrid"
,
0
,
0
,
NULL
);
SPLITZAXIS
=
cdoOperatorAdd
(
"splitzaxis"
,
0
,
0
,
NULL
);
SPLITTABNUM
=
cdoOperatorAdd
(
"splittabnum"
,
0
,
0
,
NULL
);
operatorID
=
cdoOperatorID
();
...
...
@@ -146,6 +148,59 @@ void *Split(void *argument)
}
if
(
codes
)
free
(
codes
);
}
else
if
(
operatorID
==
SPLITTABNUM
)
{
int
*
tabnums
=
NULL
;
nsplit
=
0
;
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
tabnum
=
tableInqNum
(
vlistInqVarTable
(
vlistID1
,
varID
));
for
(
index
=
0
;
index
<
varID
;
index
++
)
if
(
tabnum
==
tableInqNum
(
vlistInqVarTable
(
vlistID1
,
index
))
)
break
;
if
(
index
==
varID
)
{
itmp
[
nsplit
]
=
tabnum
;
nsplit
++
;
}
}
tabnums
=
(
int
*
)
malloc
(
nsplit
*
sizeof
(
int
));
vlistIDs
=
(
int
*
)
malloc
(
nsplit
*
sizeof
(
int
));
streamIDs
=
(
int
*
)
malloc
(
nsplit
*
sizeof
(
int
));
memcpy
(
tabnums
,
itmp
,
nsplit
*
sizeof
(
int
));
for
(
index
=
0
;
index
<
nsplit
;
index
++
)
{
vlistClearFlag
(
vlistID1
);
for
(
varID
=
0
;
varID
<
nvars
;
varID
++
)
{
tabnum
=
tableInqNum
(
vlistInqVarTable
(
vlistID1
,
varID
));
zaxisID
=
vlistInqVarZaxis
(
vlistID1
,
varID
);
nlevs
=
zaxisInqSize
(
zaxisID
);
if
(
tabnums
[
index
]
==
tabnum
)
{
for
(
levID
=
0
;
levID
<
nlevs
;
levID
++
)
{
vlistDefIndex
(
vlistID1
,
varID
,
levID
,
index
);
vlistDefFlag
(
vlistID1
,
varID
,
levID
,
TRUE
);
}
}
}
vlistID2
=
vlistCreate
();
vlistCopyFlag
(
vlistID2
,
vlistID1
);
vlistIDs
[
index
]
=
vlistID2
;
sprintf
(
filename
+
nchars
,
"%03d"
,
tabnums
[
index
]);
if
(
filesuffix
[
0
]
)
sprintf
(
filename
+
nchars
+
3
,
"%s"
,
filesuffix
);
streamIDs
[
index
]
=
streamOpenWrite
(
filename
,
cdoFiletype
());
if
(
streamIDs
[
index
]
<
0
)
cdiError
(
streamIDs
[
index
],
"Open failed on %s"
,
filename
);
streamDefVlist
(
streamIDs
[
index
],
vlistIDs
[
index
]);
}
if
(
tabnums
)
free
(
tabnums
);
}
else
if
(
operatorID
==
SPLITNAME
)
{
char
varname
[
128
];
...
...
src/modules.c
View file @
a551428c
...
...
@@ -358,11 +358,11 @@ void *Wct(void *argument);
#define SinfoOperators {"sinfo", "sinfov", "sinfop"}
#define Smooth9Operators {"smooth9"}
#define SortOperators {"sortcode", "sortname", "sortlevel"}
#define SorttimestampOperators {"sorttimestamp"}
#define SorttimestampOperators {"sorttimestamp"
, "sorttaxis"
}
#define SpecinfoOperators {"specinfo"}
#define SpectralOperators {"gp2sp", "gp2spl", "sp2gp", "sp2gpl", "sp2sp", "spcut"}
#define SpectrumOperators {"spectrum"}
#define SplitOperators {"splitcode", "splitname", "splitlevel", "splitgrid", "splitzaxis"}
#define SplitOperators {"splitcode", "splitname", "splitlevel", "splitgrid", "splitzaxis"
, "splittabnum"
}
#define SplitrecOperators {"splitrec"}
#define SplitselOperators {"splitsel"}
#define SplittimeOperators {"splithour", "splitday", "splitmon", "splitseas"}
...
...
src/operator_help.h
View file @
a551428c
...
...
@@ -237,7 +237,8 @@ static char *MergeHelp[] = {
static
char
*
SplitHelp
[]
=
{
"NAME"
,
" splitcode, splitname, splitlevel, splitgrid, splitzaxis - Split a dataset"
,
" splitcode, splitname, splitlevel, splitgrid, splitzaxis, splittabnum - "
,
" Split a dataset"
,
""
,
"SYNOPSIS"
,
" <operator> ifile oprefix"
,
...
...
@@ -247,26 +248,30 @@ static char *SplitHelp[] = {
" formed from the field header information and the string oprefix."
,
""
,
"OPERATORS"
,
" splitcode Split code numbers"
,
" Splits a dataset into pieces, one for each different code number."
,
" Appends three digits with the code number to oprefix to "
,
" form the output file names."
,
" splitname Split variable names"
,
" Splits a dataset into pieces, one for each variable name."
,
" Appends a string with the variable name to oprefix to "
,
" form the output file names."
,
" splitlevel Split levels"
,
" Splits a dataset into pieces, one for each different level."
,
" Appends six digits with the level to oprefix to "
,
" form the output file names."
,
" splitgrid Split grids"
,
" Splits a dataset into pieces, one for each different grid."
,
" Appends two digits with the grid number to oprefix to "
,
" form the output file names."
,
" splitzaxis Split z-axes"
,
" Splits a dataset into pieces, one for each different z-axis."
,
" Appends two digits with the z-axis number to oprefix to "
,
" form the output file names."
,
" splitcode Split code numbers"
,
" Splits a dataset into pieces, one for each different code number."
,
" Appends three digits with the code number to oprefix to "
,
" form the output file names."
,
" splitname Split variable names"
,
" Splits a dataset into pieces, one for each variable name."
,
" Appends a string with the variable name to oprefix to "
,
" form the output file names."
,
" splitlevel Split levels"
,
" Splits a dataset into pieces, one for each different level."
,
" Appends six digits with the level to oprefix to "
,
" form the output file names."
,
" splitgrid Split grids"
,
" Splits a dataset into pieces, one for each different grid."
,
" Appends two digits with the grid number to oprefix to "
,
" form the output file names."
,
" splitzaxis Split z-axes"
,
" Splits a dataset into pieces, one for each different z-axis."
,
" Appends two digits with the z-axis number to oprefix to "
,
" form the output file names."
,
" splittabnum Split parameter table numbers"
,
" Splits a dataset into pieces, one for each GRIB1 parameter table number."
,
" Appends three digits with the table number to oprefix to "
,
" form the output file names."
,
NULL
};
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment