Commit 21c2a762 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

GRIB2: added support for inventory key typeOfGeneratingProcess.

parent 340d9ee0
2019-02-27 Uwe Schulzweida
* GRIB2: added support for inventory key typeOfGeneratingProcess
2019-02-20 Uwe Schulzweida
* uvRelativeToGrid: changed flag from grid to variable
......
......@@ -151,13 +151,13 @@ typedef struct {
typedef struct {
short perturbationNumber;
//short typeOfGeneratingProcess;
short typeOfGeneratingProcess;
} VarScanKeys;
static inline void
varScanKeysInit(VarScanKeys *scanKeys)
varScanKeysInit(VarScanKeys *s)
{
memset(scanKeys, 0, sizeof(VarScanKeys));
memset(s, 0, sizeof(VarScanKeys));
}
static inline bool
......
......@@ -422,6 +422,23 @@ int gribapiGetEnsembleInfo(grib_handle *gh, long *typeOfEnsembleForecast, long *
return status;
}
static
VarScanKeys gribapiGetScanKeys(grib_handle *gh)
{
VarScanKeys scanKeys;
varScanKeysInit(&scanKeys);
long typeOfEnsembleForecast = 0, numberOfForecastsInEnsemble = 0, perturbationNumber = 0;
gribapiGetEnsembleInfo(gh, &typeOfEnsembleForecast, &numberOfForecastsInEnsemble, &perturbationNumber);
scanKeys.perturbationNumber = (short)perturbationNumber;
long typeOfGeneratingProcess = 0;
if (grib_get_long(gh, "typeOfGeneratingProcess", &typeOfGeneratingProcess) == 0)
scanKeys.typeOfGeneratingProcess = (short)typeOfGeneratingProcess;
return scanKeys;
}
static
void gribapiGetKeys(grib_handle *gh, int varID)
{
......@@ -966,12 +983,7 @@ int gribapiScanTimestep1(stream_t * streamptr)
}
}
long typeOfEnsembleForecast = 0, numberOfForecastsInEnsemble = 0, perturbationNumber = 0;
gribapiGetEnsembleInfo(gh, &typeOfEnsembleForecast, &numberOfForecastsInEnsemble, &perturbationNumber);
VarScanKeys scanKeys;
varScanKeysInit(&scanKeys);
scanKeys.perturbationNumber = (short)perturbationNumber;
VarScanKeys scanKeys = gribapiGetScanKeys(gh);
if ( nrecs )
{
......@@ -1139,12 +1151,7 @@ int gribapiScanTimestep2(stream_t * streamptr)
.time = vtime
};
long typeOfEnsembleForecast = 0, numberOfForecastsInEnsemble = 0, perturbationNumber = 0;
gribapiGetEnsembleInfo(gh, &typeOfEnsembleForecast, &numberOfForecastsInEnsemble, &perturbationNumber);
VarScanKeys scanKeys;
varScanKeysInit(&scanKeys);
scanKeys.perturbationNumber = (short)perturbationNumber;
VarScanKeys scanKeys = gribapiGetScanKeys(gh);
int tsteptype = gribapiGetTsteptype(gh);
size_t gridsize = gribapiGetGridsize(gh);
......@@ -1324,17 +1331,9 @@ int gribapiScanTimestep(stream_t * streamptr)
datetime0.time = vtime;
}
DateTime datetime = {
.date = vdate,
.time = vtime
};
long typeOfEnsembleForecast = 0, numberOfForecastsInEnsemble = 0, perturbationNumber = 0;
gribapiGetEnsembleInfo(gh, &typeOfEnsembleForecast, &numberOfForecastsInEnsemble, &perturbationNumber);
DateTime datetime = { .date = vdate, .time = vtime };
VarScanKeys scanKeys;
varScanKeysInit(&scanKeys);
scanKeys.perturbationNumber = (short)perturbationNumber;
VarScanKeys scanKeys = gribapiGetScanKeys(gh);
int tsteptype = gribapiGetTsteptype(gh);
size_t gridsize = gribapiGetGridsize(gh);
......
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