Commit 8f2cef35 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

gribapiDefTime: adjust reference time if necessary (bug fix).

parent 6562b5b2
......@@ -3,6 +3,10 @@
* using CGRIBEX library version 1.9.4
* Version 1.9.8 released
2019-09-06 Uwe Schulzweida
* gribapiDefTime: adjust reference time if necessary (bug fix) [report: Helmut Haak]
2019-08-28 Uwe Schulzweida
* find_leadtime() bug fix
......
......@@ -746,8 +746,8 @@ int cgribexScanTimestep1(stream_t *streamptr)
unsigned nrecs = 0;
while (true)
{
size_t recsize = gribGetSize(fileID);
recpos = fileGetPos(fileID);
const size_t recsize = gribGetSize(fileID);
recpos = fileGetPos(fileID);
if ( recsize == 0 )
{
......@@ -854,7 +854,7 @@ int cgribexScanTimestep1(stream_t *streamptr)
taxis->unit = tunit;
taxis->type = fcast ? TAXIS_RELATIVE : TAXIS_ABSOLUTE;
int taxisID = taxisCreate(taxis->type);
const int taxisID = taxisCreate(taxis->type);
taxis->rdate = rdate;
taxis->rtime = rtime;
taxis->vdate = (int64_t)datetime0.date;
......@@ -916,7 +916,7 @@ int cgribexScanTimestep2(stream_t * streamptr)
{
if ( rindex > nrecords ) break;
size_t recsize = gribGetSize(fileID);
const size_t recsize = gribGetSize(fileID);
recpos = fileGetPos(fileID);
if ( recsize == 0 )
{
......@@ -1112,7 +1112,7 @@ int cgribexScanTimestep(stream_t * streamptr)
if ( rindex > nrecs ) break;
const size_t recsize = gribGetSize(fileID);
recpos = fileGetPos(fileID);
recpos = fileGetPos(fileID);
if ( recsize == 0 )
{
streamptr->ntsteps = streamptr->rtsteps + 1;
......@@ -1148,7 +1148,7 @@ int cgribexScanTimestep(stream_t * streamptr)
if ( rindex == 0 )
{
const int vlistID = streamptr->vlistID;
int taxisID = vlistInqTaxis(vlistID);
const int taxisID = vlistInqTaxis(vlistID);
if ( taxisInqType(taxisID) == TAXIS_RELATIVE )
{
taxis->type = TAXIS_RELATIVE;
......@@ -1520,8 +1520,14 @@ void cgribexDefTime(int *isec1, int vdate, int vtime, int tsteptype, int numavg,
if ( timetype == TAXIS_RELATIVE )
{
const int calendar = taxisInqCalendar(taxisID);
const int rdate = taxisInqRdate(taxisID);
const int rtime = taxisInqRtime(taxisID);
int rdate = taxisInqRdate(taxisID);
int rtime = taxisInqRtime(taxisID);
if (vdate < rdate || (vdate == rdate && vtime < rtime))
{
rdate = vdate;
rtime = vtime;
}
int factor = cgribexDefDateTime(isec1, timeunit, rdate, rtime);
int ip1 = 0, ip2 = 0;
......
......@@ -953,7 +953,7 @@ int gribapiScanTimestep1(stream_t * streamptr)
while ( true )
{
int level1 = 0, level2 = 0;
size_t recsize = gribGetSize(fileID);
const size_t recsize = gribGetSize(fileID);
recpos = fileGetPos(fileID);
if ( recsize == 0 )
......@@ -1111,7 +1111,7 @@ int gribapiScanTimestep2(stream_t * streamptr)
{
if ( rindex > nrecords ) break;
size_t recsize = gribGetSize(fileID);
const size_t recsize = gribGetSize(fileID);
recpos = fileGetPos(fileID);
if ( recsize == 0 )
{
......@@ -1337,7 +1337,7 @@ int gribapiScanTimestep(stream_t * streamptr)
if ( rindex == 0 )
{
int taxisID = vlistInqTaxis(vlistID);
const int taxisID = vlistInqTaxis(vlistID);
if ( taxisInqType(taxisID) == TAXIS_RELATIVE )
{
taxis->type = TAXIS_RELATIVE;
......@@ -1839,10 +1839,16 @@ void gribapiDefTime(int editionNumber, int productDefinitionTemplate, int typeOf
if ( taxistype == TAXIS_RELATIVE )
{
const int calendar = taxisInqCalendar(taxisID);
const int64_t rdate = taxisInqRdate(taxisID);
const int rtime = taxisInqRtime(taxisID);
const int timeunit = taxisInqTunit(taxisID);
const int calendar = taxisInqCalendar(taxisID);
int64_t rdate = taxisInqRdate(taxisID);
int rtime = taxisInqRtime(taxisID);
if (vdate < rdate || (vdate == rdate && vtime < rtime))
{
rdate = vdate;
rtime = vtime;
}
int status = gribapiDefDateTimeRel(editionNumber, gh, rdate, rtime, vdate, vtime, productDefinitionTemplate,
typeOfGeneratingProcess, tsteptype, timeunit, calendar, gcinit);
......@@ -2834,7 +2840,7 @@ convertDataScanningMode(int scanModeIN, int scanModeOUT, double *data,
if (scanModeIN==00) // Scanning Mode (00 dec) +i, -j; i direction consecutive (row-major order West->East & South->North )
{ // Scanning Mode (64 dec) +i, +j; i direction consecutive (row-major order West->East & North->South )
// Scanning Mode (96 dec) +i, +j; j direction consecutive (column-major order North->South & West->East )
// Scanning Mode (96 dec) +i, +j; j direction consecutive (column-major order North->South & West->East )
if (scanModeOUT==64)
{ // flip the data vertically ..
idxIN= 0; idxOUT= (jDim-1)*iDim;
......
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