[Numpy-discussion] f2py and string arrays (need help)

Siegfried Gonzi siegfried.gonzi at ed.ac.uk
Wed May 28 15:48:22 EDT 2014


Hi all

Given the following pseudo code:

==
SUBROUTINE READ_B( FILENAME, ix,iy,iz,nx, OUT_ARRAY,  out_cat)

IMPLICIT NONE


INTEGER*4,         INTENT(IN)  :: IX, iy, iz, nx
REAL*4,            INTENT(OUT) :: OUT_ARRAY(nx,IX, iy, iz)

CHARACTER, dimension(nx,40),intent(out) ::OUT_CAT

CHARACTER(LEN=40)  :: CATEGORY
integer :: i
....


do i=1,nx


    READ( IU_FILE, IOSTAT=IOS) data, category, lon, lat,....

    !!! category = 'IJVG=$'
    !!! or category = 'CHEM=$'
    out_cat(i,:) = category(:)

enddo

end subroutine read_b
==

I'd like to fill 'out_cat' with the names of the fields. As you guess my 
code does not work properly.

How can I do it with f2py? I don't even know if my code is legal Fortran 
90 at all.

Thanks,
Siegfried



-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.




More information about the NumPy-Discussion mailing list