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

Ranges seem to be incorrect #31

Open
alexklaeser opened this issue Nov 12, 2019 · 2 comments
Open

Ranges seem to be incorrect #31

alexklaeser opened this issue Nov 12, 2019 · 2 comments

Comments

@alexklaeser
Copy link

While applying the klvdata module to some test data, I came across an Value error originating here:

raise ValueError

After a while I realized that the min/max values for 16bit integer where implemented in the code as -32767/32767, however, they should be -32768/32767. In my case an entry had the value -32768 and thus caused an error during parsing.

If I am correct, the following line (and alike) should be modified:

_domain = (-(2**15-1), 2**15-1)

... instead it should look like:
_domain = ((-2**15 - 1), 2**15 - 1)

After adjusting all of these occurrences in the file, the parsing of my files was successful.

best regards
Alex

@All4Gis
Copy link
Collaborator

All4Gis commented Nov 12, 2019

Hi, @alexklaeser.

You have the mapping values here.

- Map -(2^15-1)..(2^15-1) to +/-20.
- Use -(2^15) as "out of range" indicator.
- -(2^15) = 0x8000.
- Resolution: ~610 micro degrees.

But,you are right , the correct values for 16 bits is −32,768 to 32,767

This wouldn't be right either _domain = (-(2 ** 31 - 1), 2 ** 31 - 1) because the correcto value for 32 bits is -2147483648 a 2147483647
thanks

@alexklaeser
Copy link
Author

You are welcome :) . I did not check the standard, however, looking at integer ranges, it did make sense to me ;) .

Thank you for providing this nice module!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants