Dear Fwrap Users:
I am trying to use Fwrap to wrap a scientific fortran library (getorb,
http://www.deos.tudelft.nl/ers/precorbs/tools/). I have been using
python only for a year or so, and I don't have much knowledge on
Fortran, so it is possible that I am missing something simple.
I was able to run fwrap with the following command:
fwrapc -v getorb_batu.f --build --fcompiler=gnu95 --name=getorb_batu --
override -lgfortran
getorb_batu.f is based on the getorb.f and also includes all the other
functions copied from several other files.
When I try to run the command, I need to pass a path to data (orbit)
folder as a string, but seems like I can only pass 1 character.
In [71]: getorb.getorb(631152000.0,lat,lon,orbit,"home",True)
Out[71]: (2, 631152000.0, 0.0, 0.0, 0.0, 'h', 1)
In [72]: getorb.getorb(631152000.0,lat,lon,orbit,"ome",True)
(getorb: scanning directory o)
Out[72]: (2, 631152000.0, 0.0, 0.0, 0.0, 'o', 1)
I tried changing the path variable to a bytearray, but then it gives
the following error message:
In [62]: getorb.getorb(631152000.0,lat,lon,orbit,path,True)
---------------------------------------------------------------------------
TypeError Traceback (most recent call
last)
/home/bosmanoglu/projectLocker/getorb/getorb_batu/<ipython console> in
<module>()
/home/bosmanoglu/projectLocker/getorb/getorb_batu/getorb_batu.so in
getorb_batu.getorb (getorb_batu.c:1272)()
38 cdef extern from "string.h":
39 void *memcpy(void *dest, void *src, size_t n)
---> 40 cpdef api object getorb(fwr_real_x8_t time, fwr_real_x8_t lat,
fwr_real_x8_t lon, fwr_real_x8_t orbit, fw_bytes path, fwl_logical_t
verbose):
41 """
42 getorb(time, lat, lon, orbit, path, verbose) ->
(fw_ret_arg, time, lat, lon, orbit, path, verbose,)
TypeError: Argument 'path' has incorrect type (expected str, got
bytearray)
Here is the function declaration from getorb.f:
**GETORB -- Get orbital position of satellite from ODR files
*+
FUNCTION GETORB (TIME, LAT, LON, ORBIT, PATH, VERBOSE)
INTEGER*4 GETORB
REAL*8 TIME, LAT, LON, ORBIT
CHARACTER PATH*(*)
LOGICAL VERBOSE
I am a little puzzled at the moment. Can you think of what the problem
might be?
Best Regards,
batu.