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
db45f592
Commit
db45f592
authored
Apr 25, 2008
by
Uwe Schulzweida
Browse files
cdfInqContents: skip time variable with type = NC_CHAR
parent
ef7bff78
Changes
5
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
db45f592
2008-08-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* add support for netCDF4 classic with deflate option
* streamClose: use taxisDestroy to release memory
* cdfInqContents: skip time variable with type = NC_CHAR
* ptaxisCopy: don't overwrite item 'self' (bug fix)
* Version 1.2.0 released
2008-04-08 Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
...
...
src/stream.c
View file @
db45f592
...
...
@@ -128,7 +128,7 @@ static int getFiletype(const char *filename, int *byteorder)
if
(
version
<=
1
)
{
filetype
=
FILETYPE_GRB
;
if
(
CDI_Debug
)
Message
(
func
,
"found GRIB file = %s, version %d"
,
filename
);
if
(
CDI_Debug
)
Message
(
func
,
"found GRIB file = %s, version %d"
,
filename
,
version
);
}
}
else
if
(
strncmp
(
buffer
,
"CDF
\001
"
,
4
)
==
0
)
...
...
@@ -1184,6 +1184,11 @@ void streamClose(int streamID)
stream_delete_entry
(
streamptr
);
if
(
vlistInqTaxis
(
vlistID
)
!=
-
1
)
{
taxisDestroy
(
vlistInqTaxis
(
vlistID
));
}
if
(
vlistID
!=
-
1
)
{
vlistDestroy
(
vlistID
);
...
...
src/stream_cdf.c
View file @
db45f592
...
...
@@ -50,7 +50,6 @@ NCDIM;
typedef
struct
{
int
ignore
;
int
vartype
;
int
isvar
;
int
islon
;
int
islat
;
...
...
@@ -3368,7 +3367,6 @@ int cdfInqContents(int streamID)
for
(
ncvarid
=
0
;
ncvarid
<
nvars
;
ncvarid
++
)
{
ncvars
[
ncvarid
].
ignore
=
FALSE
;
ncvars
[
ncvarid
].
vartype
=
UNDEFID
;
ncvars
[
ncvarid
].
isvar
=
UNDEFID
;
ncvars
[
ncvarid
].
islon
=
FALSE
;
ncvars
[
ncvarid
].
islat
=
FALSE
;
...
...
@@ -3932,7 +3930,9 @@ int cdfInqContents(int streamID)
else
{
for
(
ncvarid
=
0
;
ncvarid
<
nvars
;
ncvarid
++
)
if
(
ncvars
[
ncvarid
].
ndims
==
1
&&
timedimid
==
ncvars
[
ncvarid
].
dimids
[
0
]
)
if
(
ncvars
[
ncvarid
].
ndims
==
1
&&
timedimid
==
ncvars
[
ncvarid
].
dimids
[
0
]
&&
ncvars
[
ncvarid
].
xtype
!=
NC_CHAR
)
{
streamptr
->
basetime
.
ncvarid
=
ncvarid
;
break
;
...
...
src/taxis.c
View file @
db45f592
...
...
@@ -175,7 +175,7 @@ static int taxis_from_pointer(TAXIS *ptr)
if
(
_taxisAvail
)
{
newptr
=
_taxisAvail
;
_taxisAvail
=
_taxisAvail
->
next
;
_taxisAvail
=
_taxisAvail
->
next
;
newptr
->
next
=
0
;
idx
=
newptr
->
idx
;
newptr
->
ptr
=
ptr
;
...
...
@@ -232,6 +232,8 @@ static TAXIS *taxis_new_entry(void)
if
(
taxisptr
)
taxis_init_entry
(
taxisptr
);
/* fprintf(stderr, "self: %d %p\n", taxisptr->self, taxisptr); */
return
(
taxisptr
);
}
...
...
@@ -370,6 +372,14 @@ int taxisCreate(int taxistype)
*/
void
taxisDestroy
(
int
taxisID
)
{
static
char
func
[]
=
"taxisDestroy"
;
TAXIS
*
taxisptr
;
taxisptr
=
taxis_to_pointer
(
taxisID
);
taxis_check_ptr
(
func
,
taxisptr
);
taxis_delete_entry
(
taxisptr
);
}
...
...
@@ -1113,5 +1123,19 @@ void ptaxisInit(TAXIS *taxisptr)
void
ptaxisCopy
(
TAXIS
*
dest
,
TAXIS
*
source
)
{
memcpy
(
dest
,
source
,
sizeof
(
TAXIS
));
/* memcpy(dest, source, sizeof(TAXIS)); */
dest
->
used
=
source
->
used
;
dest
->
type
=
source
->
type
;
dest
->
vdate
=
source
->
vdate
;
dest
->
vtime
=
source
->
vtime
;
dest
->
rdate
=
source
->
rdate
;
dest
->
rtime
=
source
->
rtime
;
dest
->
calendar
=
source
->
calendar
;
dest
->
unit
=
source
->
unit
;
dest
->
numavg
=
source
->
numavg
;
dest
->
has_bounds
=
source
->
has_bounds
;
dest
->
vdate_lb
=
source
->
vdate_lb
;
dest
->
vtime_lb
=
source
->
vtime_lb
;
dest
->
vdate_ub
=
source
->
vdate_ub
;
dest
->
vtime_ub
=
source
->
vtime_ub
;
}
src/zaxis.c
View file @
db45f592
...
...
@@ -24,8 +24,8 @@ ZaxistypeEntry[] = {
{
"lev"
,
"hybrid_half"
,
"level"
},
{
"lev"
,
"pressure"
,
"Pa"
},
{
"height"
,
"height"
,
"m"
},
{
"depth"
,
"depth
below
sea"
,
"m"
},
{
"depth"
,
"depth
below
land"
,
"cm"
},
{
"depth"
,
"depth
_
below
_
sea"
,
"m"
},
{
"depth"
,
"depth
_
below
_
land"
,
"cm"
},
{
"lev"
,
"isentropic"
,
"K"
},
{
"lev"
,
"trajectory"
,
""
},
{
"alt"
,
"altitude"
,
"m"
},
...
...
@@ -730,8 +730,9 @@ double zaxisInqLbound(int zaxisID, int index)
zaxis_check_ptr
(
func
,
zaxisptr
);
if
(
index
>=
0
&&
index
<
zaxisptr
->
size
)
level
=
zaxisptr
->
lbounds
[
index
];
if
(
zaxisptr
->
lbounds
)
if
(
index
>=
0
&&
index
<
zaxisptr
->
size
)
level
=
zaxisptr
->
lbounds
[
index
];
return
(
level
);
}
...
...
@@ -747,8 +748,9 @@ double zaxisInqUbound(int zaxisID, int index)
zaxis_check_ptr
(
func
,
zaxisptr
);
if
(
index
>=
0
&&
index
<
zaxisptr
->
size
)
level
=
zaxisptr
->
ubounds
[
index
];
if
(
zaxisptr
->
ubounds
)
if
(
index
>=
0
&&
index
<
zaxisptr
->
size
)
level
=
zaxisptr
->
ubounds
[
index
];
return
(
level
);
}
...
...
@@ -1062,11 +1064,14 @@ void zaxisDefLbounds(int zaxisID, double *lbounds)
zaxis_check_ptr
(
func
,
zaxisptr
);
size
=
zaxisptr
->
size
;
if
(
CDI_Debug
)
if
(
zaxisptr
->
lbounds
!=
NULL
)
Warning
(
func
,
"Lower bounds already defined for zaxisID = %d"
,
zaxisID
);
if
(
zaxisptr
->
lbounds
!
=
NULL
)
Warning
(
func
,
"Lbounds already defined for zaxisID = %d"
,
zaxisID
);
if
(
zaxisptr
->
lbounds
=
=
NULL
)
zaxisptr
->
lbounds
=
(
double
*
)
malloc
(
size
*
sizeof
(
double
)
);
zaxisptr
->
lbounds
=
(
double
*
)
malloc
(
size
*
sizeof
(
double
));
memcpy
(
zaxisptr
->
lbounds
,
lbounds
,
size
*
sizeof
(
double
));
}
...
...
@@ -1083,10 +1088,13 @@ void zaxisDefUbounds(int zaxisID, double *ubounds)
size
=
zaxisptr
->
size
;
if
(
zaxisptr
->
ubounds
!=
NULL
)
Warning
(
func
,
"Ubounds already defined for zaxisID = %d"
,
zaxisID
);
if
(
CDI_Debug
)
if
(
zaxisptr
->
ubounds
!=
NULL
)
Warning
(
func
,
"Upper bounds already defined for zaxisID = %d"
,
zaxisID
);
if
(
zaxisptr
->
ubounds
==
NULL
)
zaxisptr
->
ubounds
=
(
double
*
)
malloc
(
size
*
sizeof
(
double
));
zaxisptr
->
ubounds
=
(
double
*
)
malloc
(
size
*
sizeof
(
double
));
memcpy
(
zaxisptr
->
ubounds
,
ubounds
,
size
*
sizeof
(
double
));
}
...
...
@@ -1103,10 +1111,13 @@ void zaxisDefWeights(int zaxisID, double *weights)
size
=
zaxisptr
->
size
;
if
(
zaxisptr
->
weights
!=
NULL
)
Warning
(
func
,
"Weights already defined for zaxisID = %d"
,
zaxisID
);
if
(
CDI_Debug
)
if
(
zaxisptr
->
weights
!=
NULL
)
Warning
(
func
,
"Weights already defined for zaxisID = %d"
,
zaxisID
);
if
(
zaxisptr
->
weights
==
NULL
)
zaxisptr
->
weights
=
(
double
*
)
malloc
(
size
*
sizeof
(
double
));
zaxisptr
->
weights
=
(
double
*
)
malloc
(
size
*
sizeof
(
double
));
memcpy
(
zaxisptr
->
weights
,
weights
,
size
*
sizeof
(
double
));
}
...
...
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