Commit a77b6951 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Renamed vlistInqAtt/vlistDefAtt to cdiInqAtt/cdiDefAtt.

parent f4f5b726
......@@ -152,29 +152,29 @@ static void dump_global_attributes(struct kv **ht, int streamID)
{
int natts;
int vlistID = streamInqVlist(streamID);
vlistInqNatts(vlistID, CDI_GLOBAL, &natts);
cdiInqNatts(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;
vlistInqAtt(vlistID, CDI_GLOBAL, i, name, &type, &len);
cdiInqAtt(vlistID, CDI_GLOBAL, i, name, &type, &len);
switch ( type )
{
case DATATYPE_TXT:
value = Malloc(len + 1);
vlistInqAttTxt(vlistID, CDI_GLOBAL, name, len, value);
cdiInqAttTxt(vlistID, CDI_GLOBAL, name, len, value);
value[len] = '\0';
break;
case DATATYPE_INT32:
value = Malloc(CDI_MAX_NAME);
vlistInqAttInt(vlistID, CDI_GLOBAL, name, len, (int *)buffer);
cdiInqAttInt(vlistID, CDI_GLOBAL, name, len, (int *)buffer);
snprintf(value, CDI_MAX_NAME, "%i", *(int *)buffer);
break;
case DATATYPE_FLT64:
value = Malloc(CDI_MAX_NAME);
vlistInqAttFlt(vlistID, CDI_GLOBAL, name, len, (double *)buffer);
cdiInqAttFlt(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;
vlistInqNatts(vlistID, CDI_GLOBAL, &natts);
cdiInqNatts(vlistID, CDI_GLOBAL, &natts);
if ( natts > 0 )
old_historysize = (size_t) streamInqHistorySize(fileID);
else
......
......@@ -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]); */
vlistDefAttTxt(vlistID2, CDI_GLOBAL, atts.atxtname[iatt],
cdiDefAttTxt(vlistID2, CDI_GLOBAL, atts.atxtname[iatt],
(int)strlen(atts.atxtentry[iatt])+1, atts.atxtentry[iatt]);
}
......
......@@ -41,15 +41,15 @@ void printAtts(FILE *fp, int vlistID, int varID)
int attint[MAXATT];
double attflt[MAXATT];
vlistInqNatts(vlistID, varID, &natts);
cdiInqNatts(vlistID, varID, &natts);
for ( int ia = 0; ia < natts; ++ia )
{
vlistInqAtt(vlistID, varID, ia, attname, &atttype, &attlen);
cdiInqAtt(vlistID, varID, ia, attname, &atttype, &attlen);
if ( atttype == DATATYPE_INT )
{
if ( attlen > MAXATT ) attlen = MAXATT;
vlistInqAttInt(vlistID, varID, attname, attlen, attint);
cdiInqAttInt(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;
vlistInqAttFlt(vlistID, varID, attname, MAXATT, attflt);
cdiInqAttFlt(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 )
{
vlistInqAttTxt(vlistID, varID, attname, sizeof(atttxt), atttxt);
cdiInqAttTxt(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;
vlistInqNatts(vlistID, CDI_GLOBAL, &natts);
cdiInqNatts(vlistID, CDI_GLOBAL, &natts);
if ( natts > 0 )
{
fprintf(fp, "&parameter\n");
......
......@@ -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);
vlistDefAttTxt(vlistID, CDI_GLOBAL, attname, (int)strlen(attstring), attstring);
cdiDefAttTxt(vlistID, CDI_GLOBAL, attname, (int)strlen(attstring), attstring);
}
else if ( type_class == H5T_INTEGER )
{
H5Aread(attr, H5T_NATIVE_INT, &attint);
vlistDefAttInt(vlistID, CDI_GLOBAL, attname, DATATYPE_INT32, 1, &attint);
cdiDefAttInt(vlistID, CDI_GLOBAL, attname, DATATYPE_INT32, 1, &attint);
}
else if ( type_class == H5T_FLOAT )
{
H5Aread(attr, H5T_NATIVE_DOUBLE, &attflt);
vlistDefAttFlt(vlistID, CDI_GLOBAL, attname, DATATYPE_FLT64, 1, &attflt);
cdiDefAttFlt(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];
vlistInqNatts(vlistID, CDI_GLOBAL, &natts);
cdiInqNatts(vlistID, CDI_GLOBAL, &natts);
for ( i = 0; i < natts; ++i )
{
vlistInqAtt(vlistID, CDI_GLOBAL, i, name, &type, &len);
cdiInqAtt(vlistID, CDI_GLOBAL, i, name, &type, &len);
if ( type == DATATYPE_TXT )
{
if ( strcmp(name, "DateAndTime") == 0 ||
strcmp(name, "Date_Time") == 0 )
{
vlistInqAttTxt(vlistID, CDI_GLOBAL, name, CDI_MAX_NAME, attstr);
cdiInqAttTxt(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 )
vlistDefAttTxt(vlistID, varID, "title", (int)strlen(dsets.obj[ivar].title),
cdiDefAttTxt(vlistID, varID, "title", (int)strlen(dsets.obj[ivar].title),
dsets.obj[ivar].title);
/*
......
......@@ -75,7 +75,7 @@ void *Setgatt(void *argument)
if ( operatorID == SETGATT )
{
vlistDefAttTxt(vlistID2, CDI_GLOBAL, attname, (int)strlen(attstring), attstring);
cdiDefAttTxt(vlistID2, CDI_GLOBAL, attname, (int)strlen(attstring), attstring);
}
else
{
......@@ -111,7 +111,7 @@ void *Setgatt(void *argument)
}
if ( attstring && attlen)
vlistDefAttTxt(vlistID2, CDI_GLOBAL, attname, attlen, attstring);
cdiDefAttTxt(vlistID2, CDI_GLOBAL, attname, attlen, attstring);
}
fclose(fp);
......
......@@ -124,7 +124,7 @@ void *Setmiss(void *argument)
nvars = vlistNvars(vlistID2);
for ( varID = 0; varID < nvars; varID++ )
vlistDefAttFlt(vlistID2, varID, "valid_range", DATATYPE_FLT64, 2, range);
cdiDefAttFlt(vlistID2, varID, "valid_range", DATATYPE_FLT64, 2, range);
}
*/
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
......
......@@ -207,7 +207,7 @@ static
void defineVarAttText(int vlistID2, int varID, const char *attname, const char *atttext)
{
int len = strlen(atttext);
vlistDefAttTxt(vlistID2, varID, attname, len, atttext);
cdiDefAttTxt(vlistID2, varID, attname, len, atttext);
}
static
......
......@@ -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 ) vlistDefAttTxt(vlistID2, CDI_GLOBAL, "frequency", (int)strlen(freq), freq);
if ( freq ) cdiDefAttTxt(vlistID2, CDI_GLOBAL, "frequency", (int)strlen(freq), freq);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
......
......@@ -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 ) vlistDefAttTxt(vlistID2, CDI_GLOBAL, "frequency", (int)strlen(freq), freq);
if ( freq ) cdiDefAttTxt(vlistID2, CDI_GLOBAL, "frequency", (int)strlen(freq), freq);
int streamID2 = streamOpenWrite(cdoStreamName(1), cdoFiletype());
......
......@@ -122,7 +122,7 @@ void cdoDefHistory(int fileID, char *histstring)
void cdo_def_creation_date(int vlistID)
{
if ( strlen(datetimestr) == 0 ) init_strtime();
vlistDefAttTxt(vlistID, CDI_GLOBAL, "creation_date", (int)strlen(datetimestr), datetimestr);
cdiDefAttTxt(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);
vlistDefAttTxt(vlistID, CDI_GLOBAL, uuid_attribute, UUIDSTR_SIZE, uuidstr);
cdiDefAttTxt(vlistID, CDI_GLOBAL, uuid_attribute, UUIDSTR_SIZE, uuidstr);
}
......@@ -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);
vlistDefAttTxt(gridID, CDI_GLOBAL, "grid_mapping_name", (int)strlen(projection), projection);
cdiDefAttTxt(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);
vlistDefAttTxt(gridID, CDI_GLOBAL, "grid_mapping_name", (int)strlen(projection), projection);
cdiDefAttTxt(gridID, CDI_GLOBAL, "grid_mapping_name", (int)strlen(projection), projection);
vlistDefAttFlt(gridID, CDI_GLOBAL, "earth_radius", DATATYPE_FLT64, 1, &a);
vlistDefAttFlt(gridID, CDI_GLOBAL, "longitude_of_projection_origin", DATATYPE_FLT64, 1, &lon_0);
vlistDefAttFlt(gridID, CDI_GLOBAL, "latitude_of_projection_origin", DATATYPE_FLT64, 1, &lat_0);
cdiDefAttFlt(gridID, CDI_GLOBAL, "earth_radius", DATATYPE_FLT64, 1, &a);
cdiDefAttFlt(gridID, CDI_GLOBAL, "longitude_of_projection_origin", DATATYPE_FLT64, 1, &lon_0);
cdiDefAttFlt(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;
vlistInqNatts(gridID, CDI_GLOBAL, &natts);
cdiInqNatts(gridID, CDI_GLOBAL, &natts);
for ( int iatt = 0; iatt < natts; ++iatt )
{
vlistInqAtt(gridID, CDI_GLOBAL, iatt, attname, &atttype, &attlen);
cdiInqAtt(gridID, CDI_GLOBAL, iatt, attname, &atttype, &attlen);
if ( attlen != 1 ) continue;
if ( atttype == DATATYPE_FLT32 || atttype == DATATYPE_FLT64 )
{
double attflt;
vlistInqAttFlt(gridID, CDI_GLOBAL, attname, attlen, &attflt);
cdiInqAttFlt(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;
vlistInqNatts(gridID, CDI_GLOBAL, &natts);
cdiInqNatts(gridID, CDI_GLOBAL, &natts);
for ( int iatt = 0; iatt < natts; ++iatt )
{
vlistInqAtt(gridID, CDI_GLOBAL, iatt, attname, &atttype, &attlen);
cdiInqAtt(gridID, CDI_GLOBAL, iatt, attname, &atttype, &attlen);
if ( attlen > 2 ) continue;
if ( atttype == DATATYPE_FLT32 || atttype == DATATYPE_FLT64 )
{
double attflt[2];
vlistInqAttFlt(gridID, CDI_GLOBAL, attname, attlen, attflt);
cdiInqAttFlt(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];
......
......@@ -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);
vlistDefAttTxt(gridID, CDI_GLOBAL, attname, (int)strlen(atttxt), atttxt);
cdiDefAttTxt(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]);
vlistDefAttInt(gridID, CDI_GLOBAL, attname, DATATYPE_INT32, attlen, attint);
cdiDefAttInt(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);
vlistDefAttFlt(gridID, CDI_GLOBAL, attname, DATATYPE_FLT64, attlen, attflt);
cdiDefAttFlt(gridID, CDI_GLOBAL, attname, DATATYPE_FLT64, attlen, attflt);
free(attflt);
}
else
......
......@@ -1107,11 +1107,11 @@ void pstreamDefVlist(int pstreamID, int vlistID)
}
if ( CDO_Version_Info )
vlistDefAttTxt(vlistID, CDI_GLOBAL, "CDO", (int)strlen(cdoComment()), cdoComment());
cdiDefAttTxt(vlistID, CDI_GLOBAL, "CDO", (int)strlen(cdoComment()), cdoComment());
#if defined(_OPENMP)
if ( ompNumThreads > 1 )
vlistDefAttInt(vlistID, CDI_GLOBAL, "cdo_openmp_thread_number", DATATYPE_INT32, 1, &ompNumThreads);
cdiDefAttInt(vlistID, CDI_GLOBAL, "cdo_openmp_thread_number", DATATYPE_INT32, 1, &ompNumThreads);
#endif
pstreamDefVarlist(pstreamptr, vlistID);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment