Open barronh opened 2 hours ago
Thanks for sharing this issue. You and I went around a bit via email. I was unable to reproduce the problem on Linux or Mac systems even with the file you shared. However, on my Windows machine it to failed right away even without the file you shared.
Turns out it is an easy to fix. I’ll incorporate the update in a new release with some other updates.
In the meantime, you can directly edit your installation super easily.
Change the '>l' to '>i8' on line 322 of C:\Users\byeon\AppData\Roaming\Python\Python310\site-packages\pyrsig\xdr.py
The problem actually happens in several other readers, so you could also just find and replace all '>l' to '>i8'.
When I make that change, it works great on Mac, Linux, and Windows.
The root of the problem is related to interpretation of datatype and char representation. The xdr file is being read in binary mode and decoding byes as long-integers (64-bit aka 8-byte) using big-endian representation. On Linux and Mac, '>i' is interpreted as '>i4' (i.e, 4-byte) and '>l' is interpreted as '>i8' (i.e., 8-byte). On Windows, it weirdly interprets both '>i' and '>l' as '>i4'… and '>q' as '>i8'… who knows why. You can see though that Windows would get 2 values for every 1 and they would be garbage data. All systems interpret '>i8' the same (8-byte), so problem is solved by using the longer code.
Hi Barron,
Thanks for sharing wonderful codes as usual. I started some test runs for your example codes on my end to see if we can adopt your code base for our work.
For GIS TropOMI Processing, I used plot_shapefile.py
However, I encountered an error with the “xdr” option. The code works ok with the “ascii” option. I did not study hard your pyrsig code yet but can do if needed. I suspect that the error is due to a possible change in TROPOMI meta data change since you posted your example code.
Here is the error log.
Please let me know if you need more information such as my library version, etc. At this stage, I don’t know what information you may need or you can replicate the error on your end.
... cutting other discussion ...
-Byeong