Skip to content

Commit

Permalink
rename libecl to resdata
Browse files Browse the repository at this point in the history
* Rename namespace ecl to resdata/rd
* Rename ResdataFileEnum to FileType
* Rename ResdataPhaseEnum to Phase
* Rename ResdataUnitTypeEnum to UnitSytem
* Rename ResdataFileFlagEnum to FileMode
* Rename WellConnectionDirectionEnum to WellConnectionDirection
* Rename WellTypeEnum to WellType
* Rename resdata.util.geometry to resdata.geometry
* Rename ErtTestRunner to ResdataTestRunner
  • Loading branch information
eivindjahren committed Nov 7, 2023
1 parent beec6a8 commit 1408dfb
Show file tree
Hide file tree
Showing 694 changed files with 32,068 additions and 32,445 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: ecl testing
name: testing

on: [push, pull_request]

Expand All @@ -19,12 +19,18 @@ jobs:
# required for `git describe --tags` to work
fetch-depth: 0


- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.11'

- name: Install dependencies
run: |
python3 -m pip install "conan<2"
- name: Build ecl
- name: Build
run: |
python3 -m pip install -r requirements.txt
mkdir cmake-build
Expand All @@ -37,7 +43,7 @@ jobs:
export DYLD_LIBRARY_PATH=$PWD/lib
ctest --output-on-failure
env:
ECL_SKIP_SIGNAL: absolutely
RD_SKIP_SIGNAL: absolutely
ERT_SHOW_BACKTRACE: yes please!


Expand Down Expand Up @@ -80,7 +86,7 @@ jobs:
name: ${{ matrix.os }} Python ${{ matrix.python }} wheel
path: dist/*

- name: Install ecl
- name: Install
run: pip install dist/*

- name: Run Python tests
Expand All @@ -89,8 +95,8 @@ jobs:
python -m pip install pytest
# pytest adds every directory up-to and including python/ into sys.path,
# meaning that "import ecl" will import python/ecl and not the installed
# one. This doesn't work because the libecl.so library only exists in
# meaning that "import resdata" will import python/resdata and not the installed
# one. This doesn't work because the resdata.so library only exists in
# site-packages, so we copy directories required by the tests out into its
# own temporary directory.
mkdir test-run; cd test-run
Expand All @@ -101,7 +107,7 @@ jobs:
cp -R {..,$PWD}/python/tests
# Env vars
export ECL_SKIP_SIGNAL=1
export RD_SKIP_SIGNAL=1
export ERT_SHOW_BACKTRACE=1
# Run tests
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ scratch.sparsebundle

/venv/
/_skbuild/
/python/ecl/version.py
/python/resdata/version.py
.*
*.egg-info/

Expand Down
47 changes: 23 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.16)
project(ecl C CXX)
project(resdata C CXX)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Expand Down Expand Up @@ -79,25 +79,24 @@ conan_cmake_run(

# -----------------------------------------------------------------

set(ECL_VERSION_MAJOR 0)
set(ECL_VERSION_MINOR 0)
set(ECL_VERSION_MICRO "not-available")
set(RD_VERSION_MAJOR 0)
set(RD_VERSION_MINOR 0)
set(RD_VERSION_MICRO "not-available")

# If the micro version is not integer, that should be interpreted as a
# development version leading towards version MAJOR.MINOR.0

execute_process(COMMAND date "+%Y-%m-%d %H:%M:%S"
OUTPUT_VARIABLE ECL_BUILD_TIME)
string(STRIP "${ECL_BUILD_TIME}" ECL_BUILD_TIME)
execute_process(COMMAND date "+%Y-%m-%d %H:%M:%S" OUTPUT_VARIABLE RD_BUILD_TIME)
string(STRIP "${RD_BUILD_TIME}" RD_BUILD_TIME)

if(ECL_VERSION)
if(RD_VERSION)
# Have we been provided with an explicitly-set version?
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\1" ECL_VERSION_MAJOR
"${ECL_VERSION}")
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\2" ECL_VERSION_MINOR
"${ECL_VERSION}")
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\3" ECL_VERSION_MICRO
"${ECL_VERSION}")
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\1" RD_VERSION_MAJOR
"${RD_VERSION}")
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\2" RD_VERSION_MINOR
"${RD_VERSION}")
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\3" RD_VERSION_MICRO
"${RD_VERSION}")
else()
# Otherwise try to discover it via git
find_package(Git)
Expand Down Expand Up @@ -132,11 +131,11 @@ else()
OUTPUT_VARIABLE GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE)

string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\1" ECL_VERSION_MAJOR
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\1" RD_VERSION_MAJOR
"${GIT_TAG}")
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\2" ECL_VERSION_MINOR
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\2" RD_VERSION_MINOR
"${GIT_TAG}")
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\3" ECL_VERSION_MICRO
string(REGEX REPLACE "^([^.]+)\\.([^.]+)\\.(.+)$" "\\3" RD_VERSION_MICRO
"${GIT_TAG}")
else()
set(GIT_COMMIT "unknown (git not found!)")
Expand All @@ -148,14 +147,14 @@ endif()

message(
STATUS
"libecl version: ${ECL_VERSION_MAJOR}.${ECL_VERSION_MINOR}.${ECL_VERSION_MICRO}"
"resdata version: ${RD_VERSION_MAJOR}.${RD_VERSION_MINOR}.${RD_VERSION_MICRO}"
)

# -----------------------------------------------------------------

option(BUILD_TESTS "Should the tests be built" OFF)
option(BUILD_APPLICATIONS "Should we build small utility applications" OFF)
option(BUILD_ECL_SUMMARY "Build the commandline application ecl_summary" OFF)
option(BUILD_RD_SUMMARY "Build the commandline application rd_summary" OFF)
option(BUILD_SHARED_LIBS "Build shared libraries" ON)
option(ERT_USE_OPENMP "Use OpenMP" OFF)
option(RST_DOC "Build RST documentation" OFF)
Expand All @@ -175,11 +174,11 @@ if(EXISTS ${EQUINOR_TESTDATA_ROOT})
message(STATUS "Linking testdata: ${LINK} -> ${EQUINOR_TESTDATA_ROOT}")

set(_equinor_test_data ${CMAKE_SOURCE_DIR}/test-data/Equinor)
set(_eclpath ${_equinor_test_data}/ECLIPSE)
set(_resdatapath ${_equinor_test_data}/ECLIPSE)
set(_geopath ${_equinor_test_data}/Geometry)
endif()
set(_local_test_data "${CMAKE_CURRENT_SOURCE_DIR}/test-data/local")
set(_local_eclpath ${_local_test_data}/ECLIPSE)
set(_local_resdatapath ${_local_test_data}/ECLIPSE)

# output libs to some lib/ path for testing
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_INSTALL_LIBDIR})
Expand Down Expand Up @@ -449,7 +448,7 @@ endif()
if(NOT SKBUILD)
# Avoid installing when calling from python setup.py
install(EXPORT ecl-config DESTINATION share/cmake/ecl)
export(TARGETS ecl FILE eclConfig.cmake)
export(PACKAGE ecl)
install(EXPORT resdata-config DESTINATION share/cmake/resdata)
export(TARGETS resdata FILE resdataConfig.cmake)
export(PACKAGE resdata)
endif()
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

The following is a set of guidelines for contributing to ecl.
The following is a set of guidelines for contributing to resdata.

## Ground Rules

Expand Down
48 changes: 24 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
# ecl [![Build Status](https://github.com/equinor/libecl/workflows/ecl%20testing/badge.svg)](https://github.com/equinor/libecl/actions)
# resdata [![Build Status](https://github.com/equinor/resdata/workflows/resdata%20testing/badge.svg)](https://github.com/equinor/resdata/actions)


*ecl* is a package for reading and writing the result files from
the Eclipse reservoir simulator. The file types covered are the
*resdata* is 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.

*ecl* is mainly developed on *Linux* and *macOS*, in addition there
*resdata* is mainly developed on *Linux* and *macOS*, in addition there
is a portability layer which ensures that most of the functionality is
available on *Windows*. The main functionality is written in C/C++, and
should typically be linked in in other compiled programs. *ecl* was
should typically be linked in in other compiled programs. *resdata* was
initially developed as part of the [Ensemble Reservoir
Tool](http://github.com/Equinor/ert), other applications using
*ecl* are the reservoir simulator flow and Resinsight from the [OPM
*resdata* are the reservoir simulator flow and Resinsight from the [OPM
project](http://github.com/OPM/).

### Dependencies

Regardless of how you build *ecl*, it will depend on the following system-level
Regardless of how you build *resdata*, it will depend on the following system-level
components.

| Software | Debian / Ubuntu | RHEL / Fedora | macOS |
Expand All @@ -33,52 +33,52 @@ not.

### Alternative 1: Python only ###
For small interactive scripts, such as forward models, the recommended way to
use *ecl* is by installing it from PyPI. This method doesn't require setting
use *resdata* is by installing it from PyPI. This method doesn't require setting
`PYTHONPATH` or `LD_LIBRARY_PATH` environment variables:

```
$ pip install ecl
$ pip install resdata
```

### Alternative 2: C library only ###
This is for when you need to link directly with the *ecl* C library, but
don't need the Python bindings. *ecl* requires a conforming C++11 or later
This is for when you need to link directly with the *resdata* C library, but
don't need the Python bindings. *resdata* requires a conforming C++11 or later
compiler such as GNU GCC, the CMake build system and, optionally, zlib.

```bash
$ git clone https://github.com/Equinor/ecl
$ mkdir ecl/build
$ cd ecl/build
$ git clone https://github.com/Equinor/resdata
$ mkdir resdata/build
$ cd resdata/build
$ cmake ..
$ make
$ make install
```

To install *ecl* in a non-standard location, add
To install *resdata* in a non-standard location, add
`-DCMAKE_INSTALL_PREFIX=/path/to/install` to the first `cmake` command. Remember
to set `LD_LIBRARY_PATH=/path/to/install/lib64:$LD_LIBRARY_PATH` if you do use a
non-standard location for your program to find `libecl.so`.
non-standard location for your program to find `resdata.so`.

If you intend to develop and change *ecl* you should build the tests by
If you intend to develop and change *resdata* you should build the tests by
passing `-DBUILD_TESTS=ON` and run the tests with `ctest`.

### Alternative 3: C library with Python bindings ###
It is also possible to install both the C library and Python bindings using
CMake. Note that this alternative is incompatible with *ecl* installed from
CMake. Note that this alternative is incompatible with *resdata* installed from
PyPI (_Alternative 1_). As before, we require a conforming C++11 or later
compiler, CMake and, optionally, zlib.

```bash
$ git clone https://github.com/Equinor/ecl
$ mkdir ecl/build
$ cd ecl/build
$ git clone https://github.com/Equinor/resdata
$ mkdir resdata/build
$ cd resdata/build
$ pip install -r ../requirements.txt
$ cmake .. -DENABLE_PYTHON=ON
$ make
$ make install
```

You will most likely want to install *ecl* into a Python virtual environment.
You will most likely want to install *resdata* into a Python virtual environment.
First activate the virtualenv, then add the argument
`-DCMAKE_INSTALL_PREFIX=$(python -c "import sys; print(sys.prefix)")` to the
`cmake` command when building.
Expand All @@ -92,10 +92,10 @@ $ export LD_LIBRARY_PATH=/path/to/install/lib64:$LD_LIBRARY_PATH

Then you can fire up your Python interpreter and try it out:
```python
>>> from ecl.summary import EclSum
>>> from resdata.summary import Summary
>>> import sys

>>> summary = EclSum(sys.argv[1])
>>> summary = Summary(sys.argv[1])
>>> fopt = summary.numpy_vector("FOPT")
```

Expand Down
14 changes: 7 additions & 7 deletions WINDOWS.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Compiling and Installing **_libecl_** on Windows
# Compiling and Installing **_resdata_** on Windows

## Prerequisits:
* Python 2.7 or 3.x https://www.python.org/ or https://anaconda.org/
* Microsoft Visual Studio https://visualstudio.microsoft.com/downloads/
* Local copy of **_libecl_**
* Local copy of **_resdata_**

## Instructions:
1. Download or clone the **_libecl_** Github repository to your local disk.
1. Download or clone the **_resdata_** Github repository to your local disk.

2. Python 2.7 or 3.x installation
- Download a python instalation or a python environment solution such as Anaconda.

3. Download and install Microsoft Visual Studio . At a minimum **_libecl_** requires the VS Studio packages for cmake, msbuild, c and c++ compilers (CL.exe).
3. Download and install Microsoft Visual Studio . At a minimum **_resdata_** requires the VS Studio packages for cmake, msbuild, c and c++ compilers (CL.exe).

4. Open a MSVC command prompt such as _x64 Native Tools Command Prompt for VS 2017_ from your start menu. In the open prompt, navigate to the **_libecl_** source directory you created in step 1. Use the Python package manager **pip** to install **_libecl_** requirements via `pip install -r requirements.txt`. If Python is not accessible from the prompt it may be necessary to add the Python environment location to your system path variable `PATH`.
4. Open a MSVC command prompt such as _x64 Native Tools Command Prompt for VS 2017_ from your start menu. In the open prompt, navigate to the **_resdata_** source directory you created in step 1. Use the Python package manager **pip** to install **_resdata_** requirements via `pip install -r requirements.txt`. If Python is not accessible from the prompt it may be necessary to add the Python environment location to your system path variable `PATH`.

5. Execute the build commands with the desired CMAKE parameters from `README.md`. The cmake generator can be _`NMake Makefiles`_ , _`Ninja`_ or an appropriate version of _`MSVC`_. For the availble options type `cmake -G` in the MSVC command prompt.

Expand All @@ -22,6 +22,6 @@
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_INSTALL_PREFIX=%INSTALLPATH% -DBUILD_SHARED_LIBS="ON" -DENABLE_PYTHON="ON" -DCMAKE_BUILD_TYPE="Release" %SOURCEPATH%
cmake --build %BUILDPATH% --config Release --target install
~~~~
6. For **_libecl_** to be accessible in Python the `%INSTALLPATH%\lib\pythonX.Y\site-package` and Python subdirectories must be added to the `PATH` and `PYTHONPATH` variables. Where `pythonx.y` is the current Python version _e.g._ (`python3.9`, `python3.10` _etc._) .
6. For **_resdata_** to be accessible in Python the `%INSTALLPATH%\lib\pythonX.Y\site-package` and Python subdirectories must be added to the `PATH` and `PYTHONPATH` variables. Where `pythonx.y` is the current Python version _e.g._ (`python3.9`, `python3.10` _etc._) .

8. Open a Python interactive session and run `import ecl` to check that the install and paths are now set.
8. Open a Python interactive session and run `import resdata` to check that the install and paths are now set.
Loading

0 comments on commit 1408dfb

Please sign in to comment.