Skip to content
GitLab
Menu
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
e114b9d4
Commit
e114b9d4
authored
Apr 28, 2011
by
Uwe Schulzweida
Browse files
Added attribute positive on netCDF zaxes
parent
82d66f71
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
e114b9d4
2011-04-28 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* Added standard_name on netCDF zaxes
* Added attribute standard_name on netCDF zaxes [request: Karin Meier-Fleischer]
* Added attribute positive on netCDF zaxes [request: Karin Meier-Fleischer]
2011-04-27 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
...
...
src/cdi.h
View file @
e114b9d4
...
...
@@ -733,6 +733,8 @@ void zaxisInqUnits(int zaxisID, char *units);
void
zaxisDefPrec
(
int
zaxisID
,
int
prec
);
int
zaxisInqPrec
(
int
zaxisID
);
int
zaxisInqPositive
(
int
zaxisID
);
void
zaxisDefLtype
(
int
zaxisID
,
int
ltype
);
int
zaxisInqLtype
(
int
zaxisID
);
...
...
src/stream_cdf.c
View file @
e114b9d4
...
...
@@ -2125,6 +2125,7 @@ void cdfDefZaxis(int streamID, int zaxisID)
int
vlistID
;
int
zaxisindex
;
int
xtype
=
NC_DOUBLE
;
int
positive
;
stream_t
*
streamptr
;
streamptr
=
stream_to_pointer
(
streamID
);
...
...
@@ -2287,6 +2288,18 @@ void cdfDefZaxis(int streamID, int zaxisID)
if
(
(
len
=
strlen
(
stdname
))
)
cdf_put_att_text
(
fileID
,
ncvarid
,
"standard_name"
,
len
,
stdname
);
positive
=
zaxisInqPositive
(
zaxisID
);
if
(
positive
==
1
)
{
strcpy
(
tmpname
,
"up"
);
cdf_put_att_text
(
fileID
,
ncvarid
,
"positive"
,
strlen
(
tmpname
),
tmpname
);
}
else
if
(
positive
==
2
)
{
strcpy
(
tmpname
,
"down"
);
cdf_put_att_text
(
fileID
,
ncvarid
,
"positive"
,
strlen
(
tmpname
),
tmpname
);
}
cdf_put_att_text
(
fileID
,
ncvarid
,
"axis"
,
1
,
"Z"
);
if
(
zaxisInqLbounds
(
zaxisID
,
NULL
)
&&
zaxisInqUbounds
(
zaxisID
,
NULL
)
)
...
...
src/zaxis.c
View file @
e114b9d4
...
...
@@ -12,8 +12,8 @@
#include
"stream_int.h"
#define LevelDown 0
#define LevelUp 1
#define LevelDown 2
static
struct
{
...
...
@@ -195,6 +195,7 @@ void zaxis_init_entry(zaxis_t *zaxisptr)
zaxisptr
->
name
[
0
]
=
0
;
zaxisptr
->
longname
[
0
]
=
0
;
zaxisptr
->
stdname
[
0
]
=
0
;
zaxisptr
->
units
[
0
]
=
0
;
zaxisptr
->
vals
=
NULL
;
zaxisptr
->
ubounds
=
NULL
;
...
...
@@ -202,7 +203,8 @@ void zaxis_init_entry(zaxis_t *zaxisptr)
zaxisptr
->
weights
=
NULL
;
zaxisptr
->
type
=
CDI_UNDEFID
;
zaxisptr
->
ltype
=
0
;
zaxisptr
->
direction
=
CDI_UNDEFID
;
zaxisptr
->
positive
=
0
;
zaxisptr
->
direction
=
0
;
zaxisptr
->
prec
=
0
;
zaxisptr
->
size
=
0
;
zaxisptr
->
vctsize
=
0
;
...
...
@@ -369,6 +371,8 @@ int zaxisCreate(int zaxistype, int size)
if
(
*
ZaxistypeEntry
[
zaxistype
].
stdname
)
strcpy
(
zaxisptr
->
stdname
,
ZaxistypeEntry
[
zaxistype
].
stdname
);
zaxisptr
->
positive
=
ZaxistypeEntry
[
zaxistype
].
positive
;
vals
=
(
double
*
)
malloc
(
size
*
sizeof
(
double
));
for
(
ilev
=
0
;
ilev
<
size
;
ilev
++
)
...
...
@@ -620,6 +624,18 @@ int zaxisInqPrec(int zaxisID)
}
int
zaxisInqPositive
(
int
zaxisID
)
{
zaxis_t
*
zaxisptr
;
zaxisptr
=
zaxis_to_pointer
(
zaxisID
);
zaxis_check_ptr
(
zaxisID
,
zaxisptr
);
return
(
zaxisptr
->
positive
);
}
void
zaxisDefLtype
(
int
zaxisID
,
int
ltype
)
{
zaxis_t
*
zaxisptr
;
...
...
@@ -978,7 +994,7 @@ void cdiCheckZaxis(int zaxisID)
if
(
size
>
1
)
{
/* check direction */
if
(
zaxisptr
->
direction
==
CDI_UNDEFID
)
if
(
!
zaxisptr
->
direction
)
{
found
=
0
;
for
(
i
=
1
;
i
<
size
;
i
++
)
...
...
@@ -1001,9 +1017,9 @@ void cdiCheckZaxis(int zaxisID)
}
}
/* check consistent */
if
(
zaxisptr
->
direction
==
CDI_UNDEFID
)
if
(
!
zaxisptr
->
direction
)
{
Warning
(
"
d
irection undefined for zaxisID %d"
,
zaxisID
);
Warning
(
"
D
irection undefined for zaxisID %d"
,
zaxisID
);
}
}
}
...
...
Write
Preview
Supports
Markdown
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