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
9c324920
Commit
9c324920
authored
Oct 06, 2011
by
Uwe Schulzweida
Browse files
Added support for level type ZAXIS_TOA, ZAXIS_SEA_BOTTOM, ZAXIS_ATMOSPHERE (netCDF)
parent
6b6cbbb3
Changes
10
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
9c324920
2011-10-06 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* added level type ZAXIS_
NOMINAL_
TO
P
, ZAXIS_SEA_BOTTOM, ZAXIS_ATMOSPHERE [request: Drte Liermann]
* added level type ZAXIS_TO
A
, ZAXIS_SEA_BOTTOM, ZAXIS_ATMOSPHERE [request: Drte Liermann]
2011-10-05 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
...
...
NEWS
View file @
9c324920
...
...
@@ -4,7 +4,7 @@ CDI NEWS
Version 1.5.3 (?? October 2011):
New features:
* Added support for level type ZAXIS_
NOMINAL_
TO
P
, ZAXIS_SEA_BOTTOM, ZAXIS_ATMOSPHERE
* Added support for level type ZAXIS_TO
A
, ZAXIS_SEA_BOTTOM, ZAXIS_ATMOSPHERE
Fixed bugs:
* deflate compression with netCDF4 doesn't work
...
...
src/cdi.h
View file @
9c324920
...
...
@@ -147,7 +147,7 @@ extern "C" {
#define ZAXIS_ALTITUDE 10
/* Altitude above mean sea level in meters */
#define ZAXIS_SIGMA 11
/* Sigma level */
#define ZAXIS_MEANSEA 12
/* Mean sea level */
#define ZAXIS_
NOMINAL_
TO
P
13
/* Norminal top of atmosphere */
#define ZAXIS_TO
A
13
/* Norminal top of atmosphere */
#define ZAXIS_SEA_BOTTOM 14
/* Sea bottom */
#define ZAXIS_ATMOSPHERE 15
/* Entire atmosphere */
...
...
src/cgribex.h
View file @
9c324920
...
...
@@ -8,7 +8,7 @@
/* GRIB1 Level Types */
#define GRIB1_LTYPE_SURFACE 1
#define GRIB1_LTYPE_
NOMINAL_
TO
P
8
#define GRIB1_LTYPE_TO
A
8
#define GRIB1_LTYPE_SEA_BOTTOM 9
#define GRIB1_LTYPE_ATMOSPHERE 10
#define GRIB1_LTYPE_99 99
...
...
src/gribapi.h
View file @
9c324920
...
...
@@ -5,7 +5,7 @@
/* GRIB2 Level Types */
#define GRIB2_LTYPE_SURFACE 1
#define GRIB2_LTYPE_
NOMINAL_
TO
P
8
#define GRIB2_LTYPE_TO
A
8
#define GRIB2_LTYPE_SEA_BOTTOM 9
#define GRIB2_LTYPE_ATMOSPHERE 10
#define GRIB2_LTYPE_ISOBARIC 100
...
...
src/stream_cdf.c
View file @
9c324920
...
...
@@ -2217,8 +2217,11 @@ void cdfDefZaxis(int streamID, int zaxisID)
dimlen
=
zaxisInqSize
(
zaxisID
);
type
=
zaxisInqType
(
zaxisID
);
if
(
dimlen
==
1
&&
type
==
ZAXIS_SURFACE
)
return
;
if
(
dimlen
==
1
&&
type
==
ZAXIS_MEANSEA
)
return
;
if
(
dimlen
==
1
&&
type
==
ZAXIS_SURFACE
)
return
;
if
(
dimlen
==
1
&&
type
==
ZAXIS_TOA
)
return
;
if
(
dimlen
==
1
&&
type
==
ZAXIS_SEA_BOTTOM
)
return
;
if
(
dimlen
==
1
&&
type
==
ZAXIS_ATMOSPHERE
)
return
;
if
(
dimlen
==
1
&&
type
==
ZAXIS_MEANSEA
)
return
;
zaxisInqName
(
zaxisID
,
axisname
);
/*
...
...
@@ -2328,7 +2331,7 @@ void cdfDefZaxis(int streamID, int zaxisID)
cdf_put_att_text
(
fileID
,
ncvarid
,
"formula"
,
strlen
(
tmpname
),
tmpname
);
strcpy
(
tmpname
,
"ap: hyai b: hybi ps: aps"
);
cdf_put_att_text
(
fileID
,
ncvarid
,
"formula_terms"
,
strlen
(
tmpname
),
tmpname
);
cdf_enddef
(
fileID
);
streamptr
->
ncmode
=
2
;
...
...
@@ -2377,8 +2380,8 @@ void cdfDefZaxis(int streamID, int zaxisID)
}
cdf_put_att_text
(
fileID
,
ncvarid
,
"axis"
,
1
,
"Z"
);
if
(
zaxisInqLbounds
(
zaxisID
,
NULL
)
&&
zaxisInqUbounds
(
zaxisID
,
NULL
)
)
if
(
zaxisInqLbounds
(
zaxisID
,
NULL
)
&&
zaxisInqUbounds
(
zaxisID
,
NULL
)
)
{
if
(
nc_inq_dimid
(
fileID
,
"nb2"
,
&
nvdimID
)
!=
NC_NOERR
)
cdf_def_dim
(
fileID
,
"nb2"
,
nvertex
,
&
nvdimID
);
...
...
@@ -2397,7 +2400,7 @@ void cdfDefZaxis(int streamID, int zaxisID)
streamptr
->
ncmode
=
2
;
cdf_put_var_double
(
fileID
,
ncvarid
,
zaxisInqLevelsPtr
(
zaxisID
));
if
(
ncbvarid
!=
UNDEFID
)
{
int
i
;
...
...
@@ -3049,6 +3052,17 @@ int cdfDefVar(int streamID, int varID)
if
(
vlistInqVarMissvalUsed
(
vlistID
,
varID
)
)
cdfDefVarMissval
(
streamID
,
varID
,
vlistInqVarDatatype
(
vlistID
,
varID
),
0
);
if
(
zid
==
-
1
)
{
if
(
zaxisInqType
(
zaxisID
)
==
ZAXIS_TOA
||
zaxisInqType
(
zaxisID
)
==
ZAXIS_SEA_BOTTOM
||
zaxisInqType
(
zaxisID
)
==
ZAXIS_ATMOSPHERE
)
{
zaxisInqName
(
zaxisID
,
varname
);
cdf_put_att_text
(
fileID
,
ncvarid
,
"level_type"
,
strlen
(
varname
),
varname
);
}
}
/* Attributes */
defineAttributes
(
vlistID
,
varID
,
fileID
,
ncvarid
);
...
...
@@ -4385,7 +4399,30 @@ void scanVarAttributes(int fileID, int nvars, ncvar_t *ncvars, ncdim_t *ncdims,
if
(
warn
)
{
warn
=
FALSE
;
Warning
(
"Gridtype %s unsupported!"
,
attstring
);
Warning
(
"Grid type %s unsupported!"
,
attstring
);
}
}
cdfSetVar
(
ncvars
,
ncvarid
,
TRUE
);
}
else
if
(
strcmp
(
attname
,
"level_type"
)
==
0
&&
atttype
==
NC_CHAR
)
{
cdfGetAttText
(
fileID
,
ncvarid
,
attname
,
attstringlen
-
1
,
attstring
);
strtolower
(
attstring
);
if
(
strcmp
(
attstring
,
"toa"
)
==
0
)
ncvars
[
ncvarid
].
zaxistype
=
ZAXIS_TOA
;
else
if
(
strcmp
(
attstring
,
"seabottom"
)
==
0
)
ncvars
[
ncvarid
].
zaxistype
=
ZAXIS_SEA_BOTTOM
;
else
if
(
strcmp
(
attstring
,
"atmosphere"
)
==
0
)
ncvars
[
ncvarid
].
zaxistype
=
ZAXIS_ATMOSPHERE
;
else
{
static
int
warn
=
TRUE
;
if
(
warn
)
{
warn
=
FALSE
;
Warning
(
"Grid type %s unsupported!"
,
attstring
);
}
}
...
...
@@ -5636,7 +5673,11 @@ void define_all_zaxes(stream_t *streamptr, int fileID, int vlistID, ncdim_t *ncd
if
(
zsize
==
1
)
{
zaxisType
=
ZAXIS_SURFACE
;
if
(
ncvars
[
ncvarid
].
zaxistype
!=
UNDEFID
)
zaxisType
=
ncvars
[
ncvarid
].
zaxistype
;
else
zaxisType
=
ZAXIS_SURFACE
;
zvar
[
0
]
=
0
;
/*
if ( zdimid == UNDEFID )
...
...
src/stream_cgribex.c
View file @
9c324920
...
...
@@ -1919,9 +1919,9 @@ void cgribexDefLevel(int *isec1, int *isec2, double *fsec2, int zaxisID, int lev
ISEC1_Level2
=
0
;
break
;
}
case
ZAXIS_
NOMINAL_
TO
P
:
case
ZAXIS_TO
A
:
{
ISEC1_LevelType
=
GRIB1_LTYPE_
NOMINAL_
TO
P
;
ISEC1_LevelType
=
GRIB1_LTYPE_TO
A
;
ISEC1_Level1
=
0
;
ISEC1_Level2
=
0
;
break
;
...
...
src/stream_grb.c
View file @
9c324920
...
...
@@ -23,7 +23,7 @@ int grib1ltypeToZaxisType(int grib_ltype)
switch
(
grib_ltype
)
{
case
GRIB1_LTYPE_SURFACE
:
{
zaxistype
=
ZAXIS_SURFACE
;
break
;
}
case
GRIB1_LTYPE_
NOMINAL_
TO
P
:
{
zaxistype
=
ZAXIS_
NOMINAL_
TO
P
;
break
;
}
case
GRIB1_LTYPE_TO
A
:
{
zaxistype
=
ZAXIS_TO
A
;
break
;
}
case
GRIB1_LTYPE_SEA_BOTTOM
:
{
zaxistype
=
ZAXIS_SEA_BOTTOM
;
break
;
}
case
GRIB1_LTYPE_ATMOSPHERE
:
{
zaxistype
=
ZAXIS_ATMOSPHERE
;
break
;
}
case
GRIB1_LTYPE_MEANSEA
:
{
zaxistype
=
ZAXIS_MEANSEA
;
break
;
}
...
...
@@ -51,7 +51,7 @@ int grib2ltypeToZaxisType(int grib_ltype)
switch
(
grib_ltype
)
{
case
GRIB2_LTYPE_SURFACE
:
{
zaxistype
=
ZAXIS_SURFACE
;
break
;
}
case
GRIB2_LTYPE_
NOMINAL_
TO
P
:
{
zaxistype
=
ZAXIS_
NOMINAL_
TO
P
;
break
;
}
case
GRIB2_LTYPE_TO
A
:
{
zaxistype
=
ZAXIS_TO
A
;
break
;
}
case
GRIB2_LTYPE_SEA_BOTTOM
:
{
zaxistype
=
ZAXIS_SEA_BOTTOM
;
break
;
}
case
GRIB2_LTYPE_ATMOSPHERE
:
{
zaxistype
=
ZAXIS_ATMOSPHERE
;
break
;
}
case
GRIB2_LTYPE_MEANSEA
:
{
zaxistype
=
ZAXIS_MEANSEA
;
break
;
}
...
...
src/stream_gribapi.c
View file @
9c324920
...
...
@@ -2344,12 +2344,12 @@ void gribapiDefLevel(grib_handle *gh, int param, int zaxisID, int levelID)
GRIB_CHECK
(
grib_set_long
(
gh
,
"level"
,
(
long
)
zaxisInqLevel
(
zaxisID
,
levelID
)),
0
);
break
;
}
case
ZAXIS_
NOMINAL_
TO
P
:
case
ZAXIS_TO
A
:
{
if
(
editionNumber
<=
1
)
GRIB_CHECK
(
grib_set_long
(
gh
,
"indicatorOfTypeOfLevel"
,
GRIB1_LTYPE_
NOMINAL_
TO
P
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"indicatorOfTypeOfLevel"
,
GRIB1_LTYPE_TO
A
),
0
);
else
GRIB_CHECK
(
grib_set_long
(
gh
,
"typeOfFirstFixedSurface"
,
GRIB2_LTYPE_
NOMINAL_
TO
P
),
0
);
GRIB_CHECK
(
grib_set_long
(
gh
,
"typeOfFirstFixedSurface"
,
GRIB2_LTYPE_TO
A
),
0
);
break
;
}
case
ZAXIS_SEA_BOTTOM
:
...
...
src/zaxis.c
View file @
9c324920
...
...
@@ -37,7 +37,7 @@ ZaxistypeEntry[] = {
{
/* 10 */
1
,
"alt"
,
"altitude"
,
""
,
"m"
},
{
/* 11 */
0
,
"lev"
,
"sigma"
,
""
,
"level"
},
{
/* 12 */
0
,
"lev"
,
"meansea"
,
""
,
"level"
},
{
/* 13 */
0
,
"toa"
,
"
nominal_top"
,
""
,
""
},
{
/* 13 */
0
,
"toa"
,
"
top_of_atmosphere"
,
""
,
""
},
{
/* 14 */
0
,
"seabottom"
,
"sea_bottom"
,
""
,
""
},
{
/* 15 */
0
,
"atmosphere"
,
"atmosphere"
,
""
,
""
},
};
...
...
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