Opened 2 years ago

Closed 21 months ago

#2610 closed feature (fixed)

Flip Operator

Reported by: aburamadan Owned by: Dimitar Misev
Priority: minor Milestone: 10.0
Component: qlparser Version: 10.0
Keywords: flip Cc: Dimitar Misev, Peter Baumann
Complexity: Medium

Description

Implement FLIP operator that can flip/reverse an MDD at a given axis.

Change History (9)

comment:1 by Bang Pham Huu, 2 years ago

@adnan the doc needs to be updated

https://i.imgur.com/bedDoMX.png

changed to: Flipping the array on its first axis (columns)

flipping on the second axis (rows)

comment:2 by Bang Pham Huu, 2 years ago

  • The examples in this text below should be changed from raster to raster2D.
Flipping the array on its first axis (rows), by using:

FLIP raster ALONG 0

and flipping on the second axis (columns), by using:

FLIP raster ALONG 1

yields the following results, respectively:

  • And the examples after this text below:
In a more visualised example, applying the flip operation on the sample MRT imagery collection mr2, will mirror the image vertically or horizontally. The original image looks as follows:

should not use raster collection like:

FLIP raster ALONG 0

it should be changed to:

FLIP m2 ALONG 0

and

FLIP m2 ALONG 1

comment:3 by Bang Pham Huu, 2 years ago

If the axis to be flipped doesn't belong to the generalExp, e.g.

rasql -q 'select encode(flip c along 2, "png") from mr2 as c' --out file
rasql: rasdaman query tool 10.0.3.
Opening database RASBASE at 127.0.0.1:7001... ok.

Executing retrieval query... rasdaman error 316: no explanation text available for error code 316

The error message should have details about it.

comment:4 by Bang Pham Huu, 2 years ago

There is a segfault for this rasql query.

SELECT encode(FLIP c + 20 ALONG i, "jpeg" , "{\"metadata\":{\"resolution\":\"1\"},\"nodata\":[]}")  FROM mr2 AS c'... parsing... checking semantics... 

[ERROR] - 2022-06-20 13:43:01,911, server/rasserver_main.cc:117: Interrupted by signal SIGSEGV (Invalid memory access at address 0x55)... stacktrace:
 [1] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x5253b3]
 [2] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x4b2069]
 [3] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x48b841]
 [4] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x44dd0a]
 [5] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x4258d6]
 [6] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x76cb96]
 [7] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x71cd26]
 [8] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x72c7f4]
 [9] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x735c51]
[10] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x87129e]
[11] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x87370b]
[12] /home/rasdaman/rasdaman_community/install/bin/rasserver() [0x87381c]
[13] /lib64/libstdc++.so.6(+0xb5330) [0x7f3267ab5330]
[14] /lib64/libpthread.so.0(+0x7dd5) [0x7f3268164dd5]
[15] ??:0 in clone+0x6d [0x7f326282902d]

it works fine with:

SELECT encode(FLIP c + 30 ALONG 0, "jpeg" , "{\"metadata\":{\"resolution\":\"1\"},\"nodata\":[]}")  FROM mr2 AS c

comment:5 by Bang Pham Huu, 2 years ago

Another error with flip on 3D collection (in systemtest/testcases_services/test_all_wcst_import/testdata/088-wcs_3D_Timeseries_Irregular

rasql -q 'SELECT encode(FLIP c + 20 ALONG 0, "json") FROM test_AverageChloro AS c

with error

rasdaman error 356: Execution error 356 in line 1, column 15, near token FLIP: 
Specified domain does not intersect with spatial domain of MDD.

sdom() of this collection is:

rasql -q 'select sdom(c) from test_AverageChloro as c' --out string

[-5:0,0:13,0:6]

comment:6 by Bang Pham Huu, 2 years ago

Another issue is about encode(FLIP with netcdf), for example this test collection in systemtest:

 SELECT encode( ( FLIP c[0:10,0] ALONG 0 ) , "netcdf" , "{\"dimensions\":[\"Lon\"],\"variables\":{\"Lon\":{\"type\":\"double\",\"data\":[112.225,112.725,113.225,113.725,114.225,114.725,115.225,115.725,116.225,116.725,117.225],\"name\":\"Lon\",\"metadata\":{}},\"Gray\":{\"type\":\"char\",\"name\":\"Gray\",\"metadata\":{\"description\":\"\",\"units\":\"10^0\"}}},\"nodata\":[]}")  FROM test_mean_summer_airtemp AS c

with error

raslib/minterval.cc:305: interval index 1 out of bounds on minterval [0:10]
Exception: Index violation ( index range [0,0], index 1 ).

comment:7 by Dimitar Misev, 2 years ago

Owner: changed from aburamadan to Dimitar Misev

I improved the docs (comment:1 and comment:2), the error handling still needs to be fixed.

comment:8 by Bang Pham Huu, 2 years ago

can this be closed?

comment:9 by Dimitar Misev, 21 months ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.