Opened 11 years ago

Last modified 5 years ago

#596 closed defect

WCPS Interval expression to actually support mathematical expressions — at Initial Version

Reported by: Piero Campalani Owned by: Piero Campalani
Priority: major Milestone: 10.0
Component: petascope Version: development
Keywords: interval expression Cc: mantovani@…, Vlad Merticariu, Alex Dumitru, Peter Baumann
Complexity: Hard

Description

Currently, ANTLR breaks when trying to put expressions into an interval expression.

Toy example:

for c in (eobscov) return encode (
   coverage averaged_pixel_history
   over     $t t(0:(1+1))
   values   avg(c[Lat(0), Long(51)])
, "csv" )

Use case:

for c in (eobscov) return encode (
   coverage averaged_pixel_history
   over     $t t(0:(count(c[Lat(0), Long(51)]<100000)/2))
   values   avg(c[Lat(0), Long(51), t:"CRS:1"($t:$t+1)])
, "csv" )

Relevant grammar:

axisIterator:
    variableName axisName ( intervalExpr )

intervalExpr:
    integerExpr : integerExpr
  | imageCrsDomain ( coverageName , axisName )

Relevant Petascope grammar (IntegerExpr = IndexExpr):

indexExpr returns[IndexExpr value]                                                                                                                           
    : e1=indexTerm { $value = $e1.value; } 
                (op=(PLUS|MINUS) e2=indexTerm { $value = new IndexExpr($op.text, $value, $e2.value); })* 
    ;   

indexTerm returns[IndexExpr value]
    : e1=indexFactor { $value = $e1.value; }
        ((op=(MULT|DIVIDE) e2=indexFactor { $value = new IndexExpr($op.text, $value, $e2.value); } ))* 
    ;   

indexFactor returns[IndexExpr value]
    : e=INTEGERCONSTANT  { $value = new IndexExpr($e.text); }
    | op=ROUND LPAREN e1=numericScalarExpr RPAREN  { $value = new IndexExpr($op.text, $e1.value); }
    | (LPAREN e2=indexExpr RPAREN { $value = $e2.value; } ) 
    ;   

Change History (0)

Note: See TracTickets for help on using tickets.