Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
mpim-sw
libcdi
Commits
9e265752
Commit
9e265752
authored
7 years ago
by
Uwe Schulzweida
Browse files
Options
Downloads
Patches
Plain Diff
Added gribapiDefGridSpectral().
parent
8edb2be3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/stream_gribapi.c
+26
-31
26 additions, 31 deletions
src/stream_gribapi.c
with
26 additions
and
31 deletions
src/stream_gribapi.c
+
26
−
31
View file @
9e265752
...
...
@@ -2074,6 +2074,23 @@ void gribapiDefGridUnstructured(grib_handle *gh, int gridID)
}
}
static
void
gribapiDefGridSpectral
(
grib_handle
*
gh
,
int
gridID
)
{
int
trunc
=
gridInqTrunc
(
gridID
);
enum
{
numTruncAtt
=
3
};
static
const
char
truncAttNames
[
numTruncAtt
][
2
]
=
{
"J"
,
"K"
,
"M"
};
for
(
size_t
i
=
0
;
i
<
numTruncAtt
;
++
i
)
GRIB_CHECK
(
my_grib_set_long
(
gh
,
truncAttNames
[
i
],
trunc
),
0
);
if
(
gridInqComplexPacking
(
gridID
)
)
{
static
const
char
truncAttNames
[
numTruncAtt
][
3
]
=
{
"JS"
,
"KS"
,
"MS"
};
for
(
size_t
i
=
0
;
i
<
numTruncAtt
;
++
i
)
GRIB_CHECK
(
my_grib_set_long
(
gh
,
truncAttNames
[
i
],
20
),
0
);
}
}
static
void
gribapiDefPackingType
(
grib_handle
*
gh
,
bool
lieee
,
bool
lspectral
,
bool
lcomplex
,
int
comptype
,
size_t
gridsize
)
{
...
...
@@ -2141,7 +2158,14 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
if
(
lieee
)
comptype
=
0
;
if
(
lspectral
)
lieee
=
false
;
if
(
gridtype
!=
GRID_SPECTRAL
)
gribapiDefPackingType
(
gh
,
lieee
,
lspectral
,
lcomplex
,
comptype
,
gridsize
);
if
(
lspectral
)
// gridType needs to be defined before packingType !!!
{
static
const
char
mesg
[]
=
"sh"
;
size_t
len
=
sizeof
(
mesg
)
-
1
;
GRIB_CHECK
(
my_grib_set_string
(
gh
,
"gridType"
,
mesg
,
&
len
),
0
);
}
gribapiDefPackingType
(
gh
,
lieee
,
lspectral
,
lcomplex
,
comptype
,
gridsize
);
if
(
lieee
)
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"precision"
,
datatype
==
CDI_DATATYPE_FLT64
?
2
:
1
),
0
);
...
...
@@ -2164,36 +2188,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
}
case
GRID_SPECTRAL
:
{
{
static
const
char
mesg
[]
=
"sh"
;
size_t
len
=
sizeof
(
mesg
)
-
1
;
GRIB_CHECK
(
my_grib_set_string
(
gh
,
"gridType"
,
mesg
,
&
len
),
0
);
}
{
int
trunc
=
gridInqTrunc
(
gridID
);
enum
{
numTruncAtt
=
3
};
static
const
char
truncAttNames
[
numTruncAtt
][
2
]
=
{
"J"
,
"K"
,
"M"
};
for
(
size_t
i
=
0
;
i
<
numTruncAtt
;
++
i
)
GRIB_CHECK
(
my_grib_set_long
(
gh
,
truncAttNames
[
i
],
trunc
),
0
);
}
if
(
gridInqComplexPacking
(
gridID
)
)
{
static
const
char
mesg
[]
=
"spectral_complex"
;
size_t
len
=
sizeof
(
mesg
)
-
1
;
GRIB_CHECK
(
my_grib_set_string
(
gh
,
"packingType"
,
mesg
,
&
len
),
0
);
enum
{
numTruncAtt
=
3
};
static
const
char
truncAttNames
[
numTruncAtt
][
3
]
=
{
"JS"
,
"KS"
,
"MS"
};
for
(
size_t
i
=
0
;
i
<
numTruncAtt
;
++
i
)
GRIB_CHECK
(
my_grib_set_long
(
gh
,
truncAttNames
[
i
],
20
),
0
);
}
else
{
static
const
char
mesg
[]
=
"spectral_simple"
;
size_t
len
=
sizeof
(
mesg
)
-
1
;
GRIB_CHECK
(
my_grib_set_string
(
gh
,
"packingType"
,
mesg
,
&
len
),
0
);
}
gribapiDefGridSpectral
(
gh
,
gridID
);
break
;
}
case
GRID_GME
:
...
...
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