Opened 15 years ago
Closed 15 years ago
#3152 closed defect (fixed)
HFA doesn't support reading COMPRESSED + SIGNEDBYTE
Reported by: | Even Rouault | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.6.3 |
Component: | GDAL_Raster | Version: | 1.6.2 |
Severity: | normal | Keywords: | |
Cc: | jjr8 |
Description
The following snippet :
import gdal driver = gdal.GetDriverByName('HFA') dataset = driver.Create(r'test2_int8d.img', 5, 3, 3, gdal.GDT_Byte, ['COMPRESSED=YES', 'PIXELTYPE=SIGNEDBYTE']) band = dataset.GetRasterBand(1) band.Fill(0) band.FlushCache() print band.Checksum()
raises the following error :
ERROR 1: Attempt to uncompress an unsupported pixel data type. ERROR 1: IReadBlock failed at X offset 0, Y offset 0 ERROR 1: GetBlockRef failed at X block offset 0, Y block offset 0 ERROR 3: Checksum value couldn't be computed due to I/O read error.
Change History (2)
comment:1 by , 15 years ago
Milestone: | → 1.6.3 |
---|---|
Version: | unspecified → 1.6.2 |
comment:2 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Summary: | HFA + COMPRESSED + SIGNEDBYTE + FlushCache()+ Read = FAIL → HFA doesn't support reading COMPRESSED + SIGNEDBYTE |
Fixed in trunk (r17690) and branches/1.6 (r17691).
For the record, you never need to call FlushCache() explicitely. The HFA driver was just missing reading back compressed s8 files. Without FlushCache() the whole data for a small file was fitting into the GDAL block cache. FlushCache() flushed it to disk and wiped the cache. Then GetStatistics() or Checksum() need to read it from the disk, hence the error.
8192 * 4096 * 1 band = 33.5 MB < 40 MB, the default size of the block cache, so you probably wouldn't need the fix. If the raster is larger, GDAL will necessarily need to flush blocks to disk and read them back later
This repros in 1.6.2. Changing the milestone to 1.6.3 so it comes up on your radar. Please adjust appropriately.
The original scenario was that I wanted to calculate statistics after writing a band. It seemed like a good idea to flush the band before calculating statistics:
If it is possible to successfully calculate statistics for a large raster (8192x4096) without calling FlushCache first, then I am happy to omit the FlushCache and this becomes a lower priority issue for me. Please advise me on the possibility of that. If it is not possible, then I would appreciate if this were fixed relatively soon. Thanks for your consideration.
Note that the statistics values for SIGNEDBYTE datasets were not correct until #3151 was fixed.