[Numpy-discussion] Migrating Char arrays

Marc Poinot Marc.Poinot at onera.fr
Tue Sep 30 09:22:01 EDT 2003

Hi all,

I'm migrating my pyCGNS package to numarray. I think that numarray is
better suited for the in-memory share of array I'd like to achieve.

Now, with Numeric, I use to create arrays with integers, floats, but 
also char type.

In CGNS (http://www.cgns.org) we have types I4, I8, R4 and R8, but
also C1 which is an array of chars. It looks like, in numarray, we should
consider chars as unsigned ints. This is not false from a system point
of view, but from an application point of view I have to make a difference
between *real* char arrays, and unsigned int arrays. In other words, when
I have a C1 array, I have to translate it as a String, when I have an I4
or even I8, I have to translate it as Integer array. Now I only have
integers arrays, and I have to find out a way to know that my array of int
is a string. The CGNS->numarray translation is OK, but now I'm loosing
information when I'm going back numarray->CGNS.

You can say: It's up to your application to understand that this list of ints
is a string.

I'll reply: So why don't you consider a list of bytes, it's up to the application
to know that you're 32 or 64 bits...

Is there something in numarray that could replace the Numeric interface
for this string type? Is it difficult to add a 'Character' type?
Is the (undocumented) CharArrayType the solution for this?

Marcvs [alias Not using unicode...]

 Marc POINOT             Alias: marcvs        Email: poinot at onera.fr
 ONERA -MFE/DSNA/ELSA    Tel:  Info: elsa-info at onera.fr
 29, Div. Leclerc        Fax:  Site:     
 92322 Chatillon FRANCE  Project: elsA        Web: http://www.onera.fr

More information about the NumPy-Discussion mailing list