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
54c9cc35
Commit
54c9cc35
authored
Jun 08, 2015
by
Uwe Schulzweida
Browse files
varAddRecord: changed dummy_tiles to NULL for non GRIB2 records
parent
46ec6def
Changes
9
Hide whitespace changes
Inline
Side-by-side
src/cdi_int.h
View file @
54c9cc35
...
...
@@ -138,8 +138,6 @@ typedef struct {
attribute
;
}
var_tile_t
;
static
var_tile_t
dummy_tiles
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
};
/* No. of different constants in the enumeration
"subtype_attributes" */
static
const
int
nSubtypeAttributes
=
6
;
...
...
src/mo_cdi.f90
View file @
54c9cc35
...
...
@@ -148,6 +148,7 @@ module mo_cdi
integer
(
c_int
),
public
,
parameter
::
ZAXIS_SEDIMENT_BOTTOM_TW
=
23
integer
(
c_int
),
public
,
parameter
::
ZAXIS_MIX_LAYER
=
24
integer
(
c_int
),
public
,
parameter
::
ZAXIS_REFERENCE
=
25
integer
(
c_int
),
public
,
parameter
::
MAX_KV_PAIRS_MATCH
=
10
integer
(
c_int
),
public
,
parameter
::
TIME_CONSTANT
=
0
integer
(
c_int
),
public
,
parameter
::
TIME_VARIABLE
=
1
integer
(
c_int
),
public
,
parameter
::
TSTEP_CONSTANT
=
0
...
...
@@ -204,6 +205,7 @@ module mo_cdi
end
type
t_CdiGribIterator
public
cdiReset
public
cdiStringError
public
cdiGetStringError
public
cdiDebug
public
cdiLibraryVersion
public
cdiPrintVersion
...
...
@@ -325,6 +327,7 @@ module mo_cdi
public
vlistInqInstitut
public
vlistDefModel
public
vlistInqModel
public
vlistDefVarTiles
public
vlistDefVar
public
vlistChangeVarGrid
public
vlistChangeVarZaxis
...
...
@@ -609,6 +612,14 @@ module mo_cdi
public
streamDefHistory
public
streamInqHistorySize
public
streamInqHistoryString
public
subtypeCreate
public
subtypePrint
public
subtypeCompare
public
subtypeInqSize
public
subtypeInqActiveIndex
public
subtypeDefActiveIndex
public
subtypeInqTile
public
vlistInqVarSubtype
public
gribapiLibraryVersion
contains
...
...
@@ -662,6 +673,39 @@ contains
end
if
end
function
cdiStringError
subroutine
cdiGetStringError
(
vlistID_dummy
,
name_dummy
)
integer
(
c_int
),
value
::
vlistID_dummy
character
(
kind
=
c_char
,
len
=
*
),
intent
(
inout
)
::
name_dummy
character
(
kind
=
c_char
)
::
name_temp
(
len
(
name_dummy
))
integer
::
name_i
logical
::
name_padding
=
.true.
interface
subroutine
lib_cdiGetStringError
(
vlistID_dummy
,
name_dummy
)
bind
(
c
,
name
=
'cdiGetStringError'
)
import
c_char
,
c_int
integer
(
c_int
),
value
::
vlistID_dummy
character
(
kind
=
c_char
)
::
name_dummy
(
*
)
end
subroutine
lib_cdiGetStringError
end
interface
do
name_i
=
len
(
name_dummy
),
1
,
-1
if
(
name_dummy
(
name_i
:
name_i
)
/
=
' '
)
name_padding
=
.false.
if
(
name_padding
)
then
name_temp
(
name_i
)
=
c_null_char
else
name_temp
(
name_i
)
=
name_dummy
(
name_i
:
name_i
)
end
if
end
do
call
lib_cdiGetStringError
(
vlistID_dummy
,
name_temp
)
name_padding
=
.false.
do
name_i
=
1
,
len
(
name_dummy
)
if
(
name_temp
(
name_i
)
==
c_null_char
)
name_padding
=
.true.
if
(
name_padding
)
then
name_dummy
(
name_i
:
name_i
)
=
' '
else
name_dummy
(
name_i
:
name_i
)
=
name_temp
(
name_i
)
end
if
end
do
end
subroutine
cdiGetStringError
subroutine
cdiDebug
(
debug_dummy
)
integer
(
c_int
),
value
::
debug_dummy
interface
...
...
@@ -2804,6 +2848,27 @@ contains
result
=
lib_vlistInqModel
(
vlistID_dummy
)
end
function
vlistInqModel
function
vlistDefVarTiles
(
vlistID_dummy
,
gridID_dummy
,
zaxisID_dummy
,
tsteptype_dummy
,
tilesetID_dummy
)
result
(
result
)
integer
(
c_int
)
::
result
integer
(
c_int
),
value
::
vlistID_dummy
integer
(
c_int
),
value
::
gridID_dummy
integer
(
c_int
),
value
::
zaxisID_dummy
integer
(
c_int
),
value
::
tsteptype_dummy
integer
(
c_int
),
value
::
tilesetID_dummy
interface
integer
(
c_int
)
function
lib_vlistDefVarTiles
(
vlistID_dummy
,
gridID_dummy
,
zaxisID_dummy
,
tsteptype_dummy
,
tilesetID_dummy
)
bind
(&
&
c
,
name
=
'vlistDefVarTiles'
)
import
c_int
integer
(
c_int
),
value
::
vlistID_dummy
integer
(
c_int
),
value
::
gridID_dummy
integer
(
c_int
),
value
::
zaxisID_dummy
integer
(
c_int
),
value
::
tsteptype_dummy
integer
(
c_int
),
value
::
tilesetID_dummy
end
function
lib_vlistDefVarTiles
end
interface
result
=
lib_vlistDefVarTiles
(
vlistID_dummy
,
gridID_dummy
,
zaxisID_dummy
,
tsteptype_dummy
,
tilesetID_dummy
)
end
function
vlistDefVarTiles
function
vlistDefVar
(
vlistID_dummy
,
gridID_dummy
,
zaxisID_dummy
,
tsteptype_dummy
)
result
(
result
)
integer
(
c_int
)
::
result
integer
(
c_int
),
value
::
vlistID_dummy
...
...
@@ -7885,6 +7950,110 @@ contains
end
do
end
subroutine
streamInqHistoryString
function
subtypeCreate
(
subtype_dummy
)
result
(
result
)
integer
(
c_int
)
::
result
integer
(
c_int
),
value
::
subtype_dummy
interface
integer
(
c_int
)
function
lib_subtypeCreate
(
subtype_dummy
)
bind
(
c
,
name
=
'subtypeCreate'
)
import
c_int
integer
(
c_int
),
value
::
subtype_dummy
end
function
lib_subtypeCreate
end
interface
result
=
lib_subtypeCreate
(
subtype_dummy
)
end
function
subtypeCreate
subroutine
subtypePrint
(
subtypeID_dummy
)
integer
(
c_int
),
value
::
subtypeID_dummy
interface
subroutine
lib_subtypePrint
(
subtypeID_dummy
)
bind
(
c
,
name
=
'subtypePrint'
)
import
c_int
integer
(
c_int
),
value
::
subtypeID_dummy
end
subroutine
lib_subtypePrint
end
interface
call
lib_subtypePrint
(
subtypeID_dummy
)
end
subroutine
subtypePrint
function
subtypeCompare
(
subtypeID1_dummy
,
subtypeID2_dummy
)
result
(
result
)
integer
(
c_int
)
::
result
integer
(
c_int
),
value
::
subtypeID1_dummy
integer
(
c_int
),
value
::
subtypeID2_dummy
interface
integer
(
c_int
)
function
lib_subtypeCompare
(
subtypeID1_dummy
,
subtypeID2_dummy
)
bind
(
c
,
name
=
'subtypeCompare'
)
import
c_int
integer
(
c_int
),
value
::
subtypeID1_dummy
integer
(
c_int
),
value
::
subtypeID2_dummy
end
function
lib_subtypeCompare
end
interface
result
=
lib_subtypeCompare
(
subtypeID1_dummy
,
subtypeID2_dummy
)
end
function
subtypeCompare
function
subtypeInqSize
(
subtypeID_dummy
)
result
(
result
)
integer
(
c_int
)
::
result
integer
(
c_int
),
value
::
subtypeID_dummy
interface
integer
(
c_int
)
function
lib_subtypeInqSize
(
subtypeID_dummy
)
bind
(
c
,
name
=
'subtypeInqSize'
)
import
c_int
integer
(
c_int
),
value
::
subtypeID_dummy
end
function
lib_subtypeInqSize
end
interface
result
=
lib_subtypeInqSize
(
subtypeID_dummy
)
end
function
subtypeInqSize
function
subtypeInqActiveIndex
(
subtypeID_dummy
)
result
(
result
)
integer
(
c_int
)
::
result
integer
(
c_int
),
value
::
subtypeID_dummy
interface
integer
(
c_int
)
function
lib_subtypeInqActiveIndex
(
subtypeID_dummy
)
bind
(
c
,
name
=
'subtypeInqActiveIndex'
)
import
c_int
integer
(
c_int
),
value
::
subtypeID_dummy
end
function
lib_subtypeInqActiveIndex
end
interface
result
=
lib_subtypeInqActiveIndex
(
subtypeID_dummy
)
end
function
subtypeInqActiveIndex
subroutine
subtypeDefActiveIndex
(
subtypeID_dummy
,
index_dummy
)
integer
(
c_int
),
value
::
subtypeID_dummy
integer
(
c_int
),
value
::
index_dummy
interface
subroutine
lib_subtypeDefActiveIndex
(
subtypeID_dummy
,
index_dummy
)
bind
(
c
,
name
=
'subtypeDefActiveIndex'
)
import
c_int
integer
(
c_int
),
value
::
subtypeID_dummy
integer
(
c_int
),
value
::
index_dummy
end
subroutine
lib_subtypeDefActiveIndex
end
interface
call
lib_subtypeDefActiveIndex
(
subtypeID_dummy
,
index_dummy
)
end
subroutine
subtypeDefActiveIndex
function
subtypeInqTile
(
subtypeID_dummy
,
tileindex_dummy
,
attribute_dummy
)
result
(
result
)
integer
(
c_int
)
::
result
integer
(
c_int
),
value
::
subtypeID_dummy
integer
(
c_int
),
value
::
tileindex_dummy
integer
(
c_int
),
value
::
attribute_dummy
interface
integer
(
c_int
)
function
lib_subtypeInqTile
(
subtypeID_dummy
,
tileindex_dummy
,
attribute_dummy
)
bind
(
c
,
name
=
'subtypeInqTile'
)
import
c_int
integer
(
c_int
),
value
::
subtypeID_dummy
integer
(
c_int
),
value
::
tileindex_dummy
integer
(
c_int
),
value
::
attribute_dummy
end
function
lib_subtypeInqTile
end
interface
result
=
lib_subtypeInqTile
(
subtypeID_dummy
,
tileindex_dummy
,
attribute_dummy
)
end
function
subtypeInqTile
function
vlistInqVarSubtype
(
vlistID_dummy
,
varID_dummy
)
result
(
result
)
integer
(
c_int
)
::
result
integer
(
c_int
),
value
::
vlistID_dummy
integer
(
c_int
),
value
::
varID_dummy
interface
integer
(
c_int
)
function
lib_vlistInqVarSubtype
(
vlistID_dummy
,
varID_dummy
)
bind
(
c
,
name
=
'vlistInqVarSubtype'
)
import
c_int
integer
(
c_int
),
value
::
vlistID_dummy
integer
(
c_int
),
value
::
varID_dummy
end
function
lib_vlistInqVarSubtype
end
interface
result
=
lib_vlistInqVarSubtype
(
vlistID_dummy
,
varID_dummy
)
end
function
vlistInqVarSubtype
subroutine
gribapiLibraryVersion
(
major_version
,
minor_version
,
revision_version
)
integer
(
c_int
),
optional
,
intent
(
inout
)
::
major_version
integer
(
c_int
),
optional
,
intent
(
inout
)
::
minor_version
...
...
src/stream_cgribex.c
View file @
54c9cc35
...
...
@@ -404,11 +404,9 @@ void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, d
if
(
datatype
>
32
)
datatype
=
DATATYPE_PACK32
;
if
(
datatype
<
0
)
datatype
=
DATATYPE_PACK
;
/* set dummy tiles attributes (so far, only used for GRIB-API and GRIB2) */
int
tile_index
;
varAddRecord
(
recID
,
param
,
gridID
,
zaxistype
,
lbounds
,
level1
,
level2
,
0
,
0
,
datatype
,
&
varID
,
&
levelID
,
tsteptype
,
numavg
,
ISEC1_LevelType
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
,
dummy_tiles
,
&
tile_index
);
datatype
,
&
varID
,
&
levelID
,
tsteptype
,
numavg
,
ISEC1_LevelType
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
(
*
record
).
varID
=
(
short
)
varID
;
(
*
record
).
levelID
=
(
short
)
levelID
;
...
...
src/stream_ext.c
View file @
54c9cc35
...
...
@@ -237,11 +237,9 @@ void extAddRecord(stream_t *streamptr, int param, int level, int xysize,
*/
leveltype
=
ZAXIS_GENERIC
;
/* set dummy tiles attributes (so far, only used for GRIB2) */
int
tile_index
;
varAddRecord
(
recID
,
param
,
gridID
,
leveltype
,
0
,
level
,
0
,
0
,
0
,
extInqDatatype
(
prec
,
number
),
&
varID
,
&
levelID
,
TSTEP_INSTANT
,
0
,
0
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
,
dummy_tiles
,
&
tile_index
);
extInqDatatype
(
prec
,
number
),
&
varID
,
&
levelID
,
TSTEP_INSTANT
,
0
,
0
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
(
*
record
).
varID
=
(
short
)
varID
;
(
*
record
).
levelID
=
(
short
)
levelID
;
...
...
src/stream_gribapi.c
View file @
54c9cc35
...
...
@@ -26,7 +26,7 @@
extern
int
cdiInventoryMode
;
static
var_tile_t
dummy_tiles
=
{
-
1
,
-
1
,
-
1
,
-
1
,
-
1
,
-
1
};
typedef
struct
{
int
param
;
...
...
@@ -448,7 +448,7 @@ static
void
gribapiAddRecord
(
stream_t
*
streamptr
,
int
param
,
grib_handle
*
gh
,
size_t
recsize
,
off_t
position
,
int
datatype
,
int
comptype
,
const
char
*
varname
,
int
leveltype1
,
int
leveltype2
,
int
lbounds
,
int
level1
,
int
level2
,
int
level_sf
,
int
level_unit
,
var_tile_t
tiles
,
int
lread_additional_keys
)
const
var_tile_t
*
tiles
,
int
lread_additional_keys
)
{
int
zaxistype
;
int
gridID
=
CDI_UNDEFID
,
varID
;
...
...
@@ -943,7 +943,7 @@ int gribapiScanTimestep1(stream_t * streamptr)
}
gribapiAddRecord
(
streamptr
,
param
,
gh
,
recsize
,
recpos
,
datatype
,
comptype
,
varname
,
leveltype1
,
leveltype2
,
lbounds
,
level1
,
level2
,
level_sf
,
level_unit
,
tiles
,
1
);
leveltype1
,
leveltype2
,
lbounds
,
level1
,
level2
,
level_sf
,
level_unit
,
&
tiles
,
1
);
grib_handle_delete
(
gh
);
gh
=
NULL
;
...
...
src/stream_ieg.c
View file @
54c9cc35
...
...
@@ -770,11 +770,9 @@ void iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vc
datatype
=
iegInqDatatype
(
prec
);
/* set dummy tiles attributes (so far, only used for GRIB2) */
int
tile_index
=
0
;
varAddRecord
(
recID
,
param
,
gridID
,
leveltype
,
lbounds
,
level1
,
level2
,
0
,
0
,
datatype
,
&
varID
,
&
levelID
,
TSTEP_INSTANT
,
0
,
0
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
,
dummy_tiles
,
&
tile_index
);
datatype
,
&
varID
,
&
levelID
,
TSTEP_INSTANT
,
0
,
0
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
record
->
varID
=
(
short
)
varID
;
record
->
levelID
=
(
short
)
levelID
;
...
...
src/stream_srv.c
View file @
54c9cc35
...
...
@@ -241,11 +241,9 @@ void srv_add_record(stream_t *streamptr, int param, int level, int xsize, int ys
datatype
=
srvInqDatatype
(
prec
);
/* set dummy tiles attributes (so far, only used for GRIB2) */
int
tile_index
=
0
;
varAddRecord
(
recID
,
param
,
gridID
,
leveltype
,
0
,
level
,
0
,
0
,
0
,
datatype
,
&
varID
,
&
levelID
,
TSTEP_INSTANT
,
0
,
0
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
,
dummy_tiles
,
&
tile_index
);
datatype
,
&
varID
,
&
levelID
,
TSTEP_INSTANT
,
0
,
0
,
-
1
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
xassert
(
varID
<=
SHRT_MAX
&&
levelID
<=
SHRT_MAX
);
(
*
record
).
varID
=
(
short
)
varID
;
...
...
src/varscan.c
View file @
54c9cc35
...
...
@@ -27,10 +27,6 @@ static int numberOfVerticalLevels = 0;
static
int
numberOfVerticalGrid
=
0
;
static
unsigned
char
uuidVGrid
[
CDI_UUID_SIZE
];
/* data structure specifying tile-related meta-data for the current
* record. */
static
var_tile_t
tiles
;
typedef
struct
{
...
...
@@ -140,7 +136,7 @@ paramInitEntry(unsigned varID, int param)
/* Test if a variable specified by the given meta-data has already
* been registered in "vartable". */
static
unsigned
varGetEntry
(
int
param
,
int
zaxistype
,
int
ltype1
,
int
tsteptype
,
const
char
*
name
,
var_tile_t
tiles
)
varGetEntry
(
int
param
,
int
zaxistype
,
int
ltype1
,
int
tsteptype
,
const
char
*
name
,
const
var_tile_t
*
tiles
)
{
for
(
unsigned
varID
=
0
;
varID
<
varTablesize
;
varID
++
)
{
...
...
@@ -148,14 +144,16 @@ varGetEntry(int param, int zaxistype, int ltype1, int tsteptype, const char *nam
* current vartable size: */
if
(
vartable
[
varID
].
param
==
param
)
{
int
no_of_tiles
=
tiles
.
numberOfTiles
;
if
(
vartable
[
varID
].
tiles
!=
NULL
)
no_of_tiles
=
subtypeGetGlobalDataP
(
vartable
[
varID
].
tiles
,
SUBTYPE_ATT_NUMBER_OF_TILES
);
int
no_of_tiles
=
-
1
;
if
(
tiles
)
no_of_tiles
=
tiles
->
numberOfTiles
;
int
vt_no_of_tiles
=
-
1
;
if
(
vartable
[
varID
].
tiles
)
vt_no_of_tiles
=
subtypeGetGlobalDataP
(
vartable
[
varID
].
tiles
,
SUBTYPE_ATT_NUMBER_OF_TILES
);
if
(
(
vartable
[
varID
].
zaxistype
==
zaxistype
)
&&
(
vartable
[
varID
].
ltype1
==
ltype1
)
&&
(
vartable
[
varID
].
tsteptype
==
tsteptype
)
&&
(
no_of_tiles
==
tiles
.
numberOfT
iles
)
)
(
vt_
no_of_tiles
==
no_of_t
iles
)
)
{
if
(
name
&&
name
[
0
]
&&
vartable
[
varID
].
name
&&
vartable
[
varID
].
name
[
0
]
)
{
...
...
@@ -193,7 +191,7 @@ void varFree(void)
if
(
vartable
[
varID
].
ensdata
)
free
(
vartable
[
varID
].
ensdata
);
if
(
vartable
[
varID
].
tiles
)
subtypeDestroyPtr
(
vartable
[
varID
].
tiles
);
if
(
vartable
[
varID
].
opt_grib_kvpair
)
if
(
vartable
[
varID
].
opt_grib_kvpair
)
{
for
(
int
i
=
0
;
i
<
vartable
[
varID
].
opt_grib_nentries
;
i
++
)
{
if
(
vartable
[
varID
].
opt_grib_kvpair
[
i
].
keyword
)
...
...
@@ -223,7 +221,6 @@ void varFree(void)
/* Search for a tile subtype with subtypeIndex == tile_index. */
static
int
tileGetEntry
(
unsigned
varID
,
int
tile_index
)
{
int
tileID
=
CDI_UNDEFID
;
for
(
int
isub
=
0
;
isub
<
vartable
[
varID
].
nsubtypes
;
isub
++
)
if
(
vartable
[
varID
].
recordTable
[
isub
].
subtypeIndex
==
tile_index
)
return
isub
;
...
...
@@ -232,7 +229,7 @@ static int tileGetEntry(unsigned varID, int tile_index)
/* Resizes vartable:recordTable data structure, if necessary. */
static
int
tileNewEntry
(
int
varID
,
int
tile_index
)
static
int
tileNewEntry
(
int
varID
)
{
int
tileID
=
0
;
if
(
vartable
[
varID
].
nsubtypes_alloc
==
0
)
...
...
@@ -424,24 +421,42 @@ paramNewEntry(int param)
/* Append tile set to a subtype. Return index of the new tile (i.e.
* the "entry->self" value). */
int
varInsertTileSubtype
(
vartable_t
*
vptr
,
var_tile_t
tiles
)
static
int
varInsertTileSubtype
(
vartable_t
*
vptr
,
const
var_tile_t
*
tiles
)
{
int
totalno_of_tileattr_pairs
=
-
1
;
int
tileClassification
=
-
1
;
int
numberOfTiles
=
-
1
;
int
numberOfAttributes
=
-
1
;
int
tileindex
=
-
1
;
int
attribute
=
-
1
;
if
(
tiles
)
{
totalno_of_tileattr_pairs
=
tiles
->
totalno_of_tileattr_pairs
;
tileClassification
=
tiles
->
tileClassification
;
numberOfTiles
=
tiles
->
numberOfTiles
;
numberOfAttributes
=
tiles
->
numberOfAttributes
;
tileindex
=
tiles
->
tileindex
;
attribute
=
tiles
->
attribute
;
}
/* first, generate a subtype based on the info in "tiles". */
subtype_t
*
subtype_ptr
;
subtypeAllocate
(
&
subtype_ptr
,
SUBTYPE_TILES
);
subtypeDefGlobalDataP
(
subtype_ptr
,
SUBTYPE_ATT_TOTALNO_OF_TILEATTR_PAIRS
,
tiles
.
totalno_of_tileattr_pairs
);
subtypeDefGlobalDataP
(
subtype_ptr
,
SUBTYPE_ATT_TILE_CLASSIFICATION
,
tiles
.
tileClassification
);
subtypeDefGlobalDataP
(
subtype_ptr
,
SUBTYPE_ATT_NUMBER_OF_TILES
,
tiles
.
numberOfTiles
);
subtypeDefGlobalDataP
(
subtype_ptr
,
SUBTYPE_ATT_TOTALNO_OF_TILEATTR_PAIRS
,
totalno_of_tileattr_pairs
);
subtypeDefGlobalDataP
(
subtype_ptr
,
SUBTYPE_ATT_TILE_CLASSIFICATION
,
tileClassification
);
subtypeDefGlobalDataP
(
subtype_ptr
,
SUBTYPE_ATT_NUMBER_OF_TILES
,
numberOfTiles
);
/*
/*
* Here, we create a tile set for comparison that contains only one
* tile/attribute pair (based on "tiles").
* tile/attribute pair (based on "tiles").
*/
struct
subtype_entry_t
*
entry
=
subtypeEntryInsert
(
subtype_ptr
);
subtypeDefEntryDataP
(
entry
,
SUBTYPE_ATT_NUMBER_OF_ATTR
,
tiles
.
numberOfAttributes
);
subtypeDefEntryDataP
(
entry
,
SUBTYPE_ATT_TILEINDEX
,
tiles
.
tileindex
);
subtypeDefEntryDataP
(
entry
,
SUBTYPE_ATT_TILEATTRIBUTE
,
tiles
.
attribute
);
subtypeDefEntryDataP
(
entry
,
SUBTYPE_ATT_NUMBER_OF_ATTR
,
numberOfAttributes
);
subtypeDefEntryDataP
(
entry
,
SUBTYPE_ATT_TILEINDEX
,
tileindex
);
subtypeDefEntryDataP
(
entry
,
SUBTYPE_ATT_TILEATTRIBUTE
,
attribute
);
if
(
vptr
->
tiles
==
NULL
)
{
vptr
->
tiles
=
subtype_ptr
;
...
...
@@ -460,7 +475,7 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds,
int
level1
,
int
level2
,
int
level_sf
,
int
level_unit
,
int
prec
,
int
*
pvarID
,
int
*
plevelID
,
int
tsteptype
,
int
numavg
,
int
ltype1
,
int
ltype2
,
const
char
*
name
,
const
char
*
stdname
,
const
char
*
longname
,
const
char
*
units
,
var_tile_t
tiles
,
int
*
tile_index
)
const
var_tile_t
*
tiles
,
int
*
tile_index
)
{
unsigned
varID
=
(
cdiSplitLtype105
!=
1
||
zaxistype
!=
ZAXIS_HEIGHT
)
?
varGetEntry
(
param
,
zaxistype
,
ltype1
,
tsteptype
,
name
,
tiles
)
:
(
unsigned
)
UNDEFID
;
...
...
@@ -506,10 +521,10 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds,
/* append current tile to tile subtype info. */
int
this_tile
=
varInsertTileSubtype
(
&
vartable
[
varID
],
tiles
);
int
tileID
=
tileGetEntry
(
varID
,
this_tile
);
(
*
tile_index
)
=
this_tile
;
int
tileID
=
tileGetEntry
(
varID
,
this_tile
);
if
(
tile_index
)
(
*
tile_index
)
=
this_tile
;
if
(
tileID
==
CDI_UNDEFID
)
{
tileID
=
tileNewEntry
(
varID
,
this_tile
);
tileID
=
tileNewEntry
(
varID
);
vartable
[
varID
].
recordTable
[
tileID
].
subtypeIndex
=
this_tile
;
vartable
[
varID
].
nsubtypes
++
;
}
...
...
@@ -518,7 +533,7 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds,
int
levelID
=
levelNewEntry
(
varID
,
level1
,
level2
,
tileID
);
if
(
CDI_Debug
)
Message
(
"vartable[%d].recordTable[%d].levelTable[%d].recID = %d; level1,2=%d,%d
\n
"
,
varID
,
tileID
,
levelID
,
recID
,
level1
,
level2
);
varID
,
tileID
,
levelID
,
recID
,
level1
,
level2
);
vartable
[
varID
].
recordTable
[
tileID
].
levelTable
[
levelID
].
recID
=
recID
;
*
pvarID
=
(
int
)
varID
;
...
...
@@ -670,7 +685,7 @@ void cdi_generate_vars(stream_t *streamptr)
leveltable_t
*
t1
=
vartable
[
varid
].
recordTable
[
isub
-
1
].
levelTable
;
leveltable_t
*
t2
=
vartable
[
varid
].
recordTable
[
isub
].
levelTable
;
for
(
int
ilev
=
0
;
ilev
<
nlevels
;
ilev
++
)
for
(
unsigned
ilev
=
0
;
ilev
<
nlevels
;
ilev
++
)
if
((
t1
[
ilev
].
level1
!=
t2
[
ilev
].
level1
)
||
(
t1
[
ilev
].
level2
!=
t2
[
ilev
].
level2
)
||
(
t1
[
ilev
].
lindex
!=
t2
[
ilev
].
lindex
))
...
...
@@ -871,7 +886,7 @@ void cdi_generate_vars(stream_t *streamptr)
vartable[varid].levelTable[levelID].level1);
}
*/
for
(
unsigned
isub
=
0
;
isub
<
vartable
[
varid
].
nsubtypes
;
isub
++
)
for
(
int
isub
=
0
;
isub
<
vartable
[
varid
].
nsubtypes
;
isub
++
)
{
for
(
unsigned
levelID
=
0
;
levelID
<
nlevels
;
levelID
++
)
{
...
...
src/varscan.h
View file @
54c9cc35
...
...
@@ -10,7 +10,7 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds,
int
level1
,
int
level2
,
int
level_sf
,
int
level_unit
,
int
prec
,
int
*
pvarID
,
int
*
plevelID
,
int
tsteptype
,
int
numavg
,
int
ltype1
,
int
ltype2
,
const
char
*
name
,
const
char
*
stdname
,
const
char
*
longname
,
const
char
*
units
,
var_tile_t
tiles
,
int
*
tile_index
);
const
var_tile_t
*
tiles
,
int
*
tile_index
);
void
varDefVCT
(
size_t
vctsize
,
double
*
vctptr
);
void
varDefZAxisReference
(
int
nlev
,
int
nvgrid
,
unsigned
char
uuid
[
CDI_UUID_SIZE
]);
...
...
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