mirror of https://github.com/ecmwf/eccodes.git
ECC-1819: GRIB: Keys iScansPositively and jScansNegatively should be read-only
This commit is contained in:
parent
e152763d7c
commit
599fbbf375
|
@ -9,8 +9,8 @@ flagbit jScansPositively(scanningMode,6) : dump;
|
||||||
flagbit jPointsAreConsecutive(scanningMode,5) : dump;
|
flagbit jPointsAreConsecutive(scanningMode,5) : dump;
|
||||||
constant alternativeRowScanning=0 : dump;
|
constant alternativeRowScanning=0 : dump;
|
||||||
|
|
||||||
transient iScansPositively = !iScansNegatively : constraint;
|
transient iScansPositively = !iScansNegatively : constraint, read_only;
|
||||||
transient jScansNegatively = !jScansPositively : constraint;
|
transient jScansNegatively = !jScansPositively : constraint, read_only;
|
||||||
|
|
||||||
alias geography.iScansNegatively=iScansNegatively;
|
alias geography.iScansNegatively=iScansNegatively;
|
||||||
alias geography.jScansPositively=jScansPositively;
|
alias geography.jScansPositively=jScansPositively;
|
||||||
|
|
|
@ -32,8 +32,8 @@ alias geography.orderingConvention = orderingConvention;
|
||||||
flags[1] scanningMode 'grib2/tables/[tablesVersion]/3.13.table';
|
flags[1] scanningMode 'grib2/tables/[tablesVersion]/3.13.table';
|
||||||
flagbit iScansNegatively(scanningMode,7) : dump; # WMO bit 1
|
flagbit iScansNegatively(scanningMode,7) : dump; # WMO bit 1
|
||||||
flagbit jScansPositively(scanningMode,6) : dump; # WMO bit 2
|
flagbit jScansPositively(scanningMode,6) : dump; # WMO bit 2
|
||||||
transient iScansPositively = !iScansNegatively : constraint;
|
transient iScansPositively = !iScansNegatively : constraint, read_only;
|
||||||
transient jScansNegatively = !jScansPositively : constraint;
|
transient jScansNegatively = !jScansPositively : constraint, read_only;
|
||||||
|
|
||||||
iterator healpix(numberOfPoints,missingValue,values,Nside,orderingConvention);
|
iterator healpix(numberOfPoints,missingValue,values,Nside,orderingConvention);
|
||||||
nearest healpix(values,radius,Nx,Ny);
|
nearest healpix(values,radius,Nx,Ny);
|
||||||
|
|
|
@ -20,8 +20,8 @@ alias geography.iScansNegatively=iScansNegatively;
|
||||||
alias geography.jScansPositively=jScansPositively;
|
alias geography.jScansPositively=jScansPositively;
|
||||||
alias geography.jPointsAreConsecutive=jPointsAreConsecutive;
|
alias geography.jPointsAreConsecutive=jPointsAreConsecutive;
|
||||||
|
|
||||||
transient iScansPositively = !iScansNegatively : constraint;
|
transient iScansPositively = !iScansNegatively : constraint, read_only;
|
||||||
transient jScansNegatively = !jScansPositively : constraint;
|
transient jScansNegatively = !jScansPositively : constraint, read_only;
|
||||||
|
|
||||||
flagbit scanningMode5(scanningMode,3) = 0: read_only;
|
flagbit scanningMode5(scanningMode,3) = 0: read_only;
|
||||||
flagbit scanningMode6(scanningMode,2) = 0: read_only;
|
flagbit scanningMode6(scanningMode,2) = 0: read_only;
|
||||||
|
|
|
@ -20,7 +20,7 @@ alias geography.iScansNegatively=iScansNegatively;
|
||||||
alias geography.jScansPositively=jScansPositively;
|
alias geography.jScansPositively=jScansPositively;
|
||||||
alias geography.jPointsAreConsecutive=jPointsAreConsecutive;
|
alias geography.jPointsAreConsecutive=jPointsAreConsecutive;
|
||||||
|
|
||||||
transient iScansPositively = !iScansNegatively : constraint;
|
transient iScansPositively = !iScansNegatively : constraint, read_only;
|
||||||
|
|
||||||
flagbit scanningMode5(scanningMode,3) = 0: read_only;
|
flagbit scanningMode5(scanningMode,3) = 0: read_only;
|
||||||
flagbit scanningMode6(scanningMode,2) = 0: read_only;
|
flagbit scanningMode6(scanningMode,2) = 0: read_only;
|
||||||
|
|
|
@ -112,7 +112,9 @@ int grib_pack_float(grib_accessor* a, const float* v, size_t* len)
|
||||||
int grib_pack_expression(grib_accessor* a, grib_expression* e)
|
int grib_pack_expression(grib_accessor* a, grib_expression* e)
|
||||||
{
|
{
|
||||||
grib_accessor_class* c = a->cclass;
|
grib_accessor_class* c = a->cclass;
|
||||||
//grib_context_log(a->context, GRIB_LOG_DEBUG, "(%s)%s is packing (double) %g",(a->parent->owner)?(a->parent->owner->name):"root", a->name ,v?(*v):0);
|
// grib_context_log(a->context, GRIB_LOG_INFO, "....(%s)%s is packing",
|
||||||
|
// (a->parent->owner)?(a->parent->owner->name):"root",
|
||||||
|
// a->name);
|
||||||
while (c) {
|
while (c) {
|
||||||
if (c->pack_expression) {
|
if (c->pack_expression) {
|
||||||
return c->pack_expression(a, e);
|
return c->pack_expression(a, e);
|
||||||
|
|
|
@ -11,6 +11,12 @@
|
||||||
. ./include.ctest.sh
|
. ./include.ctest.sh
|
||||||
|
|
||||||
label="grib_change_scanning_test"
|
label="grib_change_scanning_test"
|
||||||
|
tempFilt=temp.$label.filt
|
||||||
|
tempGribA=temp.$label.A.grib
|
||||||
|
tempGribB=temp.$label.B.grib
|
||||||
|
tempText=temp.$label.txt
|
||||||
|
tempRef=temp.$label.ref
|
||||||
|
|
||||||
|
|
||||||
editions="1 2"
|
editions="1 2"
|
||||||
gridTypes="regular_ll rotated_ll"
|
gridTypes="regular_ll rotated_ll"
|
||||||
|
@ -77,12 +83,6 @@ done
|
||||||
|
|
||||||
# alternativeRowScanning
|
# 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
|
cat > $tempFilt <<EOF
|
||||||
set Nj = 2;
|
set Nj = 2;
|
||||||
set latitudeOfFirstGridPointInDegrees = 60;
|
set latitudeOfFirstGridPointInDegrees = 60;
|
||||||
|
@ -141,6 +141,34 @@ ${tools_dir}/grib_set -s swapScanningX:s=1 $ECCODES_SAMPLES_PATH/GRIB2.tmpl $tem
|
||||||
${tools_dir}/grib_set -s swapScanningX:i=1 $ECCODES_SAMPLES_PATH/GRIB2.tmpl $tempGribB 2>/dev/null
|
${tools_dir}/grib_set -s swapScanningX:i=1 $ECCODES_SAMPLES_PATH/GRIB2.tmpl $tempGribB 2>/dev/null
|
||||||
cmp $tempGribA $tempGribB
|
cmp $tempGribA $tempGribB
|
||||||
|
|
||||||
|
|
||||||
|
# Check constraint keys follow (observe) their expressions
|
||||||
|
# --------------------------------------------------------
|
||||||
|
cat > $tempFilt <<EOF
|
||||||
|
set iScansNegatively = 1; # Change from 0 to 1
|
||||||
|
assert (0 == iScansPositively); # should change too
|
||||||
|
set jScansPositively = 1; # Same for j
|
||||||
|
assert (0 == jScansNegatively);
|
||||||
|
EOF
|
||||||
|
grib_check_key_equals $file 'iScansNegatively,jScansPositively' '0 0'
|
||||||
|
grib_check_key_equals $file 'iScansPositively,jScansNegatively' '1 1'
|
||||||
|
${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB1.tmpl
|
||||||
|
${tools_dir}/grib_filter $tempFilt $ECCODES_SAMPLES_PATH/GRIB2.tmpl
|
||||||
|
|
||||||
|
|
||||||
|
# ECC-1819: Keys iScansPositively and jScansNegatively should be read-only
|
||||||
|
for s in GRIB1.tmpl GRIB2.tmpl; do
|
||||||
|
for k in iScansPositively jScansNegatively; do
|
||||||
|
set +e
|
||||||
|
${tools_dir}/grib_set -s $k=0 $ECCODES_SAMPLES_PATH/$s $tempGribA 2>$tempText
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "Value is read only" $tempText
|
||||||
|
rm $tempText
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
# Clean up
|
# Clean up
|
||||||
rm -f $tempFilt $tempGribA $tempGribB $tempRef $tempText
|
rm -f $tempFilt $tempGribA $tempGribB $tempRef $tempText
|
||||||
rm -f ${data_dir}/scan1.grib ${data_dir}/scan.grib
|
rm -f ${data_dir}/scan1.grib ${data_dir}/scan.grib
|
||||||
|
|
Loading…
Reference in New Issue