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
7077acf0
Commit
7077acf0
authored
Jun 18, 2015
by
Thomas Jahns
🤸
Browse files
Fix bugs from tiles.
parent
8c3651ba
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/stream_grb.c
View file @
7077acf0
...
...
@@ -495,12 +495,8 @@ void grbReadVarSliceDP(stream_t * streamptr, int varID, int levelID, double *dat
off_t
currentfilepos
=
fileGetPos
(
fileID
);
int
isub
=
subtypeInqActiveIndex
(
streamptr
->
vars
[
varID
].
subtypeID
);
int
nlevs
=
streamptr
->
vars
[
varID
].
recordTable
[
isub
].
nlevs
;
int
zaxisID
=
vlistInqVarZaxis
(
vlistID
,
varID
);
int
nlevs2
=
zaxisInqSize
(
zaxisID
);
int
recID
=
streamptr
->
vars
[
varID
].
recordTable
[
isub
].
recordID
[
levelID
];
off_t
recpos
=
streamptr
->
tsteps
[
tsID
].
records
[
recID
].
position
;
size_t
recsize
=
streamptr
->
tsteps
[
tsID
].
records
[
recID
].
size
;
...
...
src/stream_gribapi.c
View file @
7077acf0
...
...
@@ -27,7 +27,9 @@
extern
int
cdiInventoryMode
;
#if defined (HAVE_LIBGRIB_API)
static
var_tile_t
dummy_tiles
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
};
#endif
typedef
struct
{
int
param
;
...
...
@@ -420,12 +422,12 @@ void gribGetLevel(grib_handle *gh, int* leveltype1, int* leveltype2, int* lbound
grib2GetLevel
(
gh
,
leveltype1
,
leveltype2
,
lbounds
,
level1
,
level2
,
level_sf
,
level_unit
);
/* read in tiles attributes (if there are any) */
tiles
->
tileindex
=
gribGetLongDefault
(
gh
,
s
ubtypeAttributeName
[
SUBTYPE_ATT_TILEINDEX
],
-
1
);
tiles
->
totalno_of_tileattr_pairs
=
gribGetLongDefault
(
gh
,
s
ubtypeAttributeName
[
SUBTYPE_ATT_TOTALNO_OF_TILEATTR_PAIRS
],
-
1
);
tiles
->
tileClassification
=
gribGetLongDefault
(
gh
,
s
ubtypeAttributeName
[
SUBTYPE_ATT_TILE_CLASSIFICATION
],
-
1
);
tiles
->
numberOfTiles
=
gribGetLongDefault
(
gh
,
s
ubtypeAttributeName
[
SUBTYPE_ATT_NUMBER_OF_TILES
],
-
1
);
tiles
->
numberOfAttributes
=
gribGetLongDefault
(
gh
,
s
ubtypeAttributeName
[
SUBTYPE_ATT_NUMBER_OF_ATTR
],
-
1
);
tiles
->
attribute
=
gribGetLongDefault
(
gh
,
s
ubtypeAttributeName
[
SUBTYPE_ATT_TILEATTRIBUTE
],
-
1
);
tiles
->
tileindex
=
gribGetLongDefault
(
gh
,
cdiS
ubtypeAttributeName
[
SUBTYPE_ATT_TILEINDEX
],
-
1
);
tiles
->
totalno_of_tileattr_pairs
=
gribGetLongDefault
(
gh
,
cdiS
ubtypeAttributeName
[
SUBTYPE_ATT_TOTALNO_OF_TILEATTR_PAIRS
],
-
1
);
tiles
->
tileClassification
=
gribGetLongDefault
(
gh
,
cdiS
ubtypeAttributeName
[
SUBTYPE_ATT_TILE_CLASSIFICATION
],
-
1
);
tiles
->
numberOfTiles
=
gribGetLongDefault
(
gh
,
cdiS
ubtypeAttributeName
[
SUBTYPE_ATT_NUMBER_OF_TILES
],
-
1
);
tiles
->
numberOfAttributes
=
gribGetLongDefault
(
gh
,
cdiS
ubtypeAttributeName
[
SUBTYPE_ATT_NUMBER_OF_ATTR
],
-
1
);
tiles
->
attribute
=
gribGetLongDefault
(
gh
,
cdiS
ubtypeAttributeName
[
SUBTYPE_ATT_TILEATTRIBUTE
],
-
1
);
}
}
...
...
src/subtype.c
View file @
7077acf0
...
...
@@ -44,6 +44,15 @@ const char* subtypeName[] = {
"tileset"
};
const
char
*
const
cdiSubtypeAttributeName
[]
=
{
"tileIndex"
,
"totalNumberOfTileAttributePairs"
,
"tileClassification"
,
"numberOfTiles"
,
"numberOfTileAttributes"
,
"tileAttribute"
};
/* prototypes: */
static
int
subtypeCompareP
(
subtype_t
*
z1
,
subtype_t
*
z2
);
...
...
@@ -77,7 +86,7 @@ int attribute_to_index(const char *key)
{
if
(
key
==
NULL
)
Error
(
"Internal error!"
);
for
(
int
i
=
0
;
i
<
nSubtypeAttributes
;
i
++
)
if
(
strcmp
(
key
,
s
ubtypeAttributeName
[
i
])
==
0
)
return
i
;
if
(
strcmp
(
key
,
cdiS
ubtypeAttributeName
[
i
])
==
0
)
return
i
;
return
-
1
;
}
...
...
@@ -337,7 +346,7 @@ void subtypePrintKernel(subtype_t *subtype_ptr, FILE *fp)
struct
subtype_attr_t
*
ptr
=
subtype_ptr
->
globals
.
atts
;
if
(
ptr
!=
NULL
)
fprintf
(
fp
,
"#
\n
# global attributes:
\n
"
);
while
(
ptr
!=
NULL
)
{
fprintf
(
fp
,
"# %-40s (%2d) : %d
\n
"
,
s
ubtypeAttributeName
[
ptr
->
key
],
ptr
->
key
,
ptr
->
val
);
fprintf
(
fp
,
"# %-40s (%2d) : %d
\n
"
,
cdiS
ubtypeAttributeName
[
ptr
->
key
],
ptr
->
key
,
ptr
->
val
);
ptr
=
ptr
->
next
;
}
/* print attributes for each subtype */
...
...
@@ -348,7 +357,7 @@ void subtypePrintKernel(subtype_t *subtype_ptr, FILE *fp)
ptr
=
entry
->
atts
;
if
(
ptr
!=
NULL
)
fprintf
(
fp
,
"# attributes:
\n
"
);
while
(
ptr
!=
NULL
)
{
fprintf
(
fp
,
"# %-40s (%2d) : %d
\n
"
,
s
ubtypeAttributeName
[
ptr
->
key
],
ptr
->
key
,
ptr
->
val
);
fprintf
(
fp
,
"# %-40s (%2d) : %d
\n
"
,
cdiS
ubtypeAttributeName
[
ptr
->
key
],
ptr
->
key
,
ptr
->
val
);
ptr
=
ptr
->
next
;
}
entry
=
entry
->
next
;
...
...
@@ -767,8 +776,8 @@ int subtypeInqSubEntry(int subtypeID, subtype_query_t criterion)
int
subtypeInqTile
(
int
subtypeID
,
int
tileindex
,
int
attribute
)
{
return
subtypeInqSubEntry
(
subtypeID
,
matchAND
(
keyValuePair
(
s
ubtypeAttributeName
[
SUBTYPE_ATT_TILEINDEX
],
tileindex
),
keyValuePair
(
s
ubtypeAttributeName
[
SUBTYPE_ATT_TILEATTRIBUTE
],
attribute
)));
matchAND
(
keyValuePair
(
cdiS
ubtypeAttributeName
[
SUBTYPE_ATT_TILEINDEX
],
tileindex
),
keyValuePair
(
cdiS
ubtypeAttributeName
[
SUBTYPE_ATT_TILEATTRIBUTE
],
attribute
)));
}
...
...
src/subtype.h
View file @
7077acf0
#ifndef _SUBTYPE_H
#define _SUBTYPE_H
/* No. of different constants in the enumeration
"subtype_attributes" */
static
const
int
nSubtypeAttributes
=
6
;
enum
{
/* subtype attributes wrt. TILES */
...
...
@@ -12,20 +9,16 @@ enum {
SUBTYPE_ATT_TILE_CLASSIFICATION
=
2
,
SUBTYPE_ATT_NUMBER_OF_TILES
=
3
,
SUBTYPE_ATT_NUMBER_OF_ATTR
=
4
,
SUBTYPE_ATT_TILEATTRIBUTE
=
5
SUBTYPE_ATT_TILEATTRIBUTE
=
5
,
/* No. of different constants in the enumeration
"subtype_attributes" */
nSubtypeAttributes
};
/* Literal constants corresponding to the different constants of the
enumeration "subtype_attributes". */
static
const
char
*
subtypeAttributeName
[]
=
{
"tileIndex"
,
"totalNumberOfTileAttributePairs"
,
"tileClassification"
,
"numberOfTiles"
,
"numberOfTileAttributes"
,
"tileAttribute"
};
extern
const
char
*
const
cdiSubtypeAttributeName
[];
/* Data type specifying an attribute of a subtype (for example an
attribute of a set of TILES) or an attribute of a subtype entry
...
...
@@ -44,7 +37,7 @@ struct subtype_entry_t {
struct
subtype_entry_t
*
next
;
/* next node in linked list */
/* linked list with attributes for this subtype entry, ordered by its key values*/
struct
subtype_attr_t
*
atts
;
struct
subtype_attr_t
*
atts
;
};
...
...
src/varscan.c
View file @
7077acf0
...
...
@@ -526,7 +526,7 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds,
int
tileID
=
tileGetEntry
(
varID
,
this_tile
);
if
(
tile_index
)
(
*
tile_index
)
=
this_tile
;
if
(
tileID
==
CDI_UNDEFID
)
{
tileID
=
tileNewEntry
(
varID
);
tileID
=
tileNewEntry
(
(
int
)
varID
);
vartable
[
varID
].
recordTable
[
tileID
].
subtypeIndex
=
this_tile
;
vartable
[
varID
].
nsubtypes
++
;
}
...
...
@@ -1178,6 +1178,7 @@ void varDefProductDefinitionTemplate(int varID, int productDefinitionTemplate)
vartable
[
varID
].
productDefinitionTemplate
=
productDefinitionTemplate
;
}
#if defined (HAVE_LIBGRIB_API)
/* Resizes and initializes opt_grib_kvpair data structure. */
static
void
resize_vartable_opt_grib_entries
(
vartable_t
*
var
,
int
nentries
)
...
...
@@ -1210,6 +1211,7 @@ void resize_vartable_opt_grib_entries(vartable_t *var, int nentries)
var
->
opt_grib_kvpair
=
tmp
;
}
}
#endif
#if defined (HAVE_LIBGRIB_API)
void
varDefOptGribInt
(
int
varID
,
int
tile_index
,
long
lval
,
const
char
*
keyword
)
...
...
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