[Numpy-discussion] 2D array to 3D

2008-04-25 Thread tournesol
Hi All. Is there a easy way to insert 1D(j) array into another 2D array(B:jxk) and conver B to B:ixjxk ? ex:) >>> from numpy import * >>> a=arange(4) >>> a array([0, 1, 2, 3]) >>> b=arange(9) >>> b.shape=3,3 >>> b array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) I just wanna insert A into B B:1x3x3, [

[Numpy-discussion] insert 1D to a 2D array and change it to 3D

2008-04-25 Thread tournesol
Hi All. I just want to conver Fortran 77 source to Python. Here is my F77 source. DIMENSION A(25,60,13),B(25,60,13) open(15,file='data.dat') DO 60 K=1,2 READ(15,1602) ((B(I,J),J=1,60),I=1,25) 60 CONTINUE 1602 FORMAT(15I4) DO 63 K=1,10 DO 6