Wed 29 Oct 2014 06:41:33 PM UTC, original submission:
It seems there is a bug when processing unsigned 16-bit tifs with pkfilter. When I try to set the -nodata flag to 65535, it returns a ‘BadConversion’ error and crashes. But if I first recast the data to a signed 16-bit integer, with a new nodata value (-32768), it works… See below for example with attached files… Seems like it doesn’t like a missing value of 65535…
$ gdalinfo test_signed16.tif
Driver: GTiff/GeoTIFF
Files: test_signed16.tif
Size is 240, 600
Band 1 Block=240x17 Type=Int16, ColorInterp=Gray
Min=169.429 Max=19693.833
Minimum=169.429, Maximum=19693.833, Mean=nan, StdDev=nan
NoData Value=-32768
$ gdalinfo test_unsigned16.tif
Driver: GTiff/GeoTIFF
Files: test_unsigned16.tif
Size is 240, 600
Band 1 Block=240x17 Type=UInt16, ColorInterp=Gray
Min=169.429 Max=19693.833
Minimum=169.429, Maximum=19693.833, Mean=nan, StdDev=nan
NoData Value=65535
$ pkfilter -nodata -32768 -dx 21 -dy 21 -f stdev -circ TRUE -i test_signed16.tif -o testout.tif
0...10...20...30...40...50...60...70...80...90...100 - done.
$ pkfilter -nodata -32768 -dx 21 -dy 21 -f stdev -circ TRUE -i test_unsigned16.tif -o testout.tif
0...10...20...30...40...50...60...70...80...90...100 - done.
$ pkfilter -nodata 65535 -dx 21 -dy 21 -f stdev -circ TRUE -i test_unsigned16.tif -o testout.tif
terminate called after throwing an instance of 'BadConversion'
what(): 65535
Aborted (core dumped)
I expect that the third example above would run using the correct 65535 nodata value, but instead it crashes…
Thanks for this wonderful software!
|