Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
libcdi
Commits
9ae75618
Commit
9ae75618
authored
Mar 30, 2015
by
Uwe Schulzweida
Browse files
gribapiDefLevel: use function grib2DefLevel() to write grib2 levels
parent
efb0b5c0
Changes
3
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
9ae75618
2015-03-30 Uwe Schulzweida
* gribapiDefLevel: use function grib2DefLevel() to write grib2 levels
2015-03-29 Uwe Schulzweida
* vlistMerge: compare size of grids (bug fix)
...
...
src/stream_cdf.c
View file @
9ae75618
...
...
@@ -4789,6 +4789,12 @@ int isDBLAxis(/*const char *units,*/ const char *longname)
return
(
status
);
}
static
int
unitsIsMeter
(
const
char
*
units
)
{
return
(
*
units
==
'm'
&&
(
strcmp
(
units
,
"m"
)
==
0
||
strncmp
(
units
,
"meter"
,
5
)
==
0
));
}
static
int
isDepthAxis
(
const
char
*
stdname
,
const
char
*
longname
)
{
...
...
@@ -5775,7 +5781,7 @@ void verify_coordinate_vars_1(int ndims, ncdim_t *ncdims, ncvar_t *ncvars, int t
{
ncvars
[
ncvarid
].
zaxistype
=
ZAXIS_DEPTH_BELOW_LAND
;
}
else
if
(
strcmp
(
ncvars
[
ncvarid
].
units
,
"m"
)
==
0
)
else
if
(
unitsIsMeter
(
ncvars
[
ncvarid
].
units
)
)
{
if
(
isDepthAxis
(
ncvars
[
ncvarid
].
stdname
,
ncvars
[
ncvarid
].
longname
)
)
ncvars
[
ncvarid
].
zaxistype
=
ZAXIS_DEPTH_BELOW_SEA
;
...
...
@@ -5862,7 +5868,7 @@ void verify_coordinate_vars_2(int nvars, ncvar_t *ncvars)
ncvars
[
ncvarid
].
zaxistype
=
ZAXIS_DEPTH_BELOW_LAND
;
continue
;
}
else
if
(
strcmp
(
ncvars
[
ncvarid
].
units
,
"m"
)
==
0
)
else
if
(
unitsIsMeter
(
ncvars
[
ncvarid
].
units
)
)
{
if
(
isDepthAxis
(
ncvars
[
ncvarid
].
stdname
,
ncvars
[
ncvarid
].
longname
)
)
ncvars
[
ncvarid
].
zaxistype
=
ZAXIS_DEPTH_BELOW_SEA
;
...
...
src/stream_gribapi.c
View file @
9ae75618
...
...
@@ -2281,6 +2281,8 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
zaxisDefUnits
(
zaxisID
,
"Pa"
);
}
int
grib2ltype
=
zaxisTypeToGrib2ltype
(
zaxistype
);
switch
(
zaxistype
)
{
case
ZAXIS_SURFACE
:
...
...
@@ -2292,11 +2294,14 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
case
ZAXIS_ISENTROPIC
:
{
if
(
editionNumber
<=
1
)
gribapiDefLevelType
(
gh
,
gcinit
,
"indicatorOfTypeOfLevel"
,
zaxisTypeToGrib1ltype
(
zaxistype
));
{
gribapiDefLevelType
(
gh
,
gcinit
,
"indicatorOfTypeOfLevel"
,
zaxisTypeToGrib1ltype
(
zaxistype
));
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"level"
,
(
long
)
level
),
0
);
}
else
gribapiDefLevelType
(
gh
,
gcinit
,
"typeOfFirstFixedSurface"
,
zaxisTypeToGrib2ltype
(
zaxistype
));
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"level"
,
(
long
)
level
),
0
);
{
grib2DefLevel
(
gh
,
gcinit
,
grib2ltype
,
grib2ltype
,
lbounds
,
level
,
dlevel1
,
dlevel2
);
}
break
;
}
...
...
@@ -2312,27 +2317,22 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
case
ZAXIS_MIX_LAYER
:
case
ZAXIS_ATMOSPHERE
:
{
if
(
lbounds
)
if
(
editionNumber
<=
1
)
{
if
(
editionNumber
<=
1
)
gribapiDefLevelType
(
gh
,
gcinit
,
"indicatorOfTypeOfLevel"
,
zaxisTypeToGrib1ltype
(
zaxistype
));
gribapiDefLevelType
(
gh
,
gcinit
,
"indicatorOfTypeOfLevel"
,
zaxisTypeToGrib1ltype
(
zaxistype
));
if
(
lbounds
)
{
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"topLevel"
,
(
long
)
dlevel1
),
0
);
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"bottomLevel"
,
(
long
)
dlevel2
),
0
);
}
else
{
gribapiDefLevelType
(
gh
,
gcinit
,
"typeOfFirstFixedSurface"
,
zaxisTypeToGrib2ltype
(
zaxistype
));
gribapiDefLevelType
(
gh
,
gcinit
,
"typeOfSecondFixedSurface"
,
zaxisTypeToGrib2ltype
(
zaxistype
));
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"level"
,
(
long
)
level
),
0
);
}
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"topLevel"
,
(
long
)
dlevel1
),
0
);
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"bottomLevel"
,
(
long
)
dlevel2
),
0
);
}
else
{
if
(
editionNumber
<=
1
)
gribapiDefLevelType
(
gh
,
gcinit
,
"indicatorOfTypeOfLevel"
,
zaxisTypeToGrib1ltype
(
zaxistype
));
else
gribapiDefLevelType
(
gh
,
gcinit
,
"typeOfFirstFixedSurface"
,
zaxisTypeToGrib2ltype
(
zaxistype
));
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"level"
,
(
long
)
level
),
0
);
grib2DefLevel
(
gh
,
gcinit
,
grib2ltype
,
grib2ltype
,
lbounds
,
level
,
dlevel1
,
dlevel2
);
}
break
;
...
...
@@ -2340,28 +2340,24 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
case
ZAXIS_HYBRID
:
case
ZAXIS_HYBRID_HALF
:
{
if
(
lbounds
)
{
if
(
editionNumber
<=
1
)
gribapiDefLevelType
(
gh
,
gcinit
,
"indicatorOfTypeOfLevel"
,
GRIB1_LTYPE_HYBRID_LAYER
);
else
{
gribapiDefLevelType
(
gh
,
gcinit
,
"typeOfFirstFixedSurface"
,
GRIB2_LTYPE_HYBRID
);
gribapiDefLevelType
(
gh
,
gcinit
,
"typeOfSecondFixedSurface"
,
GRIB2_LTYPE_HYBRID
);
}
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"topLevel"
,
(
long
)
dlevel1
),
0
);
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"bottomLevel"
,
(
long
)
dlevel2
),
0
);
}
else
{
if
(
editionNumber
<=
1
)
gribapiDefLevelType
(
gh
,
gcinit
,
"indicatorOfTypeOfLevel"
,
GRIB1_LTYPE_HYBRID
);
if
(
editionNumber
<=
1
)
{
if
(
lbounds
)
{
gribapiDefLevelType
(
gh
,
gcinit
,
"indicatorOfTypeOfLevel"
,
GRIB1_LTYPE_HYBRID_LAYER
);
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"topLevel"
,
(
long
)
dlevel1
),
0
);
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"bottomLevel"
,
(
long
)
dlevel2
),
0
);
}
else
gribapiDefLevelType
(
gh
,
gcinit
,
"typeOfFirstFixedSurface"
,
GRIB2_LTYPE_HYBRID
);
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"level"
,
(
long
)
level
),
0
);
}
{
gribapiDefLevelType
(
gh
,
gcinit
,
"indicatorOfTypeOfLevel"
,
GRIB1_LTYPE_HYBRID
);
GRIB_CHECK
(
my_grib_set_long
(
gh
,
"level"
,
(
long
)
level
),
0
);
}
}
else
{
grib2DefLevel
(
gh
,
gcinit
,
GRIB2_LTYPE_HYBRID
,
GRIB2_LTYPE_HYBRID
,
lbounds
,
level
,
dlevel1
,
dlevel2
);
}
if
(
!
gcinit
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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