mirror of https://github.com/ecmwf/eccodes.git
ECC-984: test
This commit is contained in:
parent
72078cdeef
commit
e81129a1ff
|
@ -159,11 +159,11 @@ static int init(grib_iterator* iter, grib_handle* h,grib_arguments* args)
|
|||
if((err = grib_get_long_internal(h, s_jPtsConsec, &self->jPointsAreConsecutive))) return err;
|
||||
if((err = grib_get_long(h, "iteratorDisableUnrotate", &self->disableUnrotate))) return err;
|
||||
|
||||
/* If the jDirectionIncrement is missing, then we cannot use it (See jDirectionIncrementGiven) */
|
||||
/* ECC-984: If jDirectionIncrement is missing, then we cannot use it (See jDirectionIncrementGiven) */
|
||||
/* So try to compute the increment */
|
||||
if (grib_is_missing(h, s_jdir, &err) && err == GRIB_SUCCESS) {
|
||||
double lat2;
|
||||
err = grib_get_double_internal(h, "latitudeLastInDegrees", &lat2);
|
||||
if (!err) { /* try to compute jDirectionIncrementInDegrees */
|
||||
if ((err = grib_get_double_internal(h, "latitudeLastInDegrees", &lat2)) == GRIB_SUCCESS) {
|
||||
const long Nj = self->nam;
|
||||
Assert(Nj>1);
|
||||
if (lat1 > lat2) {
|
||||
|
@ -172,7 +172,7 @@ static int init(grib_iterator* iter, grib_handle* h,grib_arguments* args)
|
|||
jdir=(lat1+360.0-lat2)/(Nj-1);
|
||||
}
|
||||
grib_context_log(h->context, GRIB_LOG_INFO,
|
||||
"%s is missing (See jDirectionIncrementGiven). Using value of %.6f obtained from lat1, lat2 and Nj",s_jdir,jdir);
|
||||
"%s is missing (See jDirectionIncrementGiven). Using value of %.6f obtained from La1, La2 and Nj",s_jdir,jdir);
|
||||
}
|
||||
}
|
||||
if (jScansPositively) jdir=-jdir;
|
||||
|
|
|
@ -112,6 +112,7 @@ list( APPEND tests_data_reqd
|
|||
grib_ecc-873
|
||||
grib_ecc-600
|
||||
grib_ecc-923
|
||||
grib_ecc-984
|
||||
bufr_ecc-556
|
||||
gts_get
|
||||
gts_ls
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
# Copyright 2005-2019 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.sh
|
||||
set -u
|
||||
# ---------------------------------------------------------
|
||||
# This is the test for the JIRA issue ECC-984
|
||||
# grib_get_data: missing jDirectionIncrement produces huge values
|
||||
# ---------------------------------------------------------
|
||||
label="grib_ecc-984-test"
|
||||
tempGrb=temp.${label}.grb
|
||||
tempOut=temp.${label}.txt
|
||||
tempErr=temp.${label}.err
|
||||
|
||||
input=$data_dir/sample.grib2
|
||||
${tools_dir}/grib_set -s ijDirectionIncrementGiven=0 $input $tempGrb
|
||||
grib_check_key_equals $tempGrb jDirectionIncrementInDegrees MISSING
|
||||
${tools_dir}/grib_get_data -F%.2f $tempGrb >$tempOut 2>$tempErr
|
||||
|
||||
grep -q "2.000 20.000 302.53" $tempOut
|
||||
grep -q "DjInDegrees is missing" $tempErr
|
||||
|
||||
# Clean up
|
||||
rm -f $tempGrb $tempOut $tempErr
|
Loading…
Reference in New Issue