Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

Call of Python from fortran code of WRF

Freddy Paul

New member
Hi,

I am trying to make a python code call from WRF fortran code.
Has anybody done this ?. This is for the replacement of a WRF scheme
by Machine Learning algorithm.
 
You will need to embed a python interpreter and create ISO C bindings for any communication of C<->Fortran (where C facilitates communication with CPython). I don't know off the top of my head if there are already instances of people adapting WRF schemes from Fortran to Python in WRF, but I can point you to a personal project that demonstrates how one might go about it : GitHub - islas/pyio: CPython bindings using pybind11 to enable C/C++/Fortran interoperability

The linked project in no way is official or a full solution, but may provide guidance on how this interfacing may look, especially in regards to getting data across to numpy arrays. Note that the above uses pybind11 to ease the generation of CPython calls.
 
Top