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

Open file and immediately save it makes exception #34

Open
culebron opened this issue Mar 20, 2018 · 3 comments
Open

Open file and immediately save it makes exception #34

culebron opened this issue Mar 20, 2018 · 3 comments
Labels

Comments

@culebron
Copy link

culebron commented Mar 20, 2018

I open ASTER DEM file with such simple code:
ds = gr.from_file(input_file)
ds.to_tiff('/tmp/test')

And it makes exception:

  File "store_gridfs.py", line 13, in main
ds.to_tiff('/tmp/test')
  File ".../georasters.py", line 478, in to_tiff
self.raster.data[self.raster.mask] = self.nodata_value
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

I tried shielding it with an if closure, but then it made another exception:

  File ".../georasters.py", line 122, in create_geotiff
    if isinstance(datatype, np.int) == False:
  File "/usr/local/lib/python3.6/dist-packages/numpy/ma/core.py", line 3353, in __setitem__
    _data[indx] = dval

You usually expect open and save methods to work seamlessly.

@culebron
Copy link
Author

In #33 , I added checks of masked data length and converting ndv to double. But check if it works in earlier python versions.

@ozak
Copy link
Owner

ozak commented Mar 20, 2018

I wonder if this is related to #28? What do you get when requesting ds.nodata_value? I thought about forcing a NDV on the raster fi missing, but that may cause issues so perhaps it would be best to just add an error message that is more informative.

@ozak ozak added the bug label May 28, 2020
@ozak
Copy link
Owner

ozak commented May 28, 2020

@culebron were you able to test this (#33)? Or can you share the file you were using?

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

No branches or pull requests

2 participants