Error when trying to serve raster of float datatype containing NaN
See original GitHub issue127.0.0.1 - - [13/Jul/2020 00:31:22] "GET /singleband/4918/yield/0101201831012018/preview.png?tile_size=[128,128] HTTP/1.1" 500 -
[-] Exception on /singleband/4918/yield/0101201831012018/preview.png [GET]
Traceback (most recent call last):
File "/home/abhishek/anaconda3/envs/gis_env/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/home/abhishek/anaconda3/envs/gis_env/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/home/abhishek/anaconda3/envs/gis_env/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/abhishek/anaconda3/envs/gis_env/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
raise value
File "/home/abhishek/anaconda3/envs/gis_env/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/home/abhishek/anaconda3/envs/gis_env/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/abhishek/Project/terracotta/terracotta/server/flask_api.py", line 49, in inner
return fun(*args, **kwargs)
File "/home/abhishek/Project/terracotta/terracotta/server/singleband.py", line 152, in get_singleband_preview
return _get_singleband_image(keys)
File "/home/abhishek/Project/terracotta/terracotta/server/singleband.py", line 166, in _get_singleband_image
image = singleband(parsed_keys, tile_xyz=tile_xyz, **options)
File "/home/abhishek/anaconda3/envs/gis_env/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/home/abhishek/Project/terracotta/terracotta/handlers/singleband.py", line 67, in singleband
out = image.to_uint8(tile_data, *stretch_range_)
File "/home/abhishek/Project/terracotta/terracotta/image.py", line 148, in to_uint8
rescaled = contrast_stretch(data, (lower_bound, upper_bound), (1, 255), clip=True)
File "/home/abhishek/anaconda3/envs/gis_env/lib/python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
File "/home/abhishek/Project/terracotta/terracotta/image.py", line 134, in contrast_stretch
out_data -= lower_bound_in
File "/home/abhishek/anaconda3/envs/gis_env/lib/python3.8/site-packages/numpy/ma/core.py", line 4227, in __isub__
self._data.__isub__(np.where(self._mask, self.dtype.type(0),
TypeError: ufunc 'subtract' output (typecode 'O') could not be coerced to provided output parameter (typecode 'd') according to the casting rule ''same_kind''
Issue Analytics
- State:
- Created 3 years ago
- Comments:7
Top Results From Across the Web
Downsides to saving rasters with NaN as no data values?
Generally, it's a lot better to use NaN. I can think of one reason not to, however. NaN only exists with floating-point data...
Read more >Invalid Floating Point Error and Region Settings
It is just at this moment when a new prompt appears with an Invalid Floating Point Error. I did a first try of...
Read more >How to Fix: ValueError: cannot convert float NaN to integer
This error occurs when you attempt to convert a column in a pandas DataFrame from a float to an integer, yet the column...
Read more >How do I handle NA values in R for raster layer with datatype ...
When asking the raster what the NA value I get 'negative infinity' and INT2U values are all positive. The result is that the...
Read more >NoData in raster datasets—Help | ArcGIS for Desktop
Cell values can be either positive or negative, integer, or floating point. Cells can also have a NoData value to represent the absence...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yes, there were two problems:
optimize-rasters
did not work on rasters smaller than(256, 256)
.Done. Feel free to reopen of the problem persists.