Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
shckltn opened this issue Dec 23, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@shckltn
Copy link

shckltn commented Dec 23, 2024

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.

@shckltn shckltn changed the title Float and Unsigned Int SIO not supported in SIOReader() - ([3,4]) & ([1,1]) SIO Headers Float and Unsigned Int SIO not supported in SIOReader() - [3,4] & [1,1] SIO Headers Dec 23, 2024
@pressler-vsc pressler-vsc added the enhancement New feature or request label Dec 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants