sodri126 / netcdf4-python

Automatically exported from code.google.com/p/netcdf4-python
Other
0 stars 0 forks source link

nc3tonc4: fletcher32 checksum causes exception when processing 0-dim Variables #150

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
Create a netCDF3 file containing a 0-dimensional variable (see 
create_example.py).
run "nc3tonc4 --classic=1 --fletcher32=1 outfile.nc outfile4.nc"

What is the expected output? What do you see instead?
This should create a netCDF4-classic version of my input file. Instead it 
throws an Exception:
-----------------
File 
"/usr/lib/python2.7/site-packages/netCDF4-0.9.9-py2.7-linux-x86_64.egg/EGG-INFO/
scripts/nc3tonc4", line 111, in nc3tonc4

  File "netCDF4.pyx", line 2749, in netCDF4.Variable.__setitem__ (netCDF4.c:29718)
  File "netCDF4.pyx", line 2880, in netCDF4.Variable._put (netCDF4.c:30672)
RuntimeError: NetCDF: HDF error
-----------------

What version of the product are you using? On what operating system?
Linux (32bit as well as 64bit), netCDF4 0.9.9, 1.0, 1.0.1

Please provide any additional information below.

I guess the main problem is that 0-dimensional variables cannot contain 
checksums (correct me if I'm wrong, see also: dim0_fletcher.py).
So nc3tonc4 should simply not set fletcher32 for those variables. My 
modification to avoid the problem is the following change in nc3tonc4:
var = ncfile4.createVariable(varname,datatype,ncvar.dimensions, 
fill_value=FillValue, 
least_significant_digit=lsd,zlib=zlib,complevel=complevel,shuffle=shuffle,fletch
er32=fletcher32 if len(ncvar.dimensions) > 0 else False)

Original issue reported on code.google.com by mde.p...@gmail.com on 21 Nov 2012 at 4:04

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed now in svn - thanks.

Original comment by whitaker.jeffrey@gmail.com on 13 Dec 2012 at 1:36

GoogleCodeExporter commented 8 years ago

Original comment by whitaker.jeffrey@gmail.com on 7 Mar 2013 at 11:42