mirror of https://github.com/ecmwf/eccodes.git
ECC-1406: GRIB: grib_ls -l reports last grid point is out of area
This commit is contained in:
parent
f50bbe5100
commit
1e456b745f
|
@ -211,6 +211,10 @@ static int init(grib_iterator* iter, grib_handle* h, grib_arguments* args)
|
||||||
self->las[lai] = lat1;
|
self->las[lai] = lat1;
|
||||||
lat1 -= jdir;
|
lat1 -= jdir;
|
||||||
}
|
}
|
||||||
|
/* ECC-1406: Due to rounding, errors can accumulate.
|
||||||
|
* So we ensure the last latitude is latitudeOfLastGridPointInDegrees
|
||||||
|
*/
|
||||||
|
self->las[self->Nj-1] = lat2;
|
||||||
|
|
||||||
iter->e = -1;
|
iter->e = -1;
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -220,6 +220,10 @@ static int init(grib_iterator* i, grib_handle* h, grib_arguments* args)
|
||||||
self->los[loi] = lon1;
|
self->los[loi] = lon1;
|
||||||
lon1 += idir;
|
lon1 += idir;
|
||||||
}
|
}
|
||||||
|
/* ECC-1406: Due to rounding, errors can accumulate.
|
||||||
|
* So we ensure the last longitude is longitudeOfLastGridPointInDegrees
|
||||||
|
*/
|
||||||
|
self->los[Ni-1] = lon2;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,6 +96,7 @@ if( HAVE_BUILD_TOOLS )
|
||||||
grib_ecc-1315
|
grib_ecc-1315
|
||||||
grib_ecc-1322
|
grib_ecc-1322
|
||||||
grib_ecc-1319
|
grib_ecc-1319
|
||||||
|
grib_ecc-1406
|
||||||
bufr_ecc-1028
|
bufr_ecc-1028
|
||||||
bufr_ecc-1195
|
bufr_ecc-1195
|
||||||
bufr_ecc-1259
|
bufr_ecc-1259
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
#!/bin/sh
|
||||||
|
# (C) Copyright 2005- ECMWF.
|
||||||
|
#
|
||||||
|
# This software is licensed under the terms of the Apache Licence Version 2.0
|
||||||
|
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
#
|
||||||
|
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||||
|
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||||
|
#
|
||||||
|
|
||||||
|
. ./include.ctest.sh
|
||||||
|
set -u
|
||||||
|
REDIRECT=/dev/null
|
||||||
|
label="grib_ecc-1406_test"
|
||||||
|
|
||||||
|
tempGrib=temp.$label.grib
|
||||||
|
tempFilt=temp.${label}.filt
|
||||||
|
tempOut=temp.${label}.txt
|
||||||
|
|
||||||
|
sample2="$samp_dir/GRIB2.tmpl"
|
||||||
|
|
||||||
|
cat > $tempFilt <<EOF
|
||||||
|
set numberOfDataPoints = 5016591;
|
||||||
|
set numberOfValues = 5016591;
|
||||||
|
set Ni = 2801;
|
||||||
|
set Nj = 1791;
|
||||||
|
set latitudeOfFirstGridPoint = 55400000;
|
||||||
|
set longitudeOfFirstGridPoint = 348000000;
|
||||||
|
set latitudeOfLastGridPoint = 37500000;
|
||||||
|
set longitudeOfLastGridPoint = 16000000;
|
||||||
|
set iDirectionIncrement = 10000;
|
||||||
|
set jDirectionIncrement = 10000;
|
||||||
|
|
||||||
|
meta lastVal element(values, numberOfValues - 1);
|
||||||
|
set lastVal = 42;
|
||||||
|
|
||||||
|
write;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample2
|
||||||
|
${tools_dir}/grib_ls -l 37.5,16.0,1 $tempGrib > $tempOut
|
||||||
|
|
||||||
|
grep -q "Grid Point chosen #1 index=5016590" $tempOut
|
||||||
|
grep -q "grid_simple 42" $tempOut
|
||||||
|
|
||||||
|
${tools_dir}/grib_ls -j -l 37.5,16.0,1 $tempGrib > $tempOut
|
||||||
|
grep -q 'latitude" : 37.5, "longitude" : 16, "distance" : 0,.*"value" : 42 ,' $tempOut
|
||||||
|
|
||||||
|
rm -f $tempGrib $tempFilt $tempOut
|
Loading…
Reference in New Issue