Opened 4 years ago

Closed 4 years ago

Last modified 4 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 4 years ago.
patch for autotest
patch-ubyte1.txt (3.4 KB) - added by etourigny 4 years ago.
patch that fixes 2 bugs

Download all attachments as: .zip

Change History (9)

Changed 4 years ago by etourigny

Attachment: patch-ubyte-autotest1.txt added

patch for autotest

Changed 4 years ago by etourigny

Attachment: patch-ubyte1.txt added

patch that fixes 2 bugs

comment:1 Changed 4 years ago by etourigny

Status: newassigned

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

comment:2 Changed 4 years ago by Even Rouault

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

comment:3 Changed 4 years ago by etourigny

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 Changed 4 years ago by Even Rouault

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

comment:5 Changed 4 years ago by etourigny

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

comment:6 Changed 4 years ago by etourigny

Resolution: fixed
Status: assignedclosed

backported to 1.10 (r25967 and r25968)

comment:7 Changed 4 years ago by Even Rouault

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