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
3a892f41
Commit
3a892f41
authored
Jul 19, 2016
by
Uwe Schulzweida
Browse files
Renamed attrtype to atttype.
parent
bc47ad44
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/stream_cdf_i.c
View file @
3a892f41
...
...
@@ -1584,20 +1584,20 @@ void cdf_scan_var_attr(int nvars, ncvar_t *ncvars, ncdim_t *ncdims, int timedimi
/*
int attrint;
double attrflt;
nc_type att
r
type;
nc_type atttype;
cdf_inq_attlen(ncid, ncvarid, attname, &attlen);
cdf_inq_atttype(ncid, ncvarid, attname, &att
r
type);
if ( attlen == 1 && (att
r
type == NC_INT || att
r
type == NC_SHORT) )
cdf_inq_atttype(ncid, ncvarid, attname, &atttype);
if ( attlen == 1 && (atttype == NC_INT || atttype == NC_SHORT) )
{
cdfGetAttInt(ncid, ncvarid, attname, 1, &attrint);
printf("int: %s.%s = %d\n", ncvars[ncvarid].name, attname, attrint);
}
else if ( attlen == 1 && (att
r
type == NC_FLOAT || att
r
type == NC_DOUBLE) )
else if ( attlen == 1 && (atttype == NC_FLOAT || atttype == NC_DOUBLE) )
{
cdfGetAttDouble(ncid, ncvarid, attname, 1, &attrflt);
printf("flt: %s.%s = %g\n", ncvars[ncvarid].name, attname, attrflt);
}
else if ( att
r
type == NC_CHAR )
else if ( atttype == NC_CHAR )
{
cdfGetAttText(ncid, ncvarid, attname, attstringlen, attstring);
attstring[attlen] = 0;
...
...
@@ -2382,7 +2382,7 @@ bool cdf_set_unstructured_par(ncvar_t *ncvar, grid_t *grid, int xdimid, int ydim
static
void
cdf_read_mapping_atts
(
int
ncid
,
int
gmapvarid
,
int
projID
,
const
char
*
varname
)
{
nc_type
att
r
type
;
nc_type
atttype
;
size_t
attlen
;
char
attname
[
CDI_MAX_NAME
];
enum
{
attstringlen
=
8192
};
char
attstring
[
attstringlen
];
...
...
@@ -2403,28 +2403,28 @@ void cdf_read_mapping_atts(int ncid, int gmapvarid, int projID, const char *varn
{
cdf_inq_attname
(
ncid
,
gmapvarid
,
iatt
,
attname
);
cdf_inq_attlen
(
ncid
,
gmapvarid
,
attname
,
&
attlen
);
cdf_inq_atttype
(
ncid
,
gmapvarid
,
attname
,
&
att
r
type
);
cdf_inq_atttype
(
ncid
,
gmapvarid
,
attname
,
&
atttype
);
if
(
xtypeIsInt
(
att
r
type
)
)
if
(
xtypeIsInt
(
atttype
)
)
{
int
attint
[
attlen
];
cdfGetAttInt
(
ncid
,
gmapvarid
,
attname
,
(
int
)
attlen
,
attint
);
printf
(
"att
r
type: %d attname: %s attr: %d
\n
"
,
att
r
type
,
attname
,
attint
[
0
]);
printf
(
"atttype: %d attname: %s attr: %d
\n
"
,
atttype
,
attname
,
attint
[
0
]);
}
else
if
(
xtypeIsFloat
(
att
r
type
)
)
else
if
(
xtypeIsFloat
(
atttype
)
)
{
double
attflt
[
attlen
];
cdfGetAttDouble
(
ncid
,
gmapvarid
,
attname
,
(
int
)
attlen
,
attflt
);
printf
(
"att
r
type: %d attname: %s attr: %g
\n
"
,
att
r
type
,
attname
,
attflt
[
0
]);
int
datatype
=
(
att
r
type
==
NC_FLOAT
)
?
DATATYPE_FLT32
:
DATATYPE_FLT64
;
printf
(
"atttype: %d attname: %s attr: %g
\n
"
,
atttype
,
attname
,
attflt
[
0
]);
int
datatype
=
(
atttype
==
NC_FLOAT
)
?
DATATYPE_FLT32
:
DATATYPE_FLT64
;
//int varID = vlistDefVar(projID, CDI_UNDEFID, CDI_UNDEFID, CDI_UNDEFID);
//printf("varID = %d\n", varID);
vlistDefAttFlt
(
projID
,
CDI_GLOBAL
,
attname
,
datatype
,
(
int
)
attlen
,
attflt
);
}
else
if
(
xtypeIsText
(
att
r
type
)
&&
strcmp
(
attname
,
"grid_mapping_name"
)
)
else
if
(
xtypeIsText
(
atttype
)
&&
strcmp
(
attname
,
"grid_mapping_name"
)
)
{
cdfGetAttText
(
ncid
,
gmapvarid
,
attname
,
attstringlen
,
attstring
);
printf
(
"att
r
type: %d attname: %s attr: %s
\n
"
,
att
r
type
,
attname
,
attstring
);
printf
(
"atttype: %d attname: %s attr: %s
\n
"
,
atttype
,
attname
,
attstring
);
}
}
}
...
...
@@ -3098,7 +3098,7 @@ void cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int model
if
(
ncvars
[
ncvarid
].
natts
)
{
nc_type
att
r
type
;
nc_type
atttype
;
size_t
attlen
;
char
attname
[
CDI_MAX_NAME
];
enum
{
attstringlen
=
8192
};
char
attstring
[
attstringlen
];
...
...
@@ -3109,30 +3109,30 @@ void cdf_define_all_vars(stream_t *streamptr, int vlistID, int instID, int model
int
attnum
=
ncvars
[
ncvarid
].
atts
[
iatt
];
cdf_inq_attname
(
ncid
,
ncvarid
,
attnum
,
attname
);
cdf_inq_attlen
(
ncid
,
ncvarid
,
attname
,
&
attlen
);
cdf_inq_atttype
(
ncid
,
ncvarid
,
attname
,
&
att
r
type
);
cdf_inq_atttype
(
ncid
,
ncvarid
,
attname
,
&
atttype
);
if
(
xtypeIsInt
(
att
r
type
)
)
if
(
xtypeIsInt
(
atttype
)
)
{
int
attint
[
attlen
];
cdfGetAttInt
(
ncid
,
ncvarid
,
attname
,
(
int
)
attlen
,
attint
);
int
datatype
=
(
att
r
type
==
NC_SHORT
)
?
DATATYPE_INT16
:
(
att
r
type
==
NC_BYTE
)
?
DATATYPE_INT8
:
int
datatype
=
(
atttype
==
NC_SHORT
)
?
DATATYPE_INT16
:
(
atttype
==
NC_BYTE
)
?
DATATYPE_INT8
:
#if defined (HAVE_NETCDF4)
(
att
r
type
==
NC_UBYTE
)
?
DATATYPE_UINT8
:
(
att
r
type
==
NC_USHORT
)
?
DATATYPE_UINT16
:
(
att
r
type
==
NC_UINT
)
?
DATATYPE_UINT32
:
(
atttype
==
NC_UBYTE
)
?
DATATYPE_UINT8
:
(
atttype
==
NC_USHORT
)
?
DATATYPE_UINT16
:
(
atttype
==
NC_UINT
)
?
DATATYPE_UINT32
:
#endif
DATATYPE_INT32
;
vlistDefAttInt
(
vlistID
,
varID
,
attname
,
datatype
,
(
int
)
attlen
,
attint
);
}
else
if
(
xtypeIsFloat
(
att
r
type
)
)
else
if
(
xtypeIsFloat
(
atttype
)
)
{
double
attflt
[
attlen
];
cdfGetAttDouble
(
ncid
,
ncvarid
,
attname
,
(
int
)
attlen
,
attflt
);
int
datatype
=
(
att
r
type
==
NC_FLOAT
)
?
DATATYPE_FLT32
:
DATATYPE_FLT64
;
int
datatype
=
(
atttype
==
NC_FLOAT
)
?
DATATYPE_FLT32
:
DATATYPE_FLT64
;
vlistDefAttFlt
(
vlistID
,
varID
,
attname
,
datatype
,
(
int
)
attlen
,
attflt
);
}
else
if
(
xtypeIsText
(
att
r
type
)
)
else
if
(
xtypeIsText
(
atttype
)
)
{
cdfGetAttText
(
ncid
,
ncvarid
,
attname
,
attstringlen
,
attstring
);
vlistDefAttTxt
(
vlistID
,
varID
,
attname
,
(
int
)
attlen
,
attstring
);
...
...
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