Commit 5f9a8c5f authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Renamed _CDI_LIMITS_H to CDI_LIMITS_H.

parent c0f9ebad
......@@ -809,7 +809,17 @@ int gridInqYIsc(int gridID);
/* gridInqYCvals: Get strings from Y-axis in case grid is of type GRID_CHARXY */
size_t gridInqYCvals(int gridID, char *ycvals[]);
/* CDI grid string key values */
// CDI var key values
#define CDI_KEY_TABLESVERSION 801 // GRIB2 tablesVersion
#define CDI_KEY_LOCALTABLESVERSION 802 // GRIB2 localTablesVersion
// cdiDefKeyInt: Define a CDI varianble integer value from a key
int cdiDefKeyInt(int cdiID, int varID, int key, int value);
// cdiInqKeyInt: Get a CDI variable integer value from a key
int cdiInqKeyInt(int cdiID, int varID, int key, int *value);
// CDI grid key values
#define CDI_KEY_XNAME 901 // X-axis name
#define CDI_KEY_XDIMNAME 902 // X-axis dimension name
#define CDI_KEY_XLONGNAME 903 // X-axis longname
......@@ -822,7 +832,7 @@ size_t gridInqYCvals(int gridID, char *ycvals[]);
#define CDI_KEY_MAPPING 921 // Grid mapping var name
#define CDI_KEY_MAPNAME 922 // Grid mapping name
/* CDI zaxis string key values */
// CDI zaxis key values
#define CDI_KEY_NAME 941 // Z-axis name
#define CDI_KEY_DIMNAME 942 // Z-axis dimension name
#define CDI_KEY_LONGNAME 943 // Z-axis longname
......@@ -831,12 +841,20 @@ size_t gridInqYCvals(int gridID, char *ycvals[]);
#define CDI_KEY_P0NAME 951 // Z-axis reference pressure name
#define CDI_KEY_P0VALUE 952 // Z-axis reference pressure in Pa
// CDI var key values
// cdiGridDefKeyStr: Define a CDI grid string value from a key
int cdiGridDefKeyStr(int gridID, int key, int size, const char *mesg);
// cdiGridInqKeyStr: Get a CDI grid string value from a key
int cdiGridInqKeyStr(int gridID, int key, int size, char *mesg);
// cdiZaxisDefKeyStr: Define a CDI Z-axis string value from a key
int cdiZaxisDefKeyStr(int zaxisID, int key, int size, const char *mesg);
// cdiZaxisInqKeyStr: Get a CDI Z-axis string value from a key
int cdiZaxisInqKeyStr(int zaxisID, int key, int size, char *mesg);
// cdiZaxisDefKeyFlt: Define a CDI Z-axis floating point value from a key
int cdiZaxisDefKeyFlt(int zaxisID, int key, double value);
......@@ -1047,12 +1065,6 @@ void zaxisDefUUID(int zaxisID, const unsigned char uuid[CDI_UUID_SIZE]);
/* zaxisInqUUID: Get the UUID of a generalized Z-axis */
void zaxisInqUUID(int zaxisID, unsigned char uuid[CDI_UUID_SIZE]);
// cdiZaxisDefKeyStr: Define a CDI Z-axis string value from a key
int cdiZaxisDefKeyStr(int zaxisID, int key, int size, const char *mesg);
// cdiZaxisInqKeyStr: Get a CDI Z-axis string value from a key
int cdiZaxisInqKeyStr(int zaxisID, int key, int size, char *mesg);
/* zaxisDefName: Define the name of a Z-axis */
void zaxisDefName(int zaxisID, const char *name_optional);
......
#ifndef CDI_ATT_H
#define CDI_ATT_H
#ifndef CDI_ATT_H
#define CDI_ATT_H
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef _CDI_LIMITS_H
#ifndef CDI_LIMITS_H
#include "cdi_limits.h"
#endif
......
......@@ -55,7 +55,7 @@ char *strdup(const char *s);
#ifndef _TAXIS_H
# include "taxis.h"
#endif
#ifndef _CDI_LIMITS_H
#ifndef CDI_LIMITS_H
# include "cdi_limits.h"
#endif
#ifndef _SERVICE_H
......
#ifndef _CDI_LIMITS_H
#define _CDI_LIMITS_H
#ifndef CDI_LIMITS_H
#define CDI_LIMITS_H
#define MAX_GRIDS_PS 128 /* maximum number of different grids per stream */
#define MAX_ZAXES_PS 128 /* maximum number of different zaxes per stream */
#define MAX_ATTRIBUTES 256 /* maximum number of attributes per variable */
#define MAX_SUBTYPES_PS 128 /* maximum number of different subtypes per stream */
#endif /* _CDI_LIMITS_H */
#endif /* CDI_LIMITS_H */
/*
* Local Variables:
* c-file-style: "Java"
......
......@@ -401,14 +401,12 @@ void gribapiGetString(grib_handle *gh, const char *key, char *string, size_t len
}
static
void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
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,
const var_tile_t *tiles, int lread_additional_keys)
{
int levelID = 0;
char stdname[CDI_MAX_NAME], longname[CDI_MAX_NAME], units[CDI_MAX_NAME];
long ens_index = 0, ens_count = 0, ens_forecast_type = 0;
int vlistID = streamptr->vlistID;
int tsID = streamptr->curTsID;
......@@ -551,6 +549,7 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
// fprintf(stderr, "param %d name %s %s %s\n", param, name, longname, units);
/* add the previously read record data to the (intermediate) list of records */
int levelID = 0;
int tile_index = 0, varID;
varAddRecord(recID, param, gridID, zaxistype, lbounds, level1, level2, level_sf, level_unit,
datatype, &varID, &levelID, tsteptype, numavg, leveltype1, leveltype2,
......@@ -565,15 +564,27 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
Get the ensemble Info from the grib-2 Tables and update the intermediate datastructure.
Further update to the "vlist" is handled in the same way as for GRIB-1 by "cdi_generate_vars"
*/
long ens_index = 0, ens_count = 0, ens_forecast_type = 0;
if ( grib_get_long(gh, "typeOfEnsembleForecast", &ens_forecast_type) == 0 )
{
GRIB_CHECK(grib_get_long(gh, "numberOfForecastsInEnsemble", &ens_count ), 0);
GRIB_CHECK(grib_get_long(gh, "perturbationNumber", &ens_index ), 0);
GRIB_CHECK(grib_get_long(gh, "numberOfForecastsInEnsemble", &ens_count), 0);
GRIB_CHECK(grib_get_long(gh, "perturbationNumber", &ens_index), 0);
}
if ( ens_index > 0 )
varDefEnsembleInfo(varID, (int)ens_index, (int)ens_count, (int)ens_forecast_type);
/*
long tablesVersion = 0;
if ( grib_get_long(gh, "tablesVersion", &tablesVersion) == 0 )
printf("tablesVersion %ld\n", tablesVersion);
// varDefTablesVersion(varID, (int) tablesVersion);
long localTablesVersion = 0;
if ( grib_get_long(gh, "localTablesVersion", &localTablesVersion) == 0 )
printf("localTablesVersion %ld\n", localTablesVersion);
//varDefLocalTablesVersion(varID, (int) localTablesVersion);
*/
long typeOfGeneratingProcess = 0;
if ( grib_get_long(gh, "typeOfGeneratingProcess", &typeOfGeneratingProcess) == 0 )
varDefTypeOfGeneratingProcess(varID, (int) typeOfGeneratingProcess);
......@@ -582,18 +593,19 @@ void gribapiAddRecord(stream_t * streamptr, int param, grib_handle *gh,
if ( grib_get_long(gh, "productDefinitionTemplateNumber", &productDefinitionTemplate) == 0 )
varDefProductDefinitionTemplate(varID, (int) productDefinitionTemplate);
long lval;
double dval;
if (lread_additional_keys)
for ( int i = 0; i < cdiNAdditionalGRIBKeys; i++ )
{
/* note: if the key is not defined, we do not throw an error! */
if ( grib_get_long(gh, cdiAdditionalGRIBKeys[i], &lval) == 0 )
varDefOptGribInt(varID, tile_index, lval, cdiAdditionalGRIBKeys[i]);
if ( grib_get_double(gh, cdiAdditionalGRIBKeys[i], &dval) == 0 )
varDefOptGribDbl(varID, tile_index, dval, cdiAdditionalGRIBKeys[i]);
}
{
long lval;
double dval;
for ( int i = 0; i < cdiNAdditionalGRIBKeys; i++ )
{
/* note: if the key is not defined, we do not throw an error! */
if ( grib_get_long(gh, cdiAdditionalGRIBKeys[i], &lval) == 0 )
varDefOptGribInt(varID, tile_index, lval, cdiAdditionalGRIBKeys[i]);
if ( grib_get_double(gh, cdiAdditionalGRIBKeys[i], &dval) == 0 )
varDefOptGribDbl(varID, tile_index, dval, cdiAdditionalGRIBKeys[i]);
}
}
if ( varInqInst(varID) == CDI_UNDEFID )
{
......
#ifndef _VLIST_H
#define _VLIST_H
#ifndef VLIST_H
#define VLIST_H
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
......@@ -11,7 +11,7 @@
#include <stddef.h> /* size_t */
#ifndef _CDI_LIMITS_H
#ifndef CDI_LIMITS_H
#include "cdi_limits.h"
#endif
......@@ -216,7 +216,7 @@ const
#endif
resOps vlistOps;
#endif /* _VLIST_H */
#endif /* VLIST_H */
/*
* Local Variables:
* c-file-style: "Java"
......
#ifndef VLIST_VAR_H
#define VLIST_VAR_H
#ifndef VLIST_VAR_H
#define VLIST_VAR_H
#ifdef HAVE_CONFIG_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#ifndef _VLIST_H
#ifndef VLIST_H
#include "vlist.h"
#endif
......
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