Opened 4 years ago

Closed 10 months ago

#317 closed defect (fixed)

WCPS1.5_WCPS and complex numbers

Reported by: pcampalani Owned by: mdumitru
Priority: minor Milestone: 9.3
Component: petascope Version: development
Keywords: wcps complex numbers Cc:
Complexity: Hard

Description

WCPS does not seem to support complex operations with numbers.
Casting is not implemented yet in the RasQL (QL guide, p.53 Restrictions), and although WCPS complexConstant can be defined (with static numbers):

complexConstant returns[String value]
	: LPAREN re1=FLOATCONSTANT COMMA im1=FLOATCONSTANT RPAREN { $value = new String($re1.text +"+i"+$im1.text); }
	;

they don't seem to work:

for c in (mr)
return (0.1, 0.1)

Error: Invalid coverage Expression, next node: complexConstant

Looking at petascope.wcps.grammar.wcps.g, complex expressions seems allowed only inside a USING clause:

03 06 2009 andreia	Complex expressions introduced in the "using" clause of general condense operations

but this neither seem to work:

for c in (mr)
return encode(
  coverage complexNumber
  over $x x (0:0),
       $y y (0:0)
  values condense +
      over $x x (0:0),
           $y y (0:0)
      using (0.1, 0.1),
"csv")

Error: Invalid coverage Expression, next node: condense - failed to match SubsetOperation: condense

This might deserve some effort at some point.

Change History (4)

comment:1 Changed 19 months ago by dmisev

  • Complexity set to Very Hard
  • Owner changed from abeccati to mdumitru
  • Status changed from new to assigned

comment:2 Changed 15 months ago by bphamhuu

  • Complexity changed from Very Hard to Hard
  • Summary changed from WCPS and complex numbers to WCPS1.5_WCPS and complex numbers

Piero,

Your second example works in WCPS1.5, but first example does not work. I've opened a ticket for this problem http://rasdaman.org/ticket/1261.

i.e, query will be translated to Rasql like:

http://localhost:8088/rasdaman/ows?service=WCS&version=2.0.1&request=ProcessCoverages&query=
for c in (mr) return encode(coverage complexNumber 
over $x x (0:1),$y y (0:1) values 
condense over $x x (0:1),$y y (0:1) 
using (0.1, 0.1),"csv")&wcpsVersion=2.0

to Rasql:

SELECT encode(
MARRAY x in [0:1,209:210] VALUES 
CONDENSE + 
OVER x in [0:1,209:210] 
USING complex(0.1, 0.1), "csv" ) 
FROM mr AS c

In WCPS1.5 grammar and WCPS1.0 document, ComplexConstant? belonged to "numericScalarExpr", then it can also work like this, beside "using" clause in condenser.

for c in (mr) return avg(c) + avg(c) + 1 + (0.1, 0.1)

but returns error

ows:ExceptionText>java.lang.ClassCastException : 
petascope.wcps2.translator.ComplexNumberConstant cannot be cast to
petascope.wcps2.translator.CoverageExpression</ows:ExceptionText>

then in WCPS1.5, this ticket will need to fix this problem with Complex Numbers in Numerical Scalar Expression.

comment:3 Changed 11 months ago by bphamhuu

  • Milestone changed from Future to 9.3
  • Version changed from 8.3 to development

This query works in WCPS 1.5

for c in (mr) return encode(coverage complexNumber 
over $x x (0:1),$y y (0:1) values 
condense +
over $x x (0:1),$y y (0:1) 
using (0.1, 0.1),"csv")&wcpsVersion=2.0

and this works also

for c in (mr) return (0.1, 0.1)

but it has error with Rasql support complex number http://rasdaman.org/ticket/794

Close ticket here as it was fixed in WCPS 1.5.

comment:4 Changed 10 months ago by bphamhuu

  • Resolution set to fixed
  • Status changed from assigned to closed
Note: See TracTickets for help on using tickets.