Opened 6 years ago

Closed 6 years ago

#1675 closed defect (fixed)

python rasql client using rasdapy

Reported by: Dimitar Misev Owned by: Bang Pham Huu
Priority: major Milestone: 9.6
Component: systemtest Version: development
Keywords: Cc: Peter Baumann, Vlad Merticariu
Complexity: Medium

Description

Write a simple rasql client in python using the rasdapy API to connect and execute commands. You can get an example of how it should be structured approximately and what options it should support by looking at the source code of source:applications/rasql/rasql.cc and rasql --help.

Then with this client execute the queries in source:systemtest/testcases_mandatory/test_select, outputs should match the oracles.

I think it will be good to have this in the systemtest for testing rasdapy and as an example of how to use rasdapy.

Change History (5)

comment:1 by Bang Pham Huu, 6 years ago

There is a problem, result from RasdaPy always is an array (e.g: result of encode(test_mr[0:2, 0:2], "png")) will be an array with size [0:20, 0:20]) and some additional values).

Not sure it is identical as output in test_select (csv, png, netcdf,…)

comment:2 by Dimitar Misev, 6 years ago

That sounds like a bug, result of encode should be a 1D char/byte array.

in reply to:  2 comment:3 by Bang Pham Huu, 6 years ago

Replying to dmisev:

That sounds like a bug, result of encode should be a 1D char/byte array.

Assume it contain the metadata for png, it still needs somehow to save this array to png image then to compare with oracle file which requires additional libraries for python.

comment:4 by Bang Pham Huu, 6 years ago

There is a bug for rasdapy on this ticket: http://rasdaman.org/ticket/1676 will cause the output from rasdapy is less than oracle by rasql 1 byte.

Dimitar also found that, the numpy ndarray in rasdapy from rasql encode, can just save to binary (with unsigned int 8 bits) and it will be in correct format without any additional library (like scipy, matplotlib) as I concerned.

        rasql_query = 'select encode(c, "png") from test_mr as c'
        data = ConfigManager.execute_read(rasql_query)
        print data.to_array().shape
        data.to_array().astype('uint8').tofile(ConfigManager.script_dir + "/test.png")

comment:5 by Bang Pham Huu, 6 years ago

Milestone: 9.59.6
Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.