Hi Dominik,

El dj 21 de 06 del 2007 a les 14:26 +0200, en/na Dominik Szczerba va
escriure:
> Hi,
> Is there an easy way to merge hdf5 datasets in pytables?

What kind of datasets? The most easy way for merging Table objects is
Table.whereAppend() method. See:

http://www.pytables.org/docs/manual/ch04.html#Table_methods

for more info.

For Array objects, you can always iterate over one array and append it
row to row to the other.  Look at this example:

In [1]:import numpy
In [2]:import tables
In [3]:f=tables.openFile('/tmp/test.h5', 'w')
In [4]:e1=f.createEArray(f.root, 'array1', tables.Float64Atom(),
shape=(0,300))
In [5]:e2=f.createEArray(f.root, 'array2', tables.Float64Atom(),
shape=(0,300))
In [6]:e1.append(numpy.empty(shape=(200,300)))In
[7]:e2.append(numpy.empty(shape=(200,300)))
In [8]:for row in e1:
   ...:    e2.append(row[numpy.newaxis,:])  # append e1 rows to e2
   ...:
In [9]:e2
Out[9]:
/array2 (EArray(400L, 300)) ''
  atom := Float64Atom(shape=(), dflt=0.0)
  maindim := 0
  flavor := 'numpy'
  byteorder := 'little'

Of course, you can always add complexity to the "for row in e1:" loop in
order to conveniently filter the desired subset of rows.

> I cannot google it out anywhere.
> I have unstructured sub-meshes coming from domain decomposition and I
> want to stich them back together. They share some nodes on the
> sub-domain boundaries so I want to stitch them in a clever way (like
> AppendDatasets and CleanToGrid in Paraview). Any options available?

I have no experience with Paraview.  If the solution above doesn't work
for you, ask again please.

-- 
Francesc Altet    |  Be careful about using the following code --
Carabos Coop. V.  |  I've only proven that it works, 
www.carabos.com   |  I haven't tested it. -- Donald Knuth


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Pytables-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to