Satellite Application Facility for Numerical Weather Prediction › Forums › RTTOV › Older Versions › RTTOV 11 › RTTOV 11 General Discussion › Python version for using RTTOV wrappers
- This topic has 1 reply, 2 voices, and was last updated 7 years, 4 months ago by Anonymous.
-
AuthorPosts
-
February 26, 2016 at 5:14 pm #4675Stephen BedfordKeymaster
(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.January 9, 2017 at 8:41 pm #9697AnonymousInactiveIt 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.
-
AuthorPosts
- You must be logged in to reply to this topic.