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

added support for GRIB_API key cfName

parent 532a7131
......@@ -4,6 +4,10 @@
* using EXSE library version 1.3.2
* using CGRIBEX library version 1.6.4
2014-05-11 Uwe Schulzweida
* added support for GRIB_API key cfName
2014-04-10 Uwe Schulzweida
* varscan::cmpparam: apply patch from Thomas Jahns
......
......@@ -408,7 +408,7 @@ void cgribexAddRecord(stream_t * streamptr, int param, int *isec1, int *isec2, d
if ( datatype < 0 ) datatype = DATATYPE_PACK;
varAddRecord(recID, param, gridID, zaxistype, lbounds, level1, level2, 0, 0,
datatype, &varID, &levelID, tsteptype, numavg, ISEC1_LevelType, NULL, NULL, NULL);
datatype, &varID, &levelID, tsteptype, numavg, ISEC1_LevelType, NULL, NULL, NULL, NULL);
(*record).varID = varID;
(*record).levelID = levelID;
......@@ -491,7 +491,7 @@ void MCH_get_undef(int *isec1, double *undef_pds, double *undef_eps)
static
void cgribexDecodeHeader(int *isec0, int *isec1, int *isec2, double *fsec2,
int *isec3, double *fsec3, int *isec4, double *fsec4,
int *isec3, double *fsec3, int *isec4, double *fsec4,
int *gribbuffer, int recsize, int *lmv, int *iret)
{
int ipunp = 0, iword = 0;
......
......@@ -276,7 +276,7 @@ void extAddRecord(stream_t *streamptr, int param, int level, int xysize,
leveltype = ZAXIS_GENERIC;
varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0,
extInqDatatype(prec, number), &varID, &levelID, UNDEFID, 0, 0, NULL, NULL, NULL);
extInqDatatype(prec, number), &varID, &levelID, UNDEFID, 0, 0, NULL, NULL, NULL, NULL);
(*record).varID = varID;
(*record).levelID = levelID;
......
......@@ -834,7 +834,7 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
int vlistID;
long lpar;
int status;
char longname[256], units[256];
char stdname[CDI_MAX_NAME], longname[CDI_MAX_NAME], units[CDI_MAX_NAME];
size_t vlen;
long ens_index = 0, ens_count = 0, ens_forecast_type = 0;
......@@ -913,21 +913,28 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
// if ( datatype > 32 ) datatype = DATATYPE_PACK32;
if ( datatype < 0 ) datatype = DATATYPE_PACK;
stdname[0] = 0;
longname[0] = 0;
units[0] = 0;
if ( varname[0] != 0 )
{
vlen = 256;
vlen = CDI_MAX_NAME;
gribapiGetString(gh, "name", longname, vlen);
vlen = 256;
vlen = CDI_MAX_NAME;
gribapiGetString(gh, "units", units, vlen);
{
vlen = CDI_MAX_NAME;
status = grib_get_string(gh, "cfName", stdname, &vlen);
if ( status != 0 || vlen <= 1 ) stdname[0] = 0;
}
}
// fprintf(stderr, "param %d name %s %s %s\n", param, name, longname, units);
varAddRecord(recID, param, gridID, zaxistype, lbounds, level1, level2, level_sf, level_unit,
datatype, &varID, &levelID, tsteptype, numavg, leveltype,
varname, longname, units);
varname, stdname, longname, units);
(*record).varID = varID;
(*record).levelID = levelID;
......
......@@ -770,7 +770,7 @@ void iegAddRecord(stream_t *streamptr, int param, int *pdb, int *gdb, double *vc
datatype = iegInqDatatype(prec);
varAddRecord(recID, param, gridID, leveltype, lbounds, level1, level2, 0, 0,
datatype, &varID, &levelID, UNDEFID, 0, 0, NULL, NULL, NULL);
datatype, &varID, &levelID, UNDEFID, 0, 0, NULL, NULL, NULL, NULL);
(*record).varID = varID;
(*record).levelID = levelID;
......
......@@ -277,7 +277,7 @@ void srv_add_record(stream_t *streamptr, int param, int level, int xsize, int ys
datatype = srvInqDatatype(prec);
varAddRecord(recID, param, gridID, leveltype, 0, level, 0, 0, 0,
datatype, &varID, &levelID, UNDEFID, 0, 0, NULL, NULL, NULL);
datatype, &varID, &levelID, UNDEFID, 0, 0, NULL, NULL, NULL, NULL);
(*record).varID = varID;
(*record).levelID = levelID;
......
......@@ -61,6 +61,7 @@ typedef struct
int lmissval;
double missval;
char *name;
char *stdname;
char *longname;
char *units;
ensinfo_t *ensdata;
......@@ -111,6 +112,7 @@ void paramInitEntry(int varID, int param)
vartable[varID].lmissval = 0;
vartable[varID].missval = 0;
vartable[varID].name = NULL;
vartable[varID].stdname = NULL;
vartable[varID].longname = NULL;
vartable[varID].units = NULL;
vartable[varID].ensdata = NULL;
......@@ -152,6 +154,7 @@ void varFree(void)
free(vartable[varID].levelTable);
if ( vartable[varID].name ) free(vartable[varID].name);
if ( vartable[varID].stdname ) free(vartable[varID].stdname);
if ( vartable[varID].longname ) free(vartable[varID].longname);
if ( vartable[varID].units ) free(vartable[varID].units);
if ( vartable[varID].ensdata ) free(vartable[varID].ensdata);
......@@ -314,7 +317,7 @@ int paramNewEntry(int param)
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 ltype,
const char *name, const char *longname, const char *units)
const char *name, const char *stdname, const char *longname, const char *units)
{
int varID = UNDEFID;
int levelID = -1;
......@@ -336,6 +339,7 @@ void varAddRecord(int recID, int param, int gridID, int zaxistype, int lbounds,
if ( numavg ) vartable[varID].timave = 1;
if ( name ) if ( name[0] ) vartable[varID].name = strdup(name);
if ( stdname ) if ( stdname[0] ) vartable[varID].stdname = strdup(stdname);
if ( longname ) if ( longname[0] ) vartable[varID].longname = strdup(longname);
if ( units ) if ( units[0] ) vartable[varID].units = strdup(units);
}
......@@ -431,6 +435,7 @@ int cmpparam(const void* s1, const void* s2)
return (cmp);
}
void cdi_generate_vars(stream_t *streamptr)
{
int varID, gridID, zaxisID, levelID;
......@@ -604,6 +609,7 @@ void cdi_generate_vars(stream_t *streamptr)
if ( vartable[varid].lmissval ) vlistDefVarMissval(vlistID, varID, vartable[varid].missval);
if ( vartable[varid].name ) vlistDefVarName(vlistID, varID, vartable[varid].name);
if ( vartable[varid].stdname ) vlistDefVarStdname(vlistID, varID, vartable[varid].stdname);
if ( vartable[varid].longname ) vlistDefVarLongname(vlistID, varID, vartable[varid].longname);
if ( vartable[varid].units ) vlistDefVarUnits(vlistID, varID, vartable[varid].units);
......
......@@ -9,7 +9,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 ltype,
const char *name, const char *longname, const char *units);
const char *name, const char *stdname, const char *longname, const char *units);
void varDefVCT(size_t vctsize, double *vctptr);
void varDefZAxisReference(int nlev, int nvgrid, char *uuid);
......
Markdown is supported
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