[f2py] Re: Segmentation fault
polar_trond at hotmail.com
polar_trond at hotmail.com
Sat Dec 13 06:56:08 EET 2008
Hi all.I figured out my problem with segmentation fault. It turned out to b=
e a corrupt copy of numpy that was the problem. I upgraded to version 1.3 a=
nd all is fine. Still, I do have one problem. My Fortran subroutine runs fi=
ne, however I have trouble returning the results to the python main program=
. I want to return a 3D array. When I access a slice of the array in fortra=
n, the values look good, but when returned in python the value of the array=
is "None". The 3D array is sent as a zeros array into fortran and then wit=
h the intention of being filled with values and returned to python. This is=
how the top of the subroutine looks like (outdat is the array of interest)=
:subroutine doVertInter(dat,outdat,zr,zs,Nroms,Nsoda,II,JJ) =
double precision rz2, rz1 integer II, JJ, ic, jc, kc, kT,=
Nsoda, Nroms double precision, dimension(Nsoda,JJ,II) :: dat =
double precision, dimension(Nroms,JJ,II) :: zr, outdat =
double precision, dimension(Nsoda) :: zs !cf2py intent(in) dat, zr, =
zs, Nroms, Nsoda!cf2py intent(out) outdat!cf2py intent(hide) ic,jc,kc,kT,rz=
1,rz2,JJ,II....The .pyf file looks like this:python module vertInterp ! in =
interface ! in :vertInterp module interpolation ! in :vertInter=
p:verticalInterp.f90 subroutine dovertinter(dat,outdat,zr,zs,nro=
ms,nsoda,ii,jj) ! in :vertInterp:verticalInterp.f90:interpolation =
double precision dimension(nsoda,jj,ii) :: dat double =
precision dimension(nroms,jj,ii),depend(jj,ii) :: outdat dou=
ble precision dimension(nroms,jj,ii),depend(nroms,jj,ii) :: zr =
double precision dimension(nsoda),depend(nsoda) :: zs int=
eger optional,check(shape(outdat,0)=3D=3Dnroms),depend(outdat) :: nroms=3Ds=
hape(outdat,0) integer optional,check(shape(dat,0)=3D=3Dnsod=
a),depend(dat) :: nsoda=3Dshape(dat,0) integer optional,chec=
k(shape(dat,2)=3D=3Dii),depend(dat) :: ii=3Dshape(dat,2) int=
eger optional,check(shape(dat,1)=3D=3Djj),depend(dat) :: jj=3Dshape(dat,1) =
end subroutine dovertinter end module interpolation en=
d interface end python module vertInterpI am having trouble figuring this o=
ut. I appreciate all your help. Have a nice weekend. Best Regards, Trond Kr=
istiansen =
_________________________________________________________________
Invite your mail contacts to join your friends list with Windows Live Space=
s. It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=3Dcreate&wx_url=3D/friends.=
aspx&mkt=3Den-us
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cens.ioc.ee/pipermail/f2py-users/attachments/20081213/140ba300/=
attachment.htm
More information about the f2py-users
mailing list