You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i am reading a COG and upon opening I am getting the following error
async with COGReader(cog_url) as cog:
print(cog.nodata)
Traceback (most recent call last): File "/work/py/hrea-zarr/pipeline/core.py", line 54, in <module> asyncio.run( File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/work/py/hrea-zarr/pipeline/core.py", line 13, in read_cog print(cog.nodata) File "/work/python/aiocogeo/aiocogeo/cog.py", line 278, in nodata return self.ifds[0].nodata File "/work/python/aiocogeo/aiocogeo/ifd.py", line 167, in nodata return int(self.NoData.value[0]) if self.NoData else None ValueError: invalid literal for int() with base 10: b'-'
upon a closer lock, the code is trying to convert the NoData tag into an int
Is there an example file you can point to? Seems like an easy fix and would love to take a crack at it but would want to be able to test it with the same data currently causing the error. Assuming this isn't occurring for most/all cog files.
i am reading a COG and upon opening I am getting the following error
Traceback (most recent call last): File "/work/py/hrea-zarr/pipeline/core.py", line 54, in <module> asyncio.run( File "/usr/lib/python3.8/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete return future.result() File "/work/py/hrea-zarr/pipeline/core.py", line 13, in read_cog print(cog.nodata) File "/work/python/aiocogeo/aiocogeo/cog.py", line 278, in nodata return self.ifds[0].nodata File "/work/python/aiocogeo/aiocogeo/ifd.py", line 167, in nodata return int(self.NoData.value[0]) if self.NoData else None ValueError: invalid literal for int() with base 10: b'-'
upon a closer lock, the code is trying to convert the NoData tag into an int
the self.NoData attr is
Tag(code=42113, name='NoData', count=25, tag_type=TagType(format='c', size=1), length=25, value=(b'-', b'3', b'.', b'3', b'9', b'9', b'9', b'9', b'9', b'9', b'9', b'9', b'9', b'9', b'9', b'9', b'9', b'9', b'9', b'6', b'e', b'+', b'3', b'8', b'\x00'))
which is a tuple of 1 character bytes objects
Now I am not sure whether the COG file is wrong or aiocogeo is not reading this correctly.
A quick solution that could fix this :
This basically strips the zero terminated string and tries to convert it into an int and then float number.
The text was updated successfully, but these errors were encountered: