sodri126 / netcdf4-python

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

Patch for TypeError: data type "S8L" not understood #169

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Using svn master on win-amd64-py2.x, the following tests fail:

ERROR: runTest (tst_compoundatt.VariablesTestCase)

testing compound attributes

Traceback (most recent call last): File "netcdf4-svn\test\tst_compoundatt.py", line 69, in runTest assert(chartostring(v.units['speed']).item().rstrip().decode(default_encoding) == 'm/s') File "utils.pyx", line 86, in netCDF4.chartostring (netCDF4.c:3331)

TypeError: data type "S8L" not understood

ERROR: runTest (tst_stringarr.StringArrayTestCase)

testing functions for converting arrays of chars to fixed-len strings

Traceback (most recent call last): File "netcdf4-svn\test\tst_stringarr.py", line 45, in runTest data2 = chartostring(v[nrec]) File "utils.pyx", line 86, in netCDF4.chartostring (netCDF4.c:3331) TypeError: data type "S12L" not understood


Consider this patch, which fixes the issue up to 2**31-1:

Index: utils.pyx

--- utils.pyx (revision 1232) +++ utils.pyx (working copy) @@ -83,7 +83,7 @@ raise ValueError("type must string or unicode ('S' or 'U')") bs = b.tostring().decode(default_encoding) slen = b.shape[-1]

Original issue reported on code.google.com by cjgoh...@gmail.com on 12 Mar 2013 at 12:10

GoogleCodeExporter commented 9 years ago
OK - committed something similar to what you suggested (svn revision 1233).  
Can you test?

Original comment by whitaker.jeffrey@gmail.com on 12 Mar 2013 at 1:52

GoogleCodeExporter commented 9 years ago
Revision 1233 works too. Thanks.

Original comment by cjgoh...@gmail.com on 12 Mar 2013 at 2:01

GoogleCodeExporter commented 9 years ago
Thanks Christoph, closing this issue.

Original comment by whitaker.jeffrey@gmail.com on 12 Mar 2013 at 3:44