mirror of https://github.com/ecmwf/eccodes.git
ECC-1375: Add test
This commit is contained in:
parent
5bc68e1116
commit
2fe3463f94
|
@ -155,12 +155,11 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
|||
{
|
||||
int err = 0;
|
||||
grib_accessor_change_alternative_row_scanning* self = (grib_accessor_change_alternative_row_scanning*)a;
|
||||
grib_context* c = a->context;
|
||||
grib_handle* h = grib_handle_of_accessor(a);
|
||||
long i, j, jr, theEnd, Ni, Nj, k, kp;
|
||||
long alternativeRowScanning = 0;
|
||||
size_t size = 0;
|
||||
double* values = NULL;
|
||||
grib_context* c = a->context;
|
||||
grib_handle* h = grib_handle_of_accessor(a);
|
||||
long i, j, jr, theEnd, Ni, Nj, k, kp, alternativeRowScanning;
|
||||
size_t size = 0;
|
||||
double* values = NULL;
|
||||
double tmp = 0.0;
|
||||
|
||||
if (*val == 0)
|
||||
|
@ -191,7 +190,7 @@ static int pack_long(grib_accessor* a, const long* val, size_t* len)
|
|||
return err;
|
||||
}
|
||||
|
||||
theEnd = (Ni + 0.5) / 2;
|
||||
theEnd = Ni / 2;
|
||||
for (j = 0; j < Nj; j++) {
|
||||
jr = Ni * j;
|
||||
for (i = 0; i < theEnd; i++) {
|
||||
|
|
|
@ -9,7 +9,9 @@
|
|||
#
|
||||
|
||||
. ./include.sh
|
||||
#set -x
|
||||
set -u
|
||||
|
||||
label="grib_change_scanning"
|
||||
|
||||
editions="1 2"
|
||||
gridTypes="regular_ll rotated_ll"
|
||||
|
@ -74,5 +76,46 @@ EOF
|
|||
done
|
||||
done
|
||||
|
||||
rm -f ${data_dir}/scan1.grib ${data_dir}/scan.grib
|
||||
# alternativeRowScanning
|
||||
# -----------------------
|
||||
tempFilt=temp.$label.filt
|
||||
tempGribA=temp.$label.A.grib
|
||||
tempGribB=temp.$label.B.grib
|
||||
tempText=temp.$label.txt
|
||||
tempRef=temp.$label.ref
|
||||
|
||||
cat > $tempFilt <<EOF
|
||||
set Nj = 2;
|
||||
set latitudeOfFirstGridPointInDegrees = 60;
|
||||
set latitudeOfLastGridPointInDegrees = 59;
|
||||
set Ni = 3;
|
||||
set longitudeOfFirstGridPointInDegrees = 0;
|
||||
set longitudeOfLastGridPointInDegrees = 2;
|
||||
set DjInDegrees = 1;
|
||||
set DiInDegrees = 1;
|
||||
|
||||
set alternativeRowScanning = 1;
|
||||
set values={ 12, 13, 14, 15, 16, 17 };
|
||||
write;
|
||||
EOF
|
||||
|
||||
${tools_dir}/grib_filter -o $tempGribA $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||
${tools_dir}/grib_set -s swapScanningAlternativeRows=1 $tempGribA $tempGribB
|
||||
grib_check_key_equals $tempGribB alternativeRowScanning 0
|
||||
|
||||
${tools_dir}/grib_get_data -F "%.2f" $tempGribB > $tempText
|
||||
cat > $tempRef << EOF
|
||||
Latitude Longitude Value
|
||||
60.000 0.000 12.00
|
||||
60.000 1.000 13.00
|
||||
60.000 2.000 14.00
|
||||
59.000 0.000 17.00
|
||||
59.000 1.000 16.00
|
||||
59.000 2.000 15.00
|
||||
EOF
|
||||
diff $tempRef $tempText
|
||||
|
||||
|
||||
# Clean up
|
||||
rm -f $tempFilt $tempGribA $tempGribB $tempRef $tempText
|
||||
rm -f ${data_dir}/scan1.grib ${data_dir}/scan.grib
|
||||
|
|
Loading…
Reference in New Issue