Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#1403 closed defect (fixed)

Rasql_Wrong transposition between X and Y axis when encode in netcdf

Reported by: Bang Pham Huu Owned by: bbell
Priority: major Milestone: 9.4
Component: rasql Version: development
Keywords: Cc: Dimitar Misev, Vlad Merticariu
Complexity: Medium

Description (last modified by Dimitar Misev)

The problem is when encode a coverage in netcdf, the output is transposed between X and Y (in case of 2D).

for example: encode rgb 2D in netcdf (the i1 and k3 as dimensions can be random names so try to swap these variables does not help (e.g: i,j to j,i).

Also the transpose option from http://rasdaman.org/wiki/CommonFormatsInterface does not work (i.e: set values to [1,0] or [111,0] does not have any affect).

rasql -q 'SELECT encode(c[0:10,0:3].0, "netcdf" , "{\"dimensions\":[\"i1\", \"k3\"],\"variables\":{

	\"i1\":{\"type\":\"double\",\"data\":[0,2]},

	\"k3\":{\"type\":\"double\",\"data\":[1,2]},
	\"red\":{\"type\":\"unsigned char\",
\"metadata\":{\"units\":\"10^0\"},\"name\":\"red\"}},
\"metadata\":{}}")

 FROM test_rgb AS c' --out file

when use gdalinfo to show bounding box (wrong: size X(4), size Y (11))

Size is 4, 11
Coordinate System is `'
Metadata:
  red#units=10^0
  red#valid_max=255
  red#valid_min=0
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,   11.0)
Upper Right (    4.0,    0.0)
Lower Right (    4.0,   11.0)
Center      (    2.0,    5.5)

if encode in png

rasql -q 'select encode(c[0:10,0:3].0, "png") from test_rgb as c' --out file

the bounding box is expected (size X: 11, size Y: 4)

Size is 11, 4
Coordinate System is `'
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0,    4.0)
Upper Right (   11.0,    0.0)
Lower Right (   11.0,    4.0)
Center      (    5.5,    2.0

Change History (14)

comment:1 by Dimitar Misev, 8 years ago

Description: modified (diff)

Yes transpose is not implemented at the moment.

comment:2 by Dimitar Misev, 8 years ago

We need to implement the transpose format parameter, documented here: http://rasdaman.org/wiki/CommonFormatsInterface

It can be restricted to the last two dimensions for now which makes it very simple to support. The function to do this is already implemented:
http://rasdaman.org/browser/conversion/convertor.hh#L173

And it's used in conversion/grib.cc at the moment. We just need to invoke it in conversion/netcdf.cc in case transpose is specified in the format parameters.

comment:3 by Dimitar Misev, 8 years ago

Owner: changed from Dimitar Misev to drusu
Status: newassigned

comment:4 by Bang Pham Huu, 8 years ago

NOTE: not every netCDF file is in variable order (Lat, Long) which will be flipped when displaying. If input coverage is in order (Long, Lat) respectively, it will be displayed correctly.

http://www.unidata.ucar.edu/software/netcdf/examples/tos_O1_2001-2002.cdl

so WCPS can know when should use the transposition from the axis order.

comment:5 by Vlad Merticariu, 8 years ago

CF compliant ones will always be flipped.
But indeed, we should be able to differentiate, maybe at import. We need to discuss this in a f2f meeting next week.

comment:6 by Dimitar Misev, 8 years ago

Owner: changed from drusu to bbell

comment:7 by Dimitar Misev, 8 years ago

Danut, can you attach a patch of the modifications (including the test) that you did so far?

comment:8 by Dimitar Misev, 8 years ago

Milestone: 9.39.4

comment:9 by Dimitar Misev, 8 years ago

Resolution: fixed
Status: assignedclosed

comment:10 by Dimitar Misev, 8 years ago

Bang, do we have transpose option in wcst_import recipes?

in reply to:  10 comment:11 by Bang Pham Huu, 8 years ago

Replying to dmisev:

Bang, do we have transpose option in wcst_import recipes?

don't have this option yet.

comment:12 by Vlad Merticariu, 8 years ago

Let's discuss how we want to achieve this in the group meeting today. We have 2 options when importing netcdf:

  • transpose at ingest time, deliver as is for any format except netcdf and apply traspose again when delivering netcdf
  • store the data as is, deliver as is for netcdf, deliver transposed for all others.

We will need to think about how to store this information in the coverage.

comment:13 by Bang Pham Huu, 8 years ago

I thik it should be consistent, when ingesting with 1 option tranpose_enable: true, it will transpose when ingesting coverage and getCoverage without regarding to any format types.

comment:14 by Dimitar Misev, 8 years ago

It would be good in any case to be able to specify during ingestion which option is preferred, as both are effective in different situations:

  1. Preferable if the data is primarily exported for visualization in common 2D formats
  2. Preferable if the data is primarily exported in netcdf
Note: See TracTickets for help on using tickets.