Skip to content

Float and Unsigned Int SIO not supported in SIOReader() - [3,4] & [1,1] SIO Headers #574

@shckltn

Description

@shckltn

It seems when I try to use sarpy's SIOReader on sio data with types other than complex I run into issues.

I see the following errors when attempting to read in float / real data (4 byte elements) and uint (1 byte elements):

Float 4 bytes [3, 4]

    sioReader = SIOReader(sioFileName)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\username\AppData\Local\Programs\Python\Python311\Lib\site-packages\sarpy\io\complex\sio.py", line 301, in __init__
    sio_details = SIODetails(sio_details)
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\username\AppData\Local\Programs\Python\Python311\Lib\site-packages\sarpy\io\complex\sio.py", line 75, in __init__
    raise SarpyIOError(_unsupported_pix_size.format(init_head[2:]))
sarpy.io.general.base.SarpyIOError: Got unsupported sio data type/pixel size = `[3 4]`

Unsigned Int 1 byte [1, 1]

    sioReader = SIOReader(sioFileName)
                ^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\username\AppData\Local\Programs\Python\Python311\Lib\site-packages\sarpy\io\complex\sio.py", line 301, in __init__
    sio_details = SIODetails(sio_details)
                  ^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\username\AppData\Local\Programs\Python\Python311\Lib\site-packages\sarpy\io\complex\sio.py", line 75, in __init__
    raise SarpyIOError(_unsupported_pix_size.format(init_head[2:]))
sarpy.io.general.base.SarpyIOError: Got unsupported sio data type/pixel size = `[1 1]`

The sarpy code in question (Link to code):

            # reader basic header - (rows, columns, data_type, pixel_size)?
            init_head = numpy.array(struct.unpack('{}4I'.format(endian), fi.read(16)), dtype=numpy.uint64)
            if not (numpy.all(init_head[2:] == numpy.array([13, 8]))
                    or numpy.all(init_head[2:] == numpy.array([12, 4]))
                    or numpy.all(init_head[2:] == numpy.array([11, 2]))):
                raise SarpyIOError(_unsupported_pix_size.format(init_head[2:]))
            self._head = init_head

As far as I am aware the following is the decoder for the SIO header information:

    SIO_TYPE_U:             1  - Unsigned Integer 
    SIO_TYPE_S:             2  - Signed Integer 
    SIO_TYPE_F:             3  - Float
    SIO_TYPE_CU:            11 - Complex Unsigned Integer (interleaved)
    SIO_TYPE_CS:            12 - Complex Signed Integer (interleaved) 
    SIO_TYPE_CF:            13 - Complex Float (interleaved)
    SIO_TYPE_NU:            21 - Arbitrary Unsigned Type
    SIO_TYPE_NS:            22 - Arbitrary Signed Type

In case this wasn't already known, I just wanted to put it out there. Let me know if I am missing something.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions