Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
a77b6951
Commit
a77b6951
authored
Aug 08, 2016
by
Uwe Schulzweida
Browse files
Renamed vlistInqAtt/vlistDefAtt to cdiInqAtt/cdiDefAtt.
parent
f4f5b726
Changes
13
Hide whitespace changes
Inline
Side-by-side
src/CMOR.c
View file @
a77b6951
...
...
@@ -152,29 +152,29 @@ static void dump_global_attributes(struct kv **ht, int streamID)
{
int
natts
;
int
vlistID
=
streamInqVlist
(
streamID
);
vlist
InqNatts
(
vlistID
,
CDI_GLOBAL
,
&
natts
);
cdi
InqNatts
(
vlistID
,
CDI_GLOBAL
,
&
natts
);
for
(
int
i
=
0
;
i
<
natts
;
i
++
)
{
char
name
[
CDI_MAX_NAME
];
char
*
value
=
NULL
;
char
buffer
[
8
];
int
type
,
len
;
vlist
InqAtt
(
vlistID
,
CDI_GLOBAL
,
i
,
name
,
&
type
,
&
len
);
cdi
InqAtt
(
vlistID
,
CDI_GLOBAL
,
i
,
name
,
&
type
,
&
len
);
switch
(
type
)
{
case
DATATYPE_TXT
:
value
=
Malloc
(
len
+
1
);
vlist
InqAttTxt
(
vlistID
,
CDI_GLOBAL
,
name
,
len
,
value
);
cdi
InqAttTxt
(
vlistID
,
CDI_GLOBAL
,
name
,
len
,
value
);
value
[
len
]
=
'\0'
;
break
;
case
DATATYPE_INT32
:
value
=
Malloc
(
CDI_MAX_NAME
);
vlist
InqAttInt
(
vlistID
,
CDI_GLOBAL
,
name
,
len
,
(
int
*
)
buffer
);
cdi
InqAttInt
(
vlistID
,
CDI_GLOBAL
,
name
,
len
,
(
int
*
)
buffer
);
snprintf
(
value
,
CDI_MAX_NAME
,
"%i"
,
*
(
int
*
)
buffer
);
break
;
case
DATATYPE_FLT64
:
value
=
Malloc
(
CDI_MAX_NAME
);
vlist
InqAttFlt
(
vlistID
,
CDI_GLOBAL
,
name
,
len
,
(
double
*
)
buffer
);
cdi
InqAttFlt
(
vlistID
,
CDI_GLOBAL
,
name
,
len
,
(
double
*
)
buffer
);
snprintf
(
value
,
CDI_MAX_NAME
,
"%e"
,
*
(
double
*
)
buffer
);
break
;
default:
...
...
@@ -193,7 +193,7 @@ static void dump_special_attributes(struct kv **ht, int streamID)
char
*
new_history
=
get_val
(
ht
,
"history"
,
""
);
size_t
historysize
;
int
natts
;
vlist
InqNatts
(
vlistID
,
CDI_GLOBAL
,
&
natts
);
cdi
InqNatts
(
vlistID
,
CDI_GLOBAL
,
&
natts
);
if
(
natts
>
0
)
old_historysize
=
(
size_t
)
streamInqHistorySize
(
fileID
);
else
...
...
src/Echam5ini.c
View file @
a77b6951
...
...
@@ -1484,7 +1484,7 @@ void *Echam5ini(void *argument)
for
(
iatt
=
0
;
iatt
<
atts
.
natxt
;
++
iatt
)
{
/* printf("%s: %s\n", atts.atxtname[iatt], atts.atxtentry[iatt]); */
vlist
DefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
atts
.
atxtname
[
iatt
],
cdi
DefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
atts
.
atxtname
[
iatt
],
(
int
)
strlen
(
atts
.
atxtentry
[
iatt
])
+
1
,
atts
.
atxtentry
[
iatt
]);
}
...
...
src/Filedes.c
View file @
a77b6951
...
...
@@ -41,15 +41,15 @@ void printAtts(FILE *fp, int vlistID, int varID)
int
attint
[
MAXATT
];
double
attflt
[
MAXATT
];
vlist
InqNatts
(
vlistID
,
varID
,
&
natts
);
cdi
InqNatts
(
vlistID
,
varID
,
&
natts
);
for
(
int
ia
=
0
;
ia
<
natts
;
++
ia
)
{
vlist
InqAtt
(
vlistID
,
varID
,
ia
,
attname
,
&
atttype
,
&
attlen
);
cdi
InqAtt
(
vlistID
,
varID
,
ia
,
attname
,
&
atttype
,
&
attlen
);
if
(
atttype
==
DATATYPE_INT
)
{
if
(
attlen
>
MAXATT
)
attlen
=
MAXATT
;
vlist
InqAttInt
(
vlistID
,
varID
,
attname
,
attlen
,
attint
);
cdi
InqAttInt
(
vlistID
,
varID
,
attname
,
attlen
,
attint
);
fprintf
(
fp
,
" %s="
,
attname
);
for
(
int
i
=
0
;
i
<
attlen
;
++
i
)
{
...
...
@@ -61,7 +61,7 @@ void printAtts(FILE *fp, int vlistID, int varID)
else
if
(
atttype
==
DATATYPE_FLT
)
{
if
(
attlen
>
MAXATT
)
attlen
=
MAXATT
;
vlist
InqAttFlt
(
vlistID
,
varID
,
attname
,
MAXATT
,
attflt
);
cdi
InqAttFlt
(
vlistID
,
varID
,
attname
,
MAXATT
,
attflt
);
fprintf
(
fp
,
" %s="
,
attname
);
for
(
int
i
=
0
;
i
<
attlen
;
++
i
)
{
...
...
@@ -72,7 +72,7 @@ void printAtts(FILE *fp, int vlistID, int varID)
}
else
if
(
atttype
==
DATATYPE_TXT
)
{
vlist
InqAttTxt
(
vlistID
,
varID
,
attname
,
sizeof
(
atttxt
),
atttxt
);
cdi
InqAttTxt
(
vlistID
,
varID
,
attname
,
sizeof
(
atttxt
),
atttxt
);
atttxt
[
attlen
]
=
0
;
fprintf
(
fp
,
" %s=
\"
%s
\"\n
"
,
attname
,
atttxt
);
}
...
...
@@ -120,7 +120,7 @@ void partab(FILE *fp, int streamID, int option)
if
(
option
==
2
)
{
int
natts
;
vlist
InqNatts
(
vlistID
,
CDI_GLOBAL
,
&
natts
);
cdi
InqNatts
(
vlistID
,
CDI_GLOBAL
,
&
natts
);
if
(
natts
>
0
)
{
fprintf
(
fp
,
"¶meter
\n
"
);
...
...
src/Importcmsaf.c
View file @
a77b6951
...
...
@@ -1315,17 +1315,17 @@ void get_global_att(hid_t file_id, const char *obj_path, int vlistID)
if
(
type_class
==
H5T_STRING
)
{
H5Aread
(
attr
,
atype_mem
,
attstring
);
vlist
DefAttTxt
(
vlistID
,
CDI_GLOBAL
,
attname
,
(
int
)
strlen
(
attstring
),
attstring
);
cdi
DefAttTxt
(
vlistID
,
CDI_GLOBAL
,
attname
,
(
int
)
strlen
(
attstring
),
attstring
);
}
else
if
(
type_class
==
H5T_INTEGER
)
{
H5Aread
(
attr
,
H5T_NATIVE_INT
,
&
attint
);
vlist
DefAttInt
(
vlistID
,
CDI_GLOBAL
,
attname
,
DATATYPE_INT32
,
1
,
&
attint
);
cdi
DefAttInt
(
vlistID
,
CDI_GLOBAL
,
attname
,
DATATYPE_INT32
,
1
,
&
attint
);
}
else
if
(
type_class
==
H5T_FLOAT
)
{
H5Aread
(
attr
,
H5T_NATIVE_DOUBLE
,
&
attflt
);
vlist
DefAttFlt
(
vlistID
,
CDI_GLOBAL
,
attname
,
DATATYPE_FLT64
,
1
,
&
attflt
);
cdi
DefAttFlt
(
vlistID
,
CDI_GLOBAL
,
attname
,
DATATYPE_FLT64
,
1
,
&
attflt
);
}
H5Tclose
(
atype_mem
);
H5Aclose
(
attr
);
...
...
@@ -1345,17 +1345,17 @@ int get_vdate(int vlistID)
char
name
[
CDI_MAX_NAME
];
char
attstr
[
CDI_MAX_NAME
];
vlist
InqNatts
(
vlistID
,
CDI_GLOBAL
,
&
natts
);
cdi
InqNatts
(
vlistID
,
CDI_GLOBAL
,
&
natts
);
for
(
i
=
0
;
i
<
natts
;
++
i
)
{
vlist
InqAtt
(
vlistID
,
CDI_GLOBAL
,
i
,
name
,
&
type
,
&
len
);
cdi
InqAtt
(
vlistID
,
CDI_GLOBAL
,
i
,
name
,
&
type
,
&
len
);
if
(
type
==
DATATYPE_TXT
)
{
if
(
strcmp
(
name
,
"DateAndTime"
)
==
0
||
strcmp
(
name
,
"Date_Time"
)
==
0
)
{
vlist
InqAttTxt
(
vlistID
,
CDI_GLOBAL
,
name
,
CDI_MAX_NAME
,
attstr
);
cdi
InqAttTxt
(
vlistID
,
CDI_GLOBAL
,
name
,
CDI_MAX_NAME
,
attstr
);
if
(
len
>
8
)
len
=
8
;
attstr
[
len
]
=
0
;
vdate
=
atoi
(
attstr
);
...
...
@@ -1538,7 +1538,7 @@ void *Importcmsaf(void *argument)
if
(
dsets
.
obj
[
ivar
].
units
)
vlistDefVarUnits
(
vlistID
,
varID
,
dsets
.
obj
[
ivar
].
units
);
if
(
dsets
.
obj
[
ivar
].
title
)
vlist
DefAttTxt
(
vlistID
,
varID
,
"title"
,
(
int
)
strlen
(
dsets
.
obj
[
ivar
].
title
),
cdi
DefAttTxt
(
vlistID
,
varID
,
"title"
,
(
int
)
strlen
(
dsets
.
obj
[
ivar
].
title
),
dsets
.
obj
[
ivar
].
title
);
/*
...
...
src/Setgatt.c
View file @
a77b6951
...
...
@@ -75,7 +75,7 @@ void *Setgatt(void *argument)
if
(
operatorID
==
SETGATT
)
{
vlist
DefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
attname
,
(
int
)
strlen
(
attstring
),
attstring
);
cdi
DefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
attname
,
(
int
)
strlen
(
attstring
),
attstring
);
}
else
{
...
...
@@ -111,7 +111,7 @@ void *Setgatt(void *argument)
}
if
(
attstring
&&
attlen
)
vlist
DefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
attname
,
attlen
,
attstring
);
cdi
DefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
attname
,
attlen
,
attstring
);
}
fclose
(
fp
);
...
...
src/Setmiss.c
View file @
a77b6951
...
...
@@ -124,7 +124,7 @@ void *Setmiss(void *argument)
nvars = vlistNvars(vlistID2);
for ( varID = 0; varID < nvars; varID++ )
vlist
DefAttFlt(vlistID2, varID, "valid_range", DATATYPE_FLT64, 2, range);
cdi
DefAttFlt(vlistID2, varID, "valid_range", DATATYPE_FLT64, 2, range);
}
*/
int
streamID2
=
streamOpenWrite
(
cdoStreamName
(
1
),
cdoFiletype
());
...
...
src/Setpartab.c
View file @
a77b6951
...
...
@@ -207,7 +207,7 @@ static
void
defineVarAttText
(
int
vlistID2
,
int
varID
,
const
char
*
attname
,
const
char
*
atttext
)
{
int
len
=
strlen
(
atttext
);
vlist
DefAttTxt
(
vlistID2
,
varID
,
attname
,
len
,
atttext
);
cdi
DefAttTxt
(
vlistID2
,
varID
,
attname
,
len
,
atttext
);
}
static
...
...
src/Timstat.c
View file @
a77b6951
...
...
@@ -192,7 +192,7 @@ void *Timstat(void *argument)
if
(
comparelen
==
DAY_LEN
)
freq
=
"day"
;
else
if
(
comparelen
==
MON_LEN
)
freq
=
"mon"
;
else
if
(
comparelen
==
YEAR_LEN
)
freq
=
"year"
;
if
(
freq
)
vlist
DefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
"frequency"
,
(
int
)
strlen
(
freq
),
freq
);
if
(
freq
)
cdi
DefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
"frequency"
,
(
int
)
strlen
(
freq
),
freq
);
int
streamID2
=
streamOpenWrite
(
cdoStreamName
(
1
),
cdoFiletype
());
...
...
src/XTimstat.c
View file @
a77b6951
...
...
@@ -252,7 +252,7 @@ void *XTimstat(void *argument)
if
(
comparelen
==
DAY_LEN
)
freq
=
"day"
;
else
if
(
comparelen
==
MON_LEN
)
freq
=
"mon"
;
else
if
(
comparelen
==
YEAR_LEN
)
freq
=
"year"
;
if
(
freq
)
vlist
DefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
"frequency"
,
(
int
)
strlen
(
freq
),
freq
);
if
(
freq
)
cdi
DefAttTxt
(
vlistID2
,
CDI_GLOBAL
,
"frequency"
,
(
int
)
strlen
(
freq
),
freq
);
int
streamID2
=
streamOpenWrite
(
cdoStreamName
(
1
),
cdoFiletype
());
...
...
src/cdo_history.c
View file @
a77b6951
...
...
@@ -122,7 +122,7 @@ void cdoDefHistory(int fileID, char *histstring)
void
cdo_def_creation_date
(
int
vlistID
)
{
if
(
strlen
(
datetimestr
)
==
0
)
init_strtime
();
vlist
DefAttTxt
(
vlistID
,
CDI_GLOBAL
,
"creation_date"
,
(
int
)
strlen
(
datetimestr
),
datetimestr
);
cdi
DefAttTxt
(
vlistID
,
CDI_GLOBAL
,
"creation_date"
,
(
int
)
strlen
(
datetimestr
),
datetimestr
);
}
...
...
@@ -141,5 +141,5 @@ void cdo_def_tracking_id(int vlistID, const char *uuid_attribute)
{
char
uuidstr
[
UUIDSTR_SIZE
];
get_uuid
(
uuidstr
);
vlist
DefAttTxt
(
vlistID
,
CDI_GLOBAL
,
uuid_attribute
,
UUIDSTR_SIZE
,
uuidstr
);
cdi
DefAttTxt
(
vlistID
,
CDI_GLOBAL
,
uuid_attribute
,
UUIDSTR_SIZE
,
uuidstr
);
}
src/grid.c
View file @
a77b6951
...
...
@@ -498,7 +498,7 @@ void grid_def_param_sinu(int gridID)
const
char
*
mapvarname
=
"Sinusoidal"
;
cdiGridDefKeyStr
(
gridID
,
CDI_KEY_MAPNAME
,
(
int
)
strlen
(
mapvarname
)
+
1
,
mapvarname
);
vlist
DefAttTxt
(
gridID
,
CDI_GLOBAL
,
"grid_mapping_name"
,
(
int
)
strlen
(
projection
),
projection
);
cdi
DefAttTxt
(
gridID
,
CDI_GLOBAL
,
"grid_mapping_name"
,
(
int
)
strlen
(
projection
),
projection
);
}
...
...
@@ -509,11 +509,11 @@ void grid_def_param_laea(int gridID, double a, double lon_0, double lat_0)
const
char
*
mapvarname
=
"Lambert_AEA"
;
cdiGridDefKeyStr
(
gridID
,
CDI_KEY_MAPNAME
,
(
int
)
strlen
(
mapvarname
)
+
1
,
mapvarname
);
vlist
DefAttTxt
(
gridID
,
CDI_GLOBAL
,
"grid_mapping_name"
,
(
int
)
strlen
(
projection
),
projection
);
cdi
DefAttTxt
(
gridID
,
CDI_GLOBAL
,
"grid_mapping_name"
,
(
int
)
strlen
(
projection
),
projection
);
vlist
DefAttFlt
(
gridID
,
CDI_GLOBAL
,
"earth_radius"
,
DATATYPE_FLT64
,
1
,
&
a
);
vlist
DefAttFlt
(
gridID
,
CDI_GLOBAL
,
"longitude_of_projection_origin"
,
DATATYPE_FLT64
,
1
,
&
lon_0
);
vlist
DefAttFlt
(
gridID
,
CDI_GLOBAL
,
"latitude_of_projection_origin"
,
DATATYPE_FLT64
,
1
,
&
lat_0
);
cdi
DefAttFlt
(
gridID
,
CDI_GLOBAL
,
"earth_radius"
,
DATATYPE_FLT64
,
1
,
&
a
);
cdi
DefAttFlt
(
gridID
,
CDI_GLOBAL
,
"longitude_of_projection_origin"
,
DATATYPE_FLT64
,
1
,
&
lon_0
);
cdi
DefAttFlt
(
gridID
,
CDI_GLOBAL
,
"latitude_of_projection_origin"
,
DATATYPE_FLT64
,
1
,
&
lat_0
);
}
static
...
...
@@ -535,18 +535,18 @@ void grid_inq_param_laea(int gridID, double *a, double *lon_0, double *lat_0)
char
attname
[
CDI_MAX_NAME
+
1
];
int
natts
;
vlist
InqNatts
(
gridID
,
CDI_GLOBAL
,
&
natts
);
cdi
InqNatts
(
gridID
,
CDI_GLOBAL
,
&
natts
);
for
(
int
iatt
=
0
;
iatt
<
natts
;
++
iatt
)
{
vlist
InqAtt
(
gridID
,
CDI_GLOBAL
,
iatt
,
attname
,
&
atttype
,
&
attlen
);
cdi
InqAtt
(
gridID
,
CDI_GLOBAL
,
iatt
,
attname
,
&
atttype
,
&
attlen
);
if
(
attlen
!=
1
)
continue
;
if
(
atttype
==
DATATYPE_FLT32
||
atttype
==
DATATYPE_FLT64
)
{
double
attflt
;
vlist
InqAttFlt
(
gridID
,
CDI_GLOBAL
,
attname
,
attlen
,
&
attflt
);
cdi
InqAttFlt
(
gridID
,
CDI_GLOBAL
,
attname
,
attlen
,
&
attflt
);
if
(
strcmp
(
attname
,
"earth_radius"
)
==
0
)
*
a
=
attflt
;
else
if
(
strcmp
(
attname
,
"longitude_of_projection_origin"
)
==
0
)
*
lon_0
=
attflt
;
else
if
(
strcmp
(
attname
,
"latitude_of_projection_origin"
)
==
0
)
*
lat_0
=
attflt
;
...
...
@@ -577,18 +577,18 @@ void grid_inq_param_lcc(int gridID, double *a, double *lon_0, double *lat_0, dou
char
attname
[
CDI_MAX_NAME
+
1
];
int
natts
;
vlist
InqNatts
(
gridID
,
CDI_GLOBAL
,
&
natts
);
cdi
InqNatts
(
gridID
,
CDI_GLOBAL
,
&
natts
);
for
(
int
iatt
=
0
;
iatt
<
natts
;
++
iatt
)
{
vlist
InqAtt
(
gridID
,
CDI_GLOBAL
,
iatt
,
attname
,
&
atttype
,
&
attlen
);
cdi
InqAtt
(
gridID
,
CDI_GLOBAL
,
iatt
,
attname
,
&
atttype
,
&
attlen
);
if
(
attlen
>
2
)
continue
;
if
(
atttype
==
DATATYPE_FLT32
||
atttype
==
DATATYPE_FLT64
)
{
double
attflt
[
2
];
vlist
InqAttFlt
(
gridID
,
CDI_GLOBAL
,
attname
,
attlen
,
attflt
);
cdi
InqAttFlt
(
gridID
,
CDI_GLOBAL
,
attname
,
attlen
,
attflt
);
if
(
strcmp
(
attname
,
"earth_radius"
)
==
0
)
*
a
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"longitude_of_central_meridian"
)
==
0
)
*
lon_0
=
attflt
[
0
];
else
if
(
strcmp
(
attname
,
"latitude_of_projection_origin"
)
==
0
)
*
lat_0
=
attflt
[
0
];
...
...
src/griddes.c
View file @
a77b6951
...
...
@@ -1148,7 +1148,7 @@ int gridFromFile(FILE *gfp, const char *dname)
if
(
strcmp
(
attname
,
"grid_mapping_name"
)
==
0
)
cdiGridDefKeyStr
(
gridID
,
CDI_KEY_MAPPING
,
(
int
)
strlen
(
atttxt
)
+
1
,
atttxt
);
vlist
DefAttTxt
(
gridID
,
CDI_GLOBAL
,
attname
,
(
int
)
strlen
(
atttxt
),
atttxt
);
cdi
DefAttTxt
(
gridID
,
CDI_GLOBAL
,
attname
,
(
int
)
strlen
(
atttxt
),
atttxt
);
}
else
if
(
cmpstrlen
(
pline
,
"ATTR_INT_"
,
len
)
==
0
)
{
...
...
@@ -1158,7 +1158,7 @@ int gridFromFile(FILE *gfp, const char *dname)
double
*
attflt
=
(
double
*
)
Malloc
(
attlen
*
sizeof
(
double
));
read_field
(
"attint"
,
pline
,
attlen
,
attflt
,
&
lineno
,
gfp
,
dname
);
for
(
int
i
=
0
;
i
<
attlen
;
++
i
)
attint
[
i
]
=
(
int
)
lround
(
attflt
[
i
]);
vlist
DefAttInt
(
gridID
,
CDI_GLOBAL
,
attname
,
DATATYPE_INT32
,
attlen
,
attint
);
cdi
DefAttInt
(
gridID
,
CDI_GLOBAL
,
attname
,
DATATYPE_INT32
,
attlen
,
attint
);
free
(
attint
);
free
(
attflt
);
}
...
...
@@ -1168,7 +1168,7 @@ int gridFromFile(FILE *gfp, const char *dname)
double
*
attflt
=
(
double
*
)
Malloc
(
attlen
*
sizeof
(
double
));
read_field
(
"attflt"
,
pline
,
attlen
,
attflt
,
&
lineno
,
gfp
,
dname
);
vlist
DefAttFlt
(
gridID
,
CDI_GLOBAL
,
attname
,
DATATYPE_FLT64
,
attlen
,
attflt
);
cdi
DefAttFlt
(
gridID
,
CDI_GLOBAL
,
attname
,
DATATYPE_FLT64
,
attlen
,
attflt
);
free
(
attflt
);
}
else
...
...
src/pstream.c
View file @
a77b6951
...
...
@@ -1107,11 +1107,11 @@ void pstreamDefVlist(int pstreamID, int vlistID)
}
if
(
CDO_Version_Info
)
vlist
DefAttTxt
(
vlistID
,
CDI_GLOBAL
,
"CDO"
,
(
int
)
strlen
(
cdoComment
()),
cdoComment
());
cdi
DefAttTxt
(
vlistID
,
CDI_GLOBAL
,
"CDO"
,
(
int
)
strlen
(
cdoComment
()),
cdoComment
());
#if defined(_OPENMP)
if
(
ompNumThreads
>
1
)
vlist
DefAttInt
(
vlistID
,
CDI_GLOBAL
,
"cdo_openmp_thread_number"
,
DATATYPE_INT32
,
1
,
&
ompNumThreads
);
cdi
DefAttInt
(
vlistID
,
CDI_GLOBAL
,
"cdo_openmp_thread_number"
,
DATATYPE_INT32
,
1
,
&
ompNumThreads
);
#endif
pstreamDefVarlist
(
pstreamptr
,
vlistID
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a 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