mirror of https://github.com/ecmwf/eccodes.git
ECC-1708: grib_get_data returns offset longitudes in some cases
This commit is contained in:
parent
4fcb936958
commit
c32c4c5bfb
|
@ -233,10 +233,14 @@ static int init(grib_iterator* iter, 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
|
// ECC-1406: Due to rounding, errors can accumulate.
|
||||||
*/
|
// So we ensure the last longitude is longitudeOfLastGridPointInDegrees
|
||||||
self->los[Ni-1] = normalise_longitude_in_degrees(lon2); // Also see ECC-1671
|
// Also see ECC-1671, ECC-1708
|
||||||
|
if (lon2 > 0) {
|
||||||
|
lon2 = normalise_longitude_in_degrees(lon2);
|
||||||
|
}
|
||||||
|
self->los[Ni-1] = lon2;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -128,6 +128,7 @@ if( HAVE_BUILD_TOOLS )
|
||||||
grib_ecc-1571
|
grib_ecc-1571
|
||||||
grib_ecc-1654
|
grib_ecc-1654
|
||||||
grib_ecc-1671
|
grib_ecc-1671
|
||||||
|
grib_ecc-1708
|
||||||
grib_ecc-1691
|
grib_ecc-1691
|
||||||
bufr_ecc-1028
|
bufr_ecc-1028
|
||||||
bufr_ecc-1195
|
bufr_ecc-1195
|
||||||
|
|
|
@ -16,7 +16,7 @@ tempGrib=temp.$label.grib
|
||||||
tempFilt=temp.${label}.filt
|
tempFilt=temp.${label}.filt
|
||||||
tempOut=temp.${label}.txt
|
tempOut=temp.${label}.txt
|
||||||
|
|
||||||
sample2="$samp_dir/GRIB2.tmpl"
|
sample="$samp_dir/GRIB2.tmpl"
|
||||||
|
|
||||||
cat > $tempFilt <<EOF
|
cat > $tempFilt <<EOF
|
||||||
set numberOfDataPoints = 5400000;
|
set numberOfDataPoints = 5400000;
|
||||||
|
@ -32,7 +32,7 @@ cat > $tempFilt <<EOF
|
||||||
write;
|
write;
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample2
|
${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample
|
||||||
# ${tools_dir}/grib_ls -j -n geography $tempGrib
|
# ${tools_dir}/grib_ls -j -n geography $tempGrib
|
||||||
|
|
||||||
cat > $tempFilt <<EOF
|
cat > $tempFilt <<EOF
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
#!/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
|
||||||
|
|
||||||
|
label="grib_ecc-1708_test"
|
||||||
|
|
||||||
|
tempGrib=temp.$label.grib
|
||||||
|
tempFilt=temp.${label}.filt
|
||||||
|
tempOut=temp.${label}.txt
|
||||||
|
|
||||||
|
sample="$samp_dir/GRIB1.tmpl"
|
||||||
|
|
||||||
|
cat > $tempFilt <<EOF
|
||||||
|
set Ni = 1401;
|
||||||
|
set Nj = 701;
|
||||||
|
set latitudeOfFirstGridPoint = 80000;
|
||||||
|
set longitudeOfFirstGridPoint = -180000;
|
||||||
|
set latitudeOfLastGridPoint = 10000;
|
||||||
|
set longitudeOfLastGridPoint = -40000;
|
||||||
|
set iDirectionIncrement = 100;
|
||||||
|
set jDirectionIncrement = 100;
|
||||||
|
write;
|
||||||
|
EOF
|
||||||
|
|
||||||
|
${tools_dir}/grib_filter -o $tempGrib $tempFilt $sample
|
||||||
|
${tools_dir}/grib_ls -j -n geography $tempGrib
|
||||||
|
|
||||||
|
cat > $tempFilt <<EOF
|
||||||
|
meta last_elem element(distinctLongitudes, 1400);
|
||||||
|
# print "[last_elem:d]";
|
||||||
|
if ( last_elem + 40 > 0.001 ) {
|
||||||
|
print "Error: last longitude is [last_elem:d] but should be -40";
|
||||||
|
assert(0);
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
${tools_dir}/grib_filter $tempFilt $tempGrib
|
||||||
|
|
||||||
|
rm -f $tempGrib $tempFilt $tempOut
|
Loading…
Reference in New Issue