Python version for using RTTOV wrappers

Tagged: ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #4675
    Stephen BedfordStephen Bedford
    Keymaster

    (TEST FORUM POST)

    Hi,

    Does it matter which version of Python I use for using the Python wrappers for RTTOV (2.7 or 3.x?)

    Best wishes,
    DV.

    #9697
    Anonymous
    Inactive

    It looks like the Python scripts and Makefiles assume Python 2, not Python 3.

    However, there are only some small changes required to get it working for Python 3. This is what I run in the rttov113 top-level directory:

    EXT_SUFFIX=$(python -c 'import sysconfig; print(sysconfig.get_config_var("EXT_SUFFIX"))')                          
    sed -i -e "s/EXT_SO=.so/EXT_SO=$EXT_SUFFIX/" build/Makefile.inc                                                    
    pushd wrapper                                                                                                      
    rm -f "../lib/rttov_wrapper_f2py.so"                                                                               
    ln -s "../lib/rttov_wrapper_f2py${EXT_SUFFIX}"                                                                     
    sed -i \                                                                                                           
        -e 's/\.iteritems()/.items()/' \                                                                               
        -e 's/\.iterkeys()/.keys()/' \                                                                                 
        -e 's/\.itervalues()/.values()/' \                                                                             
        -e 's/basestring/str/' \                                                                                       
        pyrttov/*.py                                                                                                   
    popd

    First, Python extension modules (starting with version 3.2 I think) no longer have a “.so” extension, but something more specific, like “.cpython-36m-x86_64-linux-gnu.so”. The commands above update the build system and add a symbolic link so this works.

    Second, the code itself requires just a few adjustments. These are find-and-replaces represented by the sed script above.

    I haven’t tested it extensively, but I tried this out a few months ago and got it to build and run under Python 3.5 successfully.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.