Package: resdata
resdataresdatais a package for reading and writing the result files from
the reservoir simulators. The file types covered are the
restart, init, rft, summary and grid files. Both unified and
non-unified and formatted and unformatted files are supported.resdatais mainly developed onLinuxandmacOS, in addition there
is a portability layer which ensures that most of the functionality is
available onWindows. The main functionality is written in C/C++, and
should typically be linked in in other compiled programs.resdatawas
initially developed as part of theEnsemble Reservoir
Tool, other applications usingresdataare the reservoir simulator flow and Resinsight from theOPM
project.DependenciesRegardless of how you buildresdata, it will depend on the following system-level
components.SoftwareDebian / UbuntuRHEL / FedoramacOSlibzzlib1g-devzlib-develbuiltinConanN/AN/Aconan(Homebrew)pipx(Optional)pipxpipxpipx(Homebrew)Note: The Conan package manager is not available for most Linux systems. Conan
recommends installing it viapip. If usingpipx, simplypipx install conanand it'll be availabe for your user regardless if you're using a virtualenv or
not.Alternative 1: Python onlyFor small interactive scripts, such as forward models, the recommended way to
useresdatais by installing it from PyPI. This method doesn't require settingPYTHONPATHorLD_LIBRARY_PATHenvironment variables:$ pip install resdataAlternative 2: C library onlyThis is for when you need to link directly with theresdataC library, but
don't need the Python bindings.resdatarequires a conforming C++11 or later
compiler such as GNU GCC, the CMake build system and, optionally, zlib.$gitclonehttps://github.com/Equinor/resdata
$mkdirresdata/build
$cdresdata/build
$cmake..
$make
$makeinstallTo installresdatain a non-standard location, add-DCMAKE_INSTALL_PREFIX=/path/to/installto the firstcmakecommand. Remember
to setLD_LIBRARY_PATH=/path/to/install/lib64:$LD_LIBRARY_PATHif you do use a
non-standard location for your program to findresdata.so.If you intend to develop and changeresdatayou should build the tests by
passing-DBUILD_TESTS=ONand run the tests withctest.Alternative 3: C library with Python bindingsIt is also possible to install both the C library and Python bindings using
CMake. Note that this alternative is incompatible withresdatainstalled from
PyPI (Alternative 1). As before, we require a conforming C++11 or later
compiler, CMake and, optionally, zlib.$gitclonehttps://github.com/Equinor/resdata
$mkdirresdata/build
$cdresdata/build
$pipinstall-r../requirements.txt
$cmake..-DENABLE_PYTHON=ON
$make
$makeinstallYou will most likely want to installresdatainto a Python virtual environment.
First activate the virtualenv, then add the argument-DCMAKE_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)")to thecmakecommand when building.Then, you must tell Python where to find the package[1]:$exportPYTHONPATH=/path/to/install/lib/python2.7/site-packages:$PYTHONPATH$exportLD_LIBRARY_PATH=/path/to/install/lib64:$LD_LIBRARY_PATHThen you can fire up your Python interpreter and try it out:>>>fromresdata.summaryimportSummary>>>importsys>>>summary=Summary(sys.argv[1])>>>fopt=summary.numpy_vector("FOPT")The installation with Python enabled is described in aYouTube videoby Carl Fredrik Berg.[1]: The exact paths here will depend on your system and Python version. The example given is for a RedHat system with Python version 2.7.