Opened 12 years ago
Closed 9 years ago
#360 closed defect (fixed)
Wrong substitution for variables labels in a WCPS trimming operation
Reported by: | Piero Campalani | Owned by: | Alex Dumitru |
---|---|---|---|
Priority: | major | Milestone: | 9.2 |
Component: | petascope | Version: | development |
Keywords: | variable labels condense construct | Cc: | mantovani@…, Vlad Merticariu |
Complexity: | Medium |
Description
When an over
clause is used to define custom axes, the variable labels which are then used in the following clause (over
or using
, depending whether it is a coverage constructor or a condense operation) are badly translated (to 0s) when used inside a trimming operation.
E.g.
for c in (mean_summer_airtemp) return encode( coverage mincov over $px x (100:101) values min(c[x:"CRS:1"($px:$px + 1), y:"CRS:1"(300)] ) ), "csv")
Translates to the following RasQL query
SELECT csv(marray i_i in [100:101] values min_cells((c) [0:0,300])) FROM mean_summer_airtemp AS c
which instead should look like this:
SELECT csv(marray i_i in [100:101] values min_cells((c) [i_i[0]:i_i[1],300])) FROM mean_summer_airtemp AS c
The same holds for a condense operation, e.g.:
for c in (mean_summer_airtemp) return encode( condense + over $px x (100:101) using min(c[x:"CRS:1"($px:$px+1), y:"CRS:1"(300:300)] ) ), "csv")
Change History (10)
comment:1 by , 12 years ago
Resolution: | → duplicate |
---|---|
Status: | new → closed |
comment:2 by , 12 years ago
Milestone: | 9.0 |
---|
comment:3 by , 11 years ago
Cc: | added |
---|---|
Resolution: | duplicate |
Status: | closed → reopened |
Re-opening since this does not work on a temporal dimension now:
for c in (eobstest) return encode ( coverage averaged_pixel_history over $t t(0:1) a) values max(c[Lat(0), Long(51), t:"CRS:1"($t:$t)]) b) values max(c[Lat(0), Long(51), t:"CRS:1"($t:$t+1)]) c) values max(c[Lat(0), Long(51), t:"CRS:1"($t:1+$t)])
Stack trace:
java.lang.NumberFormatException: For input string: "i_i[0]" at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65) at java.lang.Integer.parseInt(Integer.java:492) at java.lang.Integer.parseInt(Integer.java:527) at petascope.util.WcsUtil.toInt(WcsUtil.java:571) at petascope.util.WcsUtil.min(WcsUtil.java:536) at petascope.wcps.server.core.TrimCoverageExpr.computeRasQL(TrimCoverageExpr.java:174) ...
It works on spatial ones, but not when then variable is first operand and the operator is not preceded by a white space:
for c in (eobstest) return encode ( coverage averaged_pixel_history over $t x (0:1) values max(c[Lat(0:1), Long:"CRS:1"($t:$t)]) -> OK values max(c[Lat(0:1), Long:"CRS:1"($t:1+$t)]) -> OK values max(c[Lat(0:1), Long:"CRS:1"($t:$t + 1)]) -> OK values max(c[Lat(0:1), Long:"CRS:1"($t:$t+1)]) -> ERROR , "csv" ) }}]
comment:4 by , 11 years ago
Version: | 8.4 → development |
---|
comment:5 by , 11 years ago
Apparently, this is somehow not related to the type of dimension, but to the variable name. e.g. using $x
instead of $t
as name gives error:
for c in (eobscov) return encode ( coverage averaged_pixel_history over $x x (0:2) values max(c[Long:"CRS:1"($x:$x), Lat(0)]) , "csv") Error: For input string: "i_i[0]"
The same error message returned by the queries reported in comment:3.
comment:7 by , 11 years ago
Owner: | changed from | to
---|---|
Status: | reopened → assigned |
comment:8 by , 10 years ago
Milestone: | → 9.1 |
---|
comment:9 by , 9 years ago
Cc: | added |
---|---|
Milestone: | 9.1 → 9.2 |
Owner: | changed from | to
comment:10 by , 9 years ago
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
The patch was accepted, close here, thanks.
Closing this as it seems a duplicate of #335.