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
libcdi
Commits
875d140e
Commit
875d140e
authored
Nov 05, 2013
by
Uwe Schulzweida
Browse files
Added CDI function zaxisDefNlevRef() and zaxisInqNlevRef() [Feature #4117]
parent
8f2abb10
Changes
6
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
875d140e
...
...
@@ -3,6 +3,10 @@
* Version 1.6.2 released
* using CGRIBEX library version 1.6.2
2013-11-05 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Added CDI function zaxisDefNlevRef() and zaxisInqNlevRef() [Feature #4117]
2013-11-04 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* merged branch cdi-pio to trunk cdi
...
...
NEWS
View file @
875d140e
...
...
@@ -5,7 +5,8 @@ Version 1.6.2 (12 November 2013):
New features:
* Added support for netCDF CF time attribute: climatology [Feature #4092]
* made gridtype GRID_REFERENCE part of GRID_UNSTRUCTED
* Added CDI function zaxisDefNlevRef() and zaxisInqNlevRef() [Feature #4117]
* Made gridtype GRID_REFERENCE part of GRID_UNSTRUCTED
* GRIB2: added support for level type Lake Bottom (grib level type 162)
* GRIB2: added support for level type Bottom Of Sediment Layer (grib level type 163)
* GRIB2: added support for level type Bottom Of Thermally Active Sediment Layer (grib level type 164)
...
...
src/cdi.h
View file @
875d140e
...
...
@@ -839,6 +839,12 @@ void zaxisDefLevel(int zaxisID, int levelID, double levels);
/* zaxisInqLevel: Get one level of a Z-axis */
double
zaxisInqLevel
(
int
zaxisID
,
int
levelID
);
/* zaxisDefNlevRef: Define the number of half levels of a generalized Z-axis */
void
zaxisDefNlevRef
(
int
gridID
,
int
nhlev
);
/* zaxisInqNlevRef: Get the number of half levels of a generalized Z-axis */
int
zaxisInqNlevRef
(
int
gridID
);
/* zaxisDefNumber: Define the reference number for a generalized Z-axis */
void
zaxisDefNumber
(
int
gridID
,
int
number
);
...
...
src/stream_gribapi.c
View file @
875d140e
...
...
@@ -878,7 +878,7 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
size_t
len
;
char
uuid
[
17
];
long
ltmp
;
long
nlev
,
nvgrid
;
long
n
h
lev
,
nvgrid
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"NV"
,
&
lpar
),
0
);
if
(
lpar
!=
6
)
...
...
@@ -886,13 +886,13 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
fprintf
(
stderr
,
"Warning ...
\n
"
);
}
GRIB_CHECK
(
grib_get_long
(
gh
,
"nlev"
,
&
ltmp
),
0
);
nlev
=
ltmp
;
n
h
lev
=
ltmp
;
GRIB_CHECK
(
grib_get_long
(
gh
,
"numberOfVGridUsed"
,
&
ltmp
),
0
);
nvgrid
=
ltmp
;
len
=
(
size_t
)
16
;
uuid
[
16
]
=
0
;
GRIB_CHECK
(
grib_get_bytes
(
gh
,
"uuidOfVGrid"
,
(
unsigned
char
*
)
uuid
,
&
len
),
0
);
varDefZAxisReference
((
int
)
nlev
,
(
int
)
nvgrid
,
uuid
);
varDefZAxisReference
((
int
)
n
h
lev
,
(
int
)
nvgrid
,
uuid
);
break
;
}
}
...
...
@@ -2893,7 +2893,7 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
gribapiDefLevelType
(
gh
,
gcinit
,
"typeOfFirstFixedSurface"
,
GRIB2_LTYPE_REFERENCE
);
gribapiDefLevelType
(
gh
,
gcinit
,
"typeOfSecondFixedSurface"
,
GRIB2_LTYPE_REFERENCE
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"NV"
,
6
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"nlev"
,
zaxisInq
Size
(
zaxisID
)
+
1
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"nlev"
,
zaxisInq
NlevRef
(
zaxisID
)),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"numberOfVGridUsed"
,
number
),
0
);
len
=
16
;
if
(
grib_set_bytes
(
gh
,
"uuidOfVGrid"
,
(
unsigned
char
*
)
zaxisInqUUID
(
zaxisID
,
uuid
),
&
len
)
!=
0
)
...
...
@@ -2911,7 +2911,7 @@ void gribapiDefLevel(int editionNumber, grib_handle *gh, int param, int zaxisID,
number
=
zaxisInqNumber
(
zaxisID
);
gribapiDefLevelType
(
gh
,
gcinit
,
"typeOfFirstFixedSurface"
,
GRIB2_LTYPE_REFERENCE
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"NV"
,
6
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"nlev"
,
zaxisInq
Size
(
zaxisID
)),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"nlev"
,
zaxisInq
NlevRef
(
zaxisID
)),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"numberOfVGridUsed"
,
number
),
0
);
len
=
16
;
if
(
grib_set_bytes
(
gh
,
"uuidOfVGrid"
,
(
unsigned
char
*
)
zaxisInqUUID
(
zaxisID
,
uuid
),
&
len
)
!=
0
)
...
...
src/varscan.c
View file @
875d140e
...
...
@@ -574,6 +574,7 @@ void cdi_generate_vars(stream_t *streamptr)
if
(
zaxisInqType
(
zaxisID
)
==
ZAXIS_REFERENCE
)
{
if
(
numberOfVerticalLevels
>
0
)
zaxisDefNlevRef
(
zaxisID
,
numberOfVerticalLevels
);
if
(
numberOfVerticalGrid
>
0
)
zaxisDefNumber
(
zaxisID
,
numberOfVerticalGrid
);
if
(
uuidVGrid
[
0
]
!=
0
)
zaxisDefUUID
(
zaxisID
,
uuidVGrid
);
}
...
...
@@ -710,9 +711,9 @@ void varDefVCT(size_t vctsize, double *vctptr)
}
void
varDefZAxisReference
(
int
nlev
,
int
nvgrid
,
char
*
uuid
)
void
varDefZAxisReference
(
int
n
h
lev
,
int
nvgrid
,
char
*
uuid
)
{
numberOfVerticalLevels
=
nlev
;
numberOfVerticalLevels
=
n
h
lev
;
numberOfVerticalGrid
=
nvgrid
;
memcpy
(
uuidVGrid
,
uuid
,
16
);
}
...
...
src/zaxis.c
View file @
875d140e
...
...
@@ -79,6 +79,7 @@ typedef struct {
int
vctsize
;
double
*
vct
;
int
number
;
/* Reference number to a generalized Z-axis */
int
nhlev
;
char
uuid
[
17
];
}
zaxis_t
;
...
...
@@ -117,6 +118,7 @@ void zaxisDefaultValue ( zaxis_t *zaxisptr )
zaxisptr
->
vctsize
=
0
;
zaxisptr
->
vct
=
NULL
;
zaxisptr
->
number
=
0
;
zaxisptr
->
nhlev
=
0
;
zaxisptr
->
uuid
[
0
]
=
0
;
}
...
...
@@ -680,6 +682,39 @@ void zaxisDefLevel(int zaxisID, int levelID, double level)
zaxisptr
->
vals
[
levelID
]
=
level
;
}
void
zaxisDefNlevRef
(
int
zaxisID
,
const
int
nhlev
)
{
zaxis_t
*
zaxisptr
;
if
(
reshGetStatus
(
zaxisID
,
&
zaxisOps
)
==
CLOSED
)
{
xwarning
(
"%s"
,
"Operation not executed."
);
return
;
}
zaxisptr
=
(
zaxis_t
*
)
reshGetVal
(
zaxisID
,
&
zaxisOps
);
zaxis_check_ptr
(
zaxisID
,
zaxisptr
);
zaxisptr
->
nhlev
=
nhlev
;
}
int
zaxisInqNlevRef
(
int
zaxisID
)
{
int
nhlev
=
-
1
;
zaxis_t
*
zaxisptr
;
zaxisptr
=
(
zaxis_t
*
)
reshGetVal
(
zaxisID
,
&
zaxisOps
);
zaxis_check_ptr
(
zaxisID
,
zaxisptr
);
nhlev
=
zaxisptr
->
nhlev
;
return
(
nhlev
);
}
/*
@Function zaxisDefNumber
@Title Define the reference number for a generalized Z-axis
...
...
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