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

gridInqXinc: added support for negativ values (bug fix).

parent a78196a1
......@@ -2,6 +2,10 @@
* Version 1.9.2 released
2017-10-20 Uwe Schulzweida
* gridInqXinc: added support for negativ values (bug fix)
2017-10-09 Uwe Schulzweida
* changed type of gridsize from int to size_t
......
......@@ -1846,9 +1846,10 @@ double gridInqXinc(int gridID)
size_t xsize = gridptr->x.size;
if ( xsize > 1 )
{
xinc = fabs(xvals[xsize-1] - xvals[0])/(xsize-1);
xinc = xvals[1] - xvals[0];
double abs_xinc = fabs(xinc);
for ( size_t i = 2; i < xsize; i++ )
if ( fabs(fabs(xvals[i-1] - xvals[i]) - xinc) > 0.01*xinc )
if ( fabs(fabs(xvals[i-1] - xvals[i]) - abs_xinc) > 0.01*abs_xinc )
{
xinc = 0;
break;
......
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