Commit 6abbab42 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

Use abs values of increment.

parent 1dd5bee0
...@@ -1708,7 +1708,7 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI ...@@ -1708,7 +1708,7 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI
{ {
xfirst = gridInqXval(gridID, 0); xfirst = gridInqXval(gridID, 0);
xlast = gridInqXval(gridID, (lcurvi ? nlon*nlat : nlon) - 1); xlast = gridInqXval(gridID, (lcurvi ? nlon*nlat : nlon) - 1);
xinc = gridInqXinc(gridID); xinc = fabs(gridInqXinc(gridID));
} }
} }
...@@ -1746,7 +1746,6 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI ...@@ -1746,7 +1746,6 @@ void cgribexDefGrid(int *isec1, int *isec2, double *fsec2, int *isec4, int gridI
else else
{ {
ISEC2_LatIncr = (int)lround(yinc*1000); ISEC2_LatIncr = (int)lround(yinc*1000);
if ( ISEC2_LatIncr < 0 ) ISEC2_LatIncr = -ISEC2_LatIncr;
} }
if ( ISEC2_NumLon > 1 && ISEC2_NumLat == 1 ) if ( ISEC2_NumLon > 1 && ISEC2_NumLat == 1 )
......
...@@ -2063,7 +2063,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype ...@@ -2063,7 +2063,7 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
{ {
xfirst = gridInqXval(gridID, 0); xfirst = gridInqXval(gridID, 0);
xlast = gridInqXval(gridID, (lcurvi ? nlon*nlat : nlon) - 1); xlast = gridInqXval(gridID, (lcurvi ? nlon*nlat : nlon) - 1);
xinc = gridInqXinc(gridID); xinc = fabs(gridInqXinc(gridID));
} }
} }
...@@ -2072,9 +2072,18 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype ...@@ -2072,9 +2072,18 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
{ {
yfirst = gridInqYval(gridID, 0); yfirst = gridInqYval(gridID, 0);
ylast = gridInqYval(gridID, (lcurvi ? nlon*nlat : nlat) - 1); ylast = gridInqYval(gridID, (lcurvi ? nlon*nlat : nlat) - 1);
yinc = gridInqYinc(gridID); yinc = fabs(gridInqYinc(gridID));
} }
{
long iscan = xfirst > xlast;
GRIB_CHECK(my_grib_set_long(gh, "iScansNegatively", iscan), 0);
}
{
long jscan = yfirst < ylast;
GRIB_CHECK(my_grib_set_long(gh, "jScansPositively", jscan), 0);
}
if ( gridtype != GRID_GAUSSIAN_REDUCED ) GRIB_CHECK(my_grib_set_long(gh, "Ni", nlon), 0); if ( gridtype != GRID_GAUSSIAN_REDUCED ) GRIB_CHECK(my_grib_set_long(gh, "Ni", nlon), 0);
GRIB_CHECK(my_grib_set_double(gh, "longitudeOfFirstGridPointInDegrees", xfirst), 0); GRIB_CHECK(my_grib_set_double(gh, "longitudeOfFirstGridPointInDegrees", xfirst), 0);
GRIB_CHECK(my_grib_set_double(gh, "longitudeOfLastGridPointInDegrees", xlast), 0); GRIB_CHECK(my_grib_set_double(gh, "longitudeOfLastGridPointInDegrees", xlast), 0);
...@@ -2084,11 +2093,6 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype ...@@ -2084,11 +2093,6 @@ void gribapiDefGrid(int editionNumber, grib_handle *gh, int gridID, int comptype
GRIB_CHECK(my_grib_set_double(gh, "latitudeOfFirstGridPointInDegrees", yfirst), 0); GRIB_CHECK(my_grib_set_double(gh, "latitudeOfFirstGridPointInDegrees", yfirst), 0);
GRIB_CHECK(my_grib_set_double(gh, "latitudeOfLastGridPointInDegrees", ylast), 0); GRIB_CHECK(my_grib_set_double(gh, "latitudeOfLastGridPointInDegrees", ylast), 0);
{
long jscan = yfirst < ylast;
GRIB_CHECK(my_grib_set_long(gh, "jScansPositively", jscan), 0);
}
if ( gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED ) if ( gridtype == GRID_GAUSSIAN || gridtype == GRID_GAUSSIAN_REDUCED )
{ {
int np = gridInqNP(gridID); int np = gridInqNP(gridID);
......
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