Thank you very much for such a quick response

I think specifying max for the string lenght
is sufficient (they are actually 64K text fields,
but I am thinking that I will create another array
that contains max true string length for a given dimension,
and use that array to set 'itemsize' )).


One more clarification question, if my file is netCDF4
and uses compression, will pyTables work (in python 2.5 or 2.6)?
or will I have to rebuild pyTables with new netCDF4/hdf5 C libraries


thank you again




> Strings are supported in PyTables as long as they are fixed length.  If 
> you want to work with strings with variable length, this can be faked 
> by using the provisions that PyTables/NumPy has to represent variable 
> length strings coming from fixed length ones.  For example:
> 
> In [1]: import tables
> 
> In [2]: f = tables.openFile("/tmp/file.h5", "w")
> 
> In [3]: a = f.createArray("/", "dstring", ["123", "123456789"])
> 
> In [4]: a
> Out[4]:
> /dstring (Array(2,)) ''
>   atom := StringAtom(itemsize=9, shape=(), dflt='')
>   maindim := 0
>   flavor := 'python'
>   byteorder := 'irrelevant'
>   chunkshape := None
> 
> In [5]: a[0]
> Out[5]: '123'
> 
> In [6]: a[1]
> Out[6]: '123456789'
> 
> As you see, you are retrieving "variable" length strings out of 
> the "dstring" dataset, even though they are saved as regular fixed 
> length ones in HDF5.
> 
> Fixed length string implementation in PyTables is similar to VARCHAR 
> type in relational databases in that you choose a maximum length 
> (MAXLEN) for your types.  This means that they take MAXLEN bytes for 
> each string type.  However, that additional space consumption can be 
> minimized if you use on-disk compression.
> 
> > Also, (this is a separate question) -- is Python 3.0 support
> > something that you plan to make available this year?
> 
> I'd like to, but it happens that PyTables depends on NumPy, and they 
> don't have announced plans for Python 3.0 support yet (in fact, even 
> compiling NumPy for Python 2.6 and Windows platforms is not supported 
> yet).  As soon as NumPy would add support for Python 3.0, I'll start 
> adding the support for PyTables too.  Having said this, PyTables trunk 
> (as well as NumPy indeed) already works flawlessly against Python 2.6, 
> and as you may know, having this done, the support for 3.0 should be 
> rather easy.
> 
> Cheers,
> 
> -- 
> Francesc Alted
-- 
  V S P
  [EMAIL PROTECTED]

-- 
http://www.fastmail.fm - The professional email service


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Pytables-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to