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
51bfa7a1
Commit
51bfa7a1
authored
Mar 09, 2008
by
Uwe Schulzweida
Browse files
cdfInqContents: bug fix for gridtype cell
parent
b8d65cf5
Changes
4
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
51bfa7a1
2008-04-?? Uwe Schulzweida <Uwe.Schulzweida@zmaw.de>
* cdfInqContents: bug fix for gridtype cell
* cdfInqContents: bug fix for inconsistent curvilinear grid [report: Holger Goettel]
* cdfInqContents: bug fix for unsupported grids (dims > 2) [report: Wolfgang Langhans]
* cdfInqContents: check type of _FillValue
...
...
src/griblib.c
View file @
51bfa7a1
/* Generated automatically from m214003 on
Thu Jan 24 16:14:22
CET 2008 */
/* Generated automatically from m214003 on
Sun Mar 9 10:42:35
CET 2008 */
/* GRIBLIB_VERSION="1.1.
0
" */
/* GRIBLIB_VERSION="1.1.
1
" */
#if defined (HAVE_CONFIG_H)
# include "config.h"
...
...
@@ -4289,7 +4289,8 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
int
locnd
;
int
jlend
,
jlenc
;
int
i
;
int
iflag
,
irep
,
lnil
,
jscale
,
imiss
;
int
bds_flag
,
bds_rep
,
jscale
,
imiss
;
int
bds_ubits
;
int
ioff
;
int
iexp
,
imant
;
int
pcStart
,
pcScale
;
...
...
@@ -4311,22 +4312,22 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
/* 4 bit flag / 4 bit count of unused bits at end of block octet. */
i
flag
=
BDS_Flag
;
bds_
flag
=
BDS_Flag
;
bds_aflag
=
(
i
flag
>>
4
)
&
1
;
/* compress */
bds_aflag
=
(
bds_
flag
>>
4
)
&
1
;
/* compress */
/* 0------- grid point */
/* 1------- spherical harmonics */
i
rep
=
i
flag
>>
7
;
bds_
rep
=
bds_
flag
>>
7
;
if
(
i
rep
==
0
)
isec4
[
2
]
=
0
;
if
(
bds_
rep
==
0
)
isec4
[
2
]
=
0
;
else
isec4
[
2
]
=
128
;
/* -0------ simple packing */
/* -1------ complex packing */
cplx
=
(
i
flag
>>
6
)
&
1
;
cplx
=
(
bds_
flag
>>
6
)
&
1
;
if
(
cplx
>
0
)
isec4
[
3
]
=
64
;
else
isec4
[
3
]
=
0
;
...
...
@@ -4334,7 +4335,7 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
/* ---0---- No additional flags */
/* ---1---- No additional flags */
if
(
(
i
flag
>>
4
)
&
1
)
if
(
(
bds_
flag
>>
4
)
&
1
)
{
isec4
[
5
]
=
16
;
isec4
[
6
]
=
BDS_Z
;
zoff
=
12
;
}
else
{
isec4
[
5
]
=
0
;
isec4
[
6
]
=
0
;
zoff
=
0
;
}
...
...
@@ -4344,7 +4345,8 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
/* ----++++ number of unused bits at end of section) */
lnil
=
iflag
&
15
;
bds_ubits
=
bds_flag
&
15
;
printf
(
"bds_ubits %d
\n
"
,
bds_ubits
);
/* scale factor (2 bytes) */
;
...
...
@@ -4381,7 +4383,7 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
/* if data is in spherical harmonic form, distinguish */
/* between simple/complex packing (cplx = 0/1) */
if
(
i
rep
==
1
&&
cplx
==
0
)
if
(
bds_
rep
==
1
&&
cplx
==
0
)
{
/* no unpacked binary data present */
...
...
@@ -4402,9 +4404,9 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
}
}
ioff
=
i
rep
;
ioff
=
bds_
rep
;
if
(
i
rep
==
1
&&
cplx
==
1
)
if
(
bds_
rep
==
1
&&
cplx
==
1
)
{
/* scaling factor */
isec4
[
16
]
=
BDS_Power
;
...
...
@@ -4440,7 +4442,7 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
ioff
=
(
jup
+
1
)
*
(
jup
+
2
);
}
/*
d
ecode data values to floating point and store in fsec4. */
/*
D
ecode data values to floating point and store in fsec4. */
/* first calculate the number of data values. */
/* Take into account that spherical harmonics can be packed */
/* simple (cplx = 0) or complex (cplx = 1) */
...
...
@@ -4454,7 +4456,7 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
jlend
=
ISEC2_NumLon
*
ISEC2_NumLat
;
}
else
jlend
=
(
jlend
*
8
-
lnil
)
/
ISEC4_NumBits
;
jlend
=
(
jlend
*
8
-
bds_ubits
)
/
ISEC4_NumBits
;
ISEC4_NumValues
=
jlend
+
ioff
;
...
...
@@ -4463,14 +4465,14 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
if
(
bds_aflag
)
{
/*
if (
i
rep == 0 )
if (
bds_
rep == 0 )
ISEC4_NumValues = ISEC2_NumLon*ISEC2_NumLat;
else
ISEC4_NumValues = (ISEC2_PentaJ+1)*(ISEC2_PentaJ+2);
*/
ISEC4_NumValues
=
GET_UINT3
(
bds
[
17
],
bds
[
18
],
bds
[
19
])
*
8
/
ISEC4_NumBits
;
if
(
i
rep
==
1
)
ISEC4_NumValues
++
;
if
(
bds_
rep
==
1
)
ISEC4_NumValues
++
;
}
if
(
dfunc
==
'J'
)
return
(
bdsLen
);
...
...
@@ -4570,7 +4572,7 @@ static int decodeBDS(int decscale, unsigned char *bds, int *isec2, int *isec4, d
if
(
lgrib
)
free
(
lgrib
);
if
(
i
rep
==
1
&&
cplx
==
1
)
if
(
bds_
rep
==
1
&&
cplx
==
1
)
{
pcStart
=
isec4
[
19
];
pcScale
=
isec4
[
16
];
...
...
@@ -7641,7 +7643,7 @@ int gribBzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbuf
char
*
dest
,
*
source
;
int
destLen
,
sourceLen
;
int
bds_len
,
bds_nbits
,
bds_flag
,
bds_rep
,
bds_cplx
,
bds_aflag
;
int
lnil
;
int
bds_ubits
;
char
tmpbuffer
[
1000000
];
char
tmpbuffer2
[
1000000
];
...
...
@@ -7785,8 +7787,8 @@ int gribBzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbuf
/* ----++++ number of unused bits at end of section) */
lnil
=
bds_flag
&
15
;
BDS_Flag
-=
lnil
;
bds_ubits
=
bds_flag
&
15
;
BDS_Flag
-=
bds_ubits
;
gribLenOld
=
((
int
)
((
dbuf
[
4
]
<<
16
)
+
(
dbuf
[
5
]
<<
8
)
+
dbuf
[
6
]));
...
...
@@ -7906,12 +7908,12 @@ int gribZip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufs
SZ_com_t
sz_param
;
/* szip parameter block */
unsigned
char
*
dest
,
*
source
;
size_t
destLen
,
sourceLen
;
int
bds_len
,
bds_nbits
,
bds_flag
,
bds_rep
,
bds_cplx
,
bds_aflag
;
int
lnil
;
int
bds_len
,
bds_nbits
,
bds_flag
,
bds_rep
,
bds_cplx
,
bds_aflag
,
bds_ubits
;
bds_len
=
BDS_Len
;
bds_nbits
=
BDS_NumBits
;
bds_flag
=
BDS_Flag
;
bds_ubits
=
bds_flag
&
15
;
bds_rep
=
bds_flag
>>
7
;
bds_cplx
=
(
bds_flag
>>
6
)
&
1
;
bds_aflag
=
(
bds_flag
>>
4
)
&
1
;
...
...
@@ -7952,11 +7954,11 @@ int gribZip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufs
}
else
{
fprintf
(
stderr
,
"
c
ompression of complex packed spectral data unsupported!
\n
"
);
fprintf
(
stderr
,
"
C
ompression of complex packed spectral data unsupported!
\n
"
);
return
(
rec_len
);
}
datsize
=
((((
bds_len
-
datstart
)
*
8
)
/
bds_nbits
)
*
bds_nbits
)
/
8
;
datsize
=
((((
bds_len
-
datstart
)
*
8
-
bds_ubits
)
/
bds_nbits
)
*
bds_nbits
)
/
8
;
if
(
datsize
<
MIN_SIZE
)
return
(
rec_len
);
/*
...
...
@@ -8052,10 +8054,6 @@ int gribZip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufs
/*
fprintf(stderr, "sourceLen, destLen %d %d\n", sourceLen, destLen);
*/
/*
fprintf(stderr, "s>>> %d %d %d %d <<<\n", (int) source[0], (int)source[1], (int)source[2], (int)source[3]);
fprintf(stderr, "d>>> %d %d %d %d <<<\n", (int) dest[0], (int)dest[1], (int)dest[2], (int)dest[3]);
*/
if
(
destLen
<
MIN_COMPRESS
*
sourceLen
)
{
...
...
@@ -8082,8 +8080,7 @@ int gribZip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbufs
/* ----++++ number of unused bits at end of section) */
lnil
=
bds_flag
&
15
;
BDS_Flag
-=
lnil
;
BDS_Flag
-=
bds_ubits
;
gribLenOld
=
((
int
)
((
dbuf
[
4
]
<<
16
)
+
(
dbuf
[
5
]
<<
8
)
+
dbuf
[
6
]));
...
...
@@ -8232,7 +8229,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
{
int
status
;
size_t
tmpLen
;
int
lnil
;
int
bds_ubits
;
SZ_com_t
sz_param
;
/* szip parameter block */
sz_param
.
options_mask
=
OPTIONS_MASK
;
...
...
@@ -8295,8 +8292,8 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
free
(
pbuf
);
}
lnil
=
BDS_Flag
&
15
;
BDS_Flag
-=
lnil
;
bds_ubits
=
BDS_Flag
&
15
;
BDS_Flag
-=
bds_ubits
;
if
(
(
bdsLen
%
2
)
==
1
)
{
...
...
@@ -8336,12 +8333,7 @@ int gribUnzip(unsigned char *dbuf, long dbufsize, unsigned char *sbuf, long sbu
return
(
gribLen
);
}
static
const
char
grb_libvers
[]
=
"1.1.0"
" of ""Jan 24 2008"" ""16:14:23"
;
static
const
char
grb_libvers
[]
=
"1.1.1"
" of ""Mar 9 2008"" ""10:42:36"
;
const
char
*
gribLibraryVersion
(
void
)
{
...
...
src/grid.c
View file @
51bfa7a1
...
...
@@ -1501,13 +1501,13 @@ int gridInqXvals(int gridID, double *xvals)
grid_check_ptr
(
func
,
gridptr
);
if
(
gridptr
->
type
==
GRID_CURVILINEAR
)
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_CELL
)
size
=
gridptr
->
size
;
else
size
=
gridptr
->
xsize
;
if
(
CDI_Debug
&&
size
==
0
)
Warning
(
func
,
"
s
ize undefined for gridID = %d"
,
gridID
);
Warning
(
func
,
"
S
ize undefined for gridID = %d"
,
gridID
);
if
(
xvals
&&
gridptr
->
xvals
)
for
(
i
=
0
;
i
<
size
;
i
++
)
...
...
@@ -1553,7 +1553,7 @@ void gridDefXvals(int gridID, double *xvals)
size
=
gridptr
->
xsize
;
if
(
size
==
0
)
Error
(
func
,
"
s
ize undefined for gridID = %d"
,
gridID
);
Error
(
func
,
"
S
ize undefined for gridID = %d"
,
gridID
);
if
(
gridptr
->
xvals
==
NULL
)
gridptr
->
xvals
=
(
double
*
)
malloc
(
size
*
sizeof
(
double
));
...
...
@@ -1595,7 +1595,7 @@ int gridInqYvals(int gridID, double *yvals)
grid_check_ptr
(
func
,
gridptr
);
if
(
gridptr
->
type
==
GRID_CURVILINEAR
)
if
(
gridptr
->
type
==
GRID_CURVILINEAR
||
gridptr
->
type
==
GRID_CELL
)
size
=
gridptr
->
size
;
else
size
=
gridptr
->
ysize
;
...
...
src/stream_cdf.c
View file @
51bfa7a1
...
...
@@ -69,7 +69,8 @@ typedef struct {
int
yvarid
;
int
zvarid
;
int
tvarid
;
int
varids
[
4
];
int
ncoordvars
;
int
coordvarids
[
4
];
int
cellarea
;
int
calendar
;
int
tableID
;
...
...
@@ -3142,15 +3143,13 @@ void printNCvars(NCVAR *ncvars, int nvars)
axis
[
ndim
++
]
=
'v'
;
for
(
i
=
0
;
i
<
ncvars
[
ncvarid
].
ndims
;
i
++
)
{
if
(
ncvars
[
ncvarid
].
tvarid
!=
-
1
)
axis
[
ndim
++
]
=
iaxis
[
0
];
else
if
(
ncvars
[
ncvarid
].
zvarid
!=
-
1
)
axis
[
ndim
++
]
=
iaxis
[
1
];
else
if
(
ncvars
[
ncvarid
].
yvarid
!=
-
1
)
axis
[
ndim
++
]
=
iaxis
[
2
];
else
if
(
ncvars
[
ncvarid
].
xvarid
!=
-
1
)
axis
[
ndim
++
]
=
iaxis
[
3
];
/*
if ( ncvars[ncvarid].tvarid != -1 ) axis[ndim++] = iaxis[0];
else if ( ncvars[ncvarid].zvarid != -1 ) axis[ndim++] = iaxis[1];
else if ( ncvars[ncvarid].yvarid != -1 ) axis[ndim++] = iaxis[2];
else if ( ncvars[ncvarid].xvarid != -1 ) axis[ndim++] = iaxis[3];
else
*/
axis
[
ndim
++
]
=
'?'
;
}
}
...
...
@@ -3169,7 +3168,7 @@ void printNCvars(NCVAR *ncvars, int nvars)
axis
[
ndim
++
]
=
0
;
printf
(
"%3d %3d %3d %s %s
\n
"
,
ncvarid
,
ncvars
[
ncvarid
].
isvar
,
ndim
-
2
,
axis
,
ncvars
[
ncvarid
].
name
);
printf
(
"%3d %3d %3d %
-4
s %s
\n
"
,
ncvarid
,
ncvars
[
ncvarid
].
isvar
,
ndim
-
2
,
axis
,
ncvars
[
ncvarid
].
name
);
}
}
...
...
@@ -3264,50 +3263,51 @@ int cdfInqContents(int streamID)
/* init ncvars */
for
(
ncvarid
=
0
;
ncvarid
<
nvars
;
ncvarid
++
)
{
ncvars
[
ncvarid
].
vartype
=
UNDEFID
;
ncvars
[
ncvarid
].
isvar
=
UNDEFID
;
ncvars
[
ncvarid
].
islon
=
FALSE
;
ncvars
[
ncvarid
].
islat
=
FALSE
;
ncvars
[
ncvarid
].
islev
=
FALSE
;
ncvars
[
ncvarid
].
warn
=
FALSE
;
ncvars
[
ncvarid
].
timeID
=
TIME_CONSTANT
;
ncvars
[
ncvarid
].
code
=
UNDEFID
;
ncvars
[
ncvarid
].
calendar
=
FALSE
;
ncvars
[
ncvarid
].
bounds
=
UNDEFID
;
ncvars
[
ncvarid
].
gridID
=
UNDEFID
;
ncvars
[
ncvarid
].
zaxisID
=
UNDEFID
;
ncvars
[
ncvarid
].
gridtype
=
UNDEFID
;
ncvars
[
ncvarid
].
zaxistype
=
UNDEFID
;
ncvars
[
ncvarid
].
xdim
=
UNDEFID
;
ncvars
[
ncvarid
].
ydim
=
UNDEFID
;
ncvars
[
ncvarid
].
zdim
=
UNDEFID
;
ncvars
[
ncvarid
].
xvarid
=
UNDEFID
;
ncvars
[
ncvarid
].
yvarid
=
UNDEFID
;
ncvars
[
ncvarid
].
zvarid
=
UNDEFID
;
ncvars
[
ncvarid
].
tvarid
=
UNDEFID
;
ncvars
[
ncvarid
].
varids
[
0
]
=
UNDEFID
;
ncvars
[
ncvarid
].
varids
[
1
]
=
UNDEFID
;
ncvars
[
ncvarid
].
varids
[
2
]
=
UNDEFID
;
ncvars
[
ncvarid
].
varids
[
3
]
=
UNDEFID
;
ncvars
[
ncvarid
].
cellarea
=
UNDEFID
;
ncvars
[
ncvarid
].
tableID
=
UNDEFID
;
ncvars
[
ncvarid
].
xtype
=
0
;
ncvars
[
ncvarid
].
ndims
=
0
;
ncvars
[
ncvarid
].
gmapid
=
UNDEFID
;
ncvars
[
ncvarid
].
vlen
=
0
;
ncvars
[
ncvarid
].
vdata
=
NULL
;
ncvars
[
ncvarid
].
truncation
=
0
;
ncvars
[
ncvarid
].
positive
=
0
;
ncvars
[
ncvarid
].
defmiss
=
0
;
ncvars
[
ncvarid
].
missval
=
0
;
ncvars
[
ncvarid
].
addoffset
=
0
;
ncvars
[
ncvarid
].
scalefactor
=
1
;
ncvars
[
ncvarid
].
name
[
0
]
=
0
;
ncvars
[
ncvarid
].
longname
[
0
]
=
0
;
ncvars
[
ncvarid
].
stdname
[
0
]
=
0
;
ncvars
[
ncvarid
].
units
[
0
]
=
0
;
ncvars
[
ncvarid
].
natts
=
0
;
ncvars
[
ncvarid
].
atts
=
NULL
;
ncvars
[
ncvarid
].
vartype
=
UNDEFID
;
ncvars
[
ncvarid
].
isvar
=
UNDEFID
;
ncvars
[
ncvarid
].
islon
=
FALSE
;
ncvars
[
ncvarid
].
islat
=
FALSE
;
ncvars
[
ncvarid
].
islev
=
FALSE
;
ncvars
[
ncvarid
].
warn
=
FALSE
;
ncvars
[
ncvarid
].
timeID
=
TIME_CONSTANT
;
ncvars
[
ncvarid
].
code
=
UNDEFID
;
ncvars
[
ncvarid
].
calendar
=
FALSE
;
ncvars
[
ncvarid
].
bounds
=
UNDEFID
;
ncvars
[
ncvarid
].
gridID
=
UNDEFID
;
ncvars
[
ncvarid
].
zaxisID
=
UNDEFID
;
ncvars
[
ncvarid
].
gridtype
=
UNDEFID
;
ncvars
[
ncvarid
].
zaxistype
=
UNDEFID
;
ncvars
[
ncvarid
].
xdim
=
UNDEFID
;
ncvars
[
ncvarid
].
ydim
=
UNDEFID
;
ncvars
[
ncvarid
].
zdim
=
UNDEFID
;
ncvars
[
ncvarid
].
xvarid
=
UNDEFID
;
ncvars
[
ncvarid
].
yvarid
=
UNDEFID
;
ncvars
[
ncvarid
].
zvarid
=
UNDEFID
;
ncvars
[
ncvarid
].
tvarid
=
UNDEFID
;
ncvars
[
ncvarid
].
ncoordvars
=
0
;
ncvars
[
ncvarid
].
coordvarids
[
0
]
=
UNDEFID
;
ncvars
[
ncvarid
].
coordvarids
[
1
]
=
UNDEFID
;
ncvars
[
ncvarid
].
coordvarids
[
2
]
=
UNDEFID
;
ncvars
[
ncvarid
].
coordvarids
[
3
]
=
UNDEFID
;
ncvars
[
ncvarid
].
cellarea
=
UNDEFID
;
ncvars
[
ncvarid
].
tableID
=
UNDEFID
;
ncvars
[
ncvarid
].
xtype
=
0
;
ncvars
[
ncvarid
].
ndims
=
0
;
ncvars
[
ncvarid
].
gmapid
=
UNDEFID
;
ncvars
[
ncvarid
].
vlen
=
0
;
ncvars
[
ncvarid
].
vdata
=
NULL
;
ncvars
[
ncvarid
].
truncation
=
0
;
ncvars
[
ncvarid
].
positive
=
0
;
ncvars
[
ncvarid
].
defmiss
=
0
;
ncvars
[
ncvarid
].
missval
=
0
;
ncvars
[
ncvarid
].
addoffset
=
0
;
ncvars
[
ncvarid
].
scalefactor
=
1
;
ncvars
[
ncvarid
].
name
[
0
]
=
0
;
ncvars
[
ncvarid
].
longname
[
0
]
=
0
;
ncvars
[
ncvarid
].
stdname
[
0
]
=
0
;
ncvars
[
ncvarid
].
units
[
0
]
=
0
;
ncvars
[
ncvarid
].
natts
=
0
;
ncvars
[
ncvarid
].
atts
=
NULL
;
}
/* read global attributtes*/
...
...
@@ -3637,7 +3637,10 @@ int cdfInqContents(int streamID)
{
cdfSetVar
(
ncvars
,
dimvarid
,
FALSE
);
if
(
cdiIgnoreAttCoordinates
==
FALSE
)
ncvars
[
ncvarid
].
varids
[
i
]
=
dimvarid
;
{
ncvars
[
ncvarid
].
coordvarids
[
i
]
=
dimvarid
;
ncvars
[
ncvarid
].
ncoordvars
++
;
}
}
else
Warning
(
func
,
"%s - %s"
,
nc_strerror
(
status
),
varname
);
...
...
@@ -3774,7 +3777,7 @@ int cdfInqContents(int streamID)
}
}
/*
printNCvars(ncvars, nvars);
*/
if
(
CDI_Debug
)
printNCvars
(
ncvars
,
nvars
);
/* find coordinate vars */
for
(
ncdimid
=
0
;
ncdimid
<
ndims
;
ncdimid
++
)
...
...
@@ -4067,7 +4070,7 @@ int cdfInqContents(int streamID)
}
}
/*
printNCvars(ncvars, nvars);
*/
if
(
CDI_Debug
)
printNCvars
(
ncvars
,
nvars
);
/*
for ( ncdimid = 0; ncdimid < ndims; ncdimid++ )
...
...
@@ -4104,14 +4107,10 @@ int cdfInqContents(int streamID)
for
(
i
=
0
;
i
<
ndims
;
i
++
)
{
ncdimid
=
ncvars
[
ncvarid
].
dimids
[
i
];
if
(
ncdims
[
ncdimid
].
dimtype
==
X_AXIS
)
cdfSetDim
(
ncvars
,
ncvarid
,
i
,
X_AXIS
);
else
if
(
ncdims
[
ncdimid
].
dimtype
==
Y_AXIS
)
cdfSetDim
(
ncvars
,
ncvarid
,
i
,
Y_AXIS
);
else
if
(
ncdims
[
ncdimid
].
dimtype
==
Z_AXIS
)
cdfSetDim
(
ncvars
,
ncvarid
,
i
,
Z_AXIS
);
else
if
(
ncdims
[
ncdimid
].
dimtype
==
T_AXIS
)
cdfSetDim
(
ncvars
,
ncvarid
,
i
,
T_AXIS
);
if
(
ncdims
[
ncdimid
].
dimtype
==
X_AXIS
)
cdfSetDim
(
ncvars
,
ncvarid
,
i
,
X_AXIS
);
else
if
(
ncdims
[
ncdimid
].
dimtype
==
Y_AXIS
)
cdfSetDim
(
ncvars
,
ncvarid
,
i
,
Y_AXIS
);
else
if
(
ncdims
[
ncdimid
].
dimtype
==
Z_AXIS
)
cdfSetDim
(
ncvars
,
ncvarid
,
i
,
Z_AXIS
);
else
if
(
ncdims
[
ncdimid
].
dimtype
==
T_AXIS
)
cdfSetDim
(
ncvars
,
ncvarid
,
i
,
T_AXIS
);
}
if
(
CDI_Debug
)
...
...
@@ -4156,28 +4155,27 @@ int cdfInqContents(int streamID)
}
}
}
/* set coordinate varids (att: associate) */
/* Set coordinate varids (att: associate) */
for
(
ncvarid
=
0
;
ncvarid
<
nvars
;
ncvarid
++
)
{
if
(
ncvars
[
ncvarid
].
isvar
==
TRUE
)
if
(
ncvars
[
ncvarid
].
isvar
==
TRUE
&&
ncvars
[
ncvarid
].
ncoordvars
)
{
ndims
=
ncvars
[
ncvarid
].
ndims
;
ndims
=
ncvars
[
ncvarid
].
ncoordvars
;
for
(
i
=
0
;
i
<
ndims
;
i
++
)
{
if
(
ncvars
[
ncvarid
].
varids
[
i
]
!=
-
1
)
{
if
(
ncvars
[
ncvars
[
ncvarid
].
varids
[
i
]].
islon
)
ncvars
[
ncvarid
].
xvarid
=
ncvars
[
ncvarid
].
varids
[
i
];
else
if
(
ncvars
[
ncvars
[
ncvarid
].
varids
[
i
]].
islat
)
ncvars
[
ncvarid
].
yvarid
=
ncvars
[
ncvarid
].
varids
[
i
];
else
if
(
ncvars
[
ncvars
[
ncvarid
].
varids
[
i
]].
islev
)
ncvars
[
ncvarid
].
zvarid
=
ncvars
[
ncvarid
].
varids
[
i
];
}
if
(
ncvars
[
ncvars
[
ncvarid
].
coordvarids
[
i
]].
islon
)
ncvars
[
ncvarid
].
xvarid
=
ncvars
[
ncvarid
].
coordvarids
[
i
];
else
if
(
ncvars
[
ncvars
[
ncvarid
].
coordvarids
[
i
]].
islat
)
ncvars
[
ncvarid
].
yvarid
=
ncvars
[
ncvarid
].
coordvarids
[
i
];
else
if
(
ncvars
[
ncvars
[
ncvarid
].
coordvarids
[
i
]].
islev
)
ncvars
[
ncvarid
].
zvarid
=
ncvars
[
ncvarid
].
coordvarids
[
i
];
}
}
}
/*
printNCvars(ncvars, nvars);
*/
if
(
CDI_Debug
)
printNCvars
(
ncvars
,
nvars
);
/* define grid */
for
(
ncvarid
=
0
;
ncvarid
<
nvars
;
ncvarid
++
)
...
...
@@ -4243,7 +4241,7 @@ int cdfInqContents(int streamID)
memset
(
&
grid
,
0
,
sizeof
(
GRID
));
grid
.
prec
=
DATATYPE_FLT64
;
grid
.
prec
=
DATATYPE_FLT64
;
grid
.
trunc
=
ncvars
[
ncvarid
].
truncation
;
if
(
ncvars
[
ncvarid
].
gridtype
==
GRID_TRAJECTORY
)
...
...
@@ -4310,6 +4308,7 @@ int cdfInqContents(int streamID)
if
(
i
<
(
int
)
xsize
)
xinc
=
0
;
}
}
if
(
yvarid
!=
UNDEFID
)
{
islat
=
ncvars
[
yvarid
].
islat
;
...
...
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