Opened 8 years ago

Closed 8 years ago

#1207 closed defect (fixed)

WCPS1.5_Wrong calculation which using boolean expression when creating from coverage constructor

Reported by: Bang Pham Huu Owned by:
Priority: major Milestone: 10.0
Component: petascope Version: development
Keywords: wcps 2.0, boolean expression, calculation Cc: Dimitar Misev, Vlad Merticariu, Alex Dumitru
Complexity: Medium

Description

wcps query "28-construct_histogram_range_condition.test" with query

for c in ( mr )
return
encode( coverage histogram
        over     $n x(-20:20)
        values   condense +
                        over     $px x(10:20),
                                 $py y(10:20)
                        using    (long) c[ i($px), j($py) ]>$n - 1 and c[ i($px), j($py) ]<=$n,
        "csv" )

which is translated to Rasql in WCPS 2.0

SELECT encode(MARRAY n in [-20:20] VALUES 
CONDENSE + OVER px in [10:20,190:200] 
USING (long) c[px[0],px[1]] > n[0] - 1 and c[px[0],px[1]] <= n[0], "csv" )
FROM mr AS c

and it try to calculate boolean expression which returns

{f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,f,t,f,t,t,t,t,f,t,t,t,t,f,t,f,t,t,t,f,t,f,t}

instead of

{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,121,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}

from WCPS 1.0 Rasql

select csv(marray i_i in [-20:20] values
condense + over i_j in [10:20, 10:20]
using (long)((((((c) [i_j[0],i_j[1]])>((i_i[0])-(1))))and((((c) [i_j[0],i_j[1]])<=(i_i[0]))))))
from mr AS c where oid(c)=45569

Change History (5)

comment:1 by Dimitar Misev, 8 years ago

I see this big difference in the queries though:

  • WCPS 2: CONDENSE + OVER px in [10:20,190:200]
  • WCPS 1: condense + over i_j in [10:20, 10:20] (this looks correct)

comment:2 by Bang Pham Huu, 8 years ago

Yes, I also saw that, as in test case 38

for t in (rgb) 
return encode(extend( (t + (unsigned char)50),  
{i :"CRS:1" ( 0:500 ),  
j: "CRS:1" (0: 500)}  ), 
"png", "nodata=0" )

and this is Rasql query WCPS 1.0

select encode(extend(((t)+((char)(50))),[0:500,0:500]), "PNG",
 "nodata=0;xmin=0.0;xmax=500.0;ymin=0.0;ymax=500.0;crs=OGC:Index2D") from rgb AS t where oid(t)=45057

Version 2.0 returns the rasql like

SELECT encode(extend( ( t + (char) 50 ) , [0:500,-157:343]), "png"
 , "nodata=0") FROM rgb AS t

comment:3 by Vlad Merticariu, 8 years ago

As I mentioned in the first ticket, please leave the coverage constructor + condenser + case for the end.

The reason is that in WCPS2, we consider $n x(-20:20) to be geo coordinates, which are then translated into array coordinates.

In WCPS1, the coordinates are array coordinates, thus no translation is required.

The problem is that we don't have a straight forward method to define axis in the coverage constructor, so we have to make a decision if we stick to array coordinates, or introduce the possibility to define new axis (which would need crs, resolution or list of direct positions etc),

comment:4 by Bang Pham Huu, 8 years ago

Summary: WCPS2.0_Wrong calculation which using boolean expression when creating from coverage constructorWCPS1.5_Wrong calculation which using boolean expression when creating from coverage constructor

comment:5 by Bang Pham Huu, 8 years ago

Resolution: fixed
Status: newclosed

the correct behavior is in WCPS 1.5 and need to update the oracle, about the different interval it is due to the "CRS:1" problem as it was fixed in ticket1244, then interval is same as in WCPS 1.0. Close ticket here.

Note: See TracTickets for help on using tickets.