Opened 11 years ago
Closed 9 years ago
#405 closed defect (fixed)
WCPS1.5_Wrong operator precedence with coverage subsets
Reported by: | Piero Campalani | Owned by: | Alex Dumitru |
---|---|---|---|
Priority: | major | Milestone: | 10.0 |
Component: | petascope | Version: | development |
Keywords: | wcps operator precedence | Cc: | Dirk Daems, Alex Dumitru, Vlad Merticariu |
Complexity: | Hard |
Description
BEGIN ====================================================
On 18/06/13 16:14, Daems Dirk wrote:
Hi list,
When I execute the following query:
for c in (NDVI_SPOT_VGT) return encode (coverage NDVI_HIST_STDEV over $pt t(0:1) values ( c[t(28 + 36*$pt),x:"CRS:1"(4001),y:"CRS:1"(4001)]) ,"csv")
the result is:
{136,189}
When I try to revert to the physical value (= digital value * 0.004 - 0.08):
for c in (NDVI_SPOT_VGT) return encode (coverage NDVI_HIST_STDEV over $pt t(0:1) values ( c[t(28 + 36*$pt),x:"CRS:1"(4001),y:"CRS:1"(4001)] * 0.004 - 0.08 ) ,"csv")
the result is:
{-10.336,-14.364}
What actually seems to happen is this: c[t(28 + 36*$pt),x:"CRS:1"(4001),y:"CRS:1"(4001)] * (0.004 - 0.08)
, which doesn't seem correct according to the operator precedence rules (section 7.2.4 of OGC 08-068r2).
====================================================== END
Example with internal test coverages:
for c in (mr) return encode ( c[x:"CRS:1"(30),y:"CRS:1"(30)] * 1 - 1, "csv")
which gives 0
(<subset> * (1-1)
), instead of the correct value.
Change History (7)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Priority: | critical → major |
---|
There is a workaround for this with parenthesis right? Lowering priority..
comment:3 by , 11 years ago
Milestone: | → Future |
---|
I spent some time and the conclusion is that this will be pretty complicated to solve because we have mix of CoverageExpr and NumericScalarExpr. Essentially we need to duplicate a bunch of rules in the grammar. For unmixed expressions the precedences are fine. Probably it will be best to postpone for WCPS 2.0 or so.
comment:4 by , 10 years ago
Cc: | added |
---|---|
Complexity: | Medium → Hard |
comment:5 by , 9 years ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:6 by , 9 years ago
Milestone: | Future → 10.0 |
---|---|
Summary: | Wrong operator precedence with coverage subsets → WCPS1.5_Wrong operator precedence with coverage subsets |
Version: | 8.4 → development |
comment:7 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
It is fixed in WCPS1.5, e.g (based on Piero's examples)
c[i(3), j(30)] = 8
Example 1:
for c in (mr)return encode (c[i(30),j(30)] * 1 - 1,"csv")
WCPS1.5 returns {7}, WCPS1.0 returns {0}
Example 2:
for c in (mr)return encode (c[i(30),j(30)]*1 - 0.08 - 1 ,"csv")
WCPS1.5 returns {6.92}, WCPS1.0 returns {-0.64}
then I will close this ticket here as it is already supported in WCPS 1.5.
Additional related bug (thanks Dirk):
'-X-Y'
evaluated as'-(X-Y)=-X+Y'
BEGIN ====================================================
is actually evaluated as
(c[t(28 + 36*$pt),x:"CRS:1"(4001),y:"CRS:1"(4001)] * 0.004) - (0.08 - 1)
.====================================================== END