Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#5053 closed defect (fixed)

netcdf driver cannot read netcdf-4 files with UBYTE data

Reported by: etourigny Owned by: etourigny
Priority: normal Milestone: 1.10.1
Component: GDAL_Raster Version: svn-trunk
Severity: normal Keywords:
Cc:

Description

Files that are of unsigned byte data type in the NC4 (netcdf-4) format are incorrectly read. To reproduce do the following

$ gdal_translate -of netcdf -co FORMAT=NC4 byte.tif byte.nc
$ gdalinfo -checksum byte.nc
[...]
ERROR 1: netCDF scanline fetch failed: #-60 (NetCDF: Numeric conversion not representable)
ERROR 1: byte.nc, band 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.

  Checksum=0

The problem does not appear when files are saved in netcdf-4 classic format, because it uses NC_BYTE and not NC_UBYTE.

Also, metadata (such as missval) is not supported if a variable is not stored in NC_UBYTE type.

GDAL_netCDF: NCDFGetAttr unsupported type 7 for attribute _FillValue

Attachments (2)

patch-ubyte-autotest1.txt (3.1 KB ) - added by etourigny 11 years ago.
patch for autotest
patch-ubyte1.txt (3.4 KB ) - added by etourigny 11 years ago.
patch that fixes 2 bugs

Download all attachments as: .zip

Change History (9)

by etourigny, 11 years ago

Attachment: patch-ubyte-autotest1.txt added

patch for autotest

by etourigny, 11 years ago

Attachment: patch-ubyte1.txt added

patch that fixes 2 bugs

comment:1 by etourigny, 11 years ago

Status: newassigned

Attached patches to test and fix the 2 bugs found - waiting to commit before 1.10-RC2 is voted.

comment:2 by Even Rouault, 11 years ago

You can still commit that in trunk for now. And backport later if appropriate

comment:3 by etourigny, 11 years ago

ok - I guess this will not impact 1.10 release, even if rc2 is not promoted to final? I will backport to 1.10 after that. thanks

comment:4 by Even Rouault, 11 years ago

If another rc is needed, it will be based on 1.10 branch, not trunk, so commits in trunk are OK.

comment:5 by etourigny, 11 years ago

committed to trunk in r25919 and r25920 . Will backport to 1.10 after release and then close this ticket

comment:6 by etourigny, 11 years ago

Resolution: fixed
Status: assignedclosed

backported to 1.10 (r25967 and r25968)

comment:7 by Even Rouault, 11 years ago

Milestone: 1.10.1
Note: See TracTickets for help on using tickets.