Giter Site home page Giter Site logo

equinor / resdata Goto Github PK

View Code? Open in Web Editor NEW
100.0 25.0 95.0 22.84 MB

Software for reading and writing the result files from the Eclipse reservoir simulator.

License: GNU General Public License v3.0

CMake 1.33% C 3.32% Python 28.43% C++ 63.31% Shell 0.06% TeX 3.39% Roff 0.16%
reservoir python c opm eclipse hacktoberfest

resdata's Introduction

ResData

Python package for reading and writing the result files from reservoir simulators. The file types covered are the RESTART, INIT, RFT, Summary and GRID files in unified and non-unified, and formatted and unformatted.

ResData officially only supports Linux and macOS. It was initially developed as part of the ert project.

Using

ResData is available on PyPI and can be installed into a Python virtual environment with pip:

pip install resdata

Building

ResData is a Python project with a C++ extension layer. Most of the functionality is implemented in C++ and uses cwrap for binding it to Python.

A C++17-compatible compiler, like GCC 8+ or Clang 11+ is required. Other C++ dependencies are brought in automatically by Conan during CMake compilation.

In a Python virtual environment, run:

# Fetch directly from GitHub
pip install git+https://github.com/equinor/resdata

# If git-cloned, install local directory in editable mode
pip install --editable .

Running tests

As this codebase contains both Python and C++ code, there are tests for both Python and C++.

Python tests

These tests use pytest and require that ResData is installed into a Python virtualenv in --editable mode, as described in the Building section.

Ensure that pytest is installed and do the following to

# Install pytest
pip install pytest

# Run all tests in the python/tests directory
pytest python/tests

C++ tests

ResData uses a homegrown testing suite as well as Catch2, 2.x which is compiled via CMake and ran using ctest.

Ensure that cmake and conan version 1 is installed.

# Generate CMake build files into `build/`
cmake -B build .

# Build project
cmake --build build

# Run all tests
ctest --test-dir build

resdata's People

Contributors

akva2 avatar andlaus avatar arielalmendral avatar berland avatar bjarneherland avatar blattms avatar bska avatar dhan16 avatar eivindjahren avatar flikka avatar galfodo avatar iloop2 avatar jensgm avatar jepebe avatar joakim-hove avatar jokva avatar lindkvis avatar magnesj avatar maninfez avatar markusdregi avatar myrseth avatar oysteoh avatar perroe avatar pgdr avatar pinkwah avatar reedonly avatar rolk avatar sondreso avatar verveerpj avatar xjules avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

resdata's Issues

libecl to PyPi

to be able to simply "pip install libecl" and use from python without having to git clone and build the c++ code.

Bug in util_alloc_realpath__

I think this function has a bug. If you feed it something like: a/b/c/../c/../.. (yes I know, a beautiful path). You will get a/b back, while you would expect a.

Basically you create a gap of false entries with the first c/.., then the while(!mask[prev_index]) brings you past this gap when hitting the second c. Then the ../.. starts going backwards marking path elements as false, that are already false. I think it should either be implemented with a stack or the similar functionality of "fast forwarding" backwards to find a true entry should be implemented.

bogus cmake files get installed

mblatt@loft11004:~/opt$ find libecl/include -name \*.cmake
libecl/include/ert/util/CMakeFiles/CMakeDirectoryInformation.cmake
libecl/include/ert/util/cmake_install.cmake
libecl/include/ert/util/CTestTestfile.cmake

Are these installed by accident? They seem to contain only information valid in the build directory.

Name of library and repository

From the repository name (and also some other communication) I had the impression that the name of this library was libecl. Apparently the intent is that the name should be ecl, I would then propose that the name of the repository is changed to ecl, too. Since that has some annoying consequences perhaps it could also be considered to make libecl the official, communicated, name of the library.

The situation I fear is something like this: I specify "LIBECL_LIBRARY" but that is not used, instead "ECL_LIBRARY" is used and resolved to something different. I then get link errors or (worse) incorrect results I cannot understand. To avoid such problems it must be clear which name to use.

Problem dumping grid data to a csv file

Hi,
When using EclSum to export grid data to a csv file, the key is of the form BPR:1,1,1. The extra commas are troublesome when trying to read the csv file. Is there a way to remove the commas from the key before writing the csv file? SPE1 asks for this type of output:

-- 2a) Pressures of the cell where the injector and producer are located
BPR
1  1  1 /
10 10 3 /
/

Here is the script that I used on the SPE1 output:

#!/usr/bin/env python
import sys
import ert.ecl.ecl as ecl
for arg in sys.argv[1:len(sys.argv)]:
    print "dumping case %s" % arg
    case = arg
    sum_data = ecl.EclSum(case)
    sum_data.exportCSV(case + ".csv", date_format='%d-%b-%Y', sep=',')

I suppose a possible work around would be to change the output separator, and then post process the csv file, but it would be nicer if it could be handled within python.
Thanks for your help,
George

Documentation of available functionalities/APIs

Hi

I have been trying to use the python wrapper of the libecl library for reading the .GRID and .EGRID files. Is there any documentation having a list of functionalities/ APIs supported by the libecl library? A link to useful tutorials/examples would also be very helpful.

Thanks and Regards
Dhruv

build fails on 32 bit systems

on my 32-bit ARM system for testing (featuring a debian jessie based distribution with GCC 4.9.2), I get the following compiler error:

/home/and/src/libecl/lib/util/buffer.cpp: In function ‘size_t buffer_fwrite_compressed(buffer_type*, const void*, size_t)’:
/home/and/src/libecl/lib/util/buffer.cpp:905:94: error: invalid conversion from ‘size_t* {aka unsigned int*}’ to ‘long unsigned int*’ [-fpermissive]
         util_compress_buffer( ptr , byte_size , &buffer->data[buffer->pos] , &compressed_size);

which is correct because long unsigned int is only equivalent to size_t on 64 bit systems.

Setup tests for OSX and clang

Having one more platform besides Ubuntu Linux gives a much better testing, especially when it comes to the C code.

Setup tests for OSX, that should be required to pass.

See the history of .travis.yml for setting up the matrix and for how to get miniconda for osx.

ert python in Windows

Hi,
I would like to use ERT python functions in Windows to read mainly simulation output data such as summary vectors and grid data. What I have done so far was to put the ERT python folder in the location where python compiler knows but I have zero knowledge about building shared libraries using CMake etc. I am stuck at the first line "import ecl.ecl as ecl" because of shared libraries. Is there any easy workaround for this, like getting the libraries from somewhere. I am using windows 7 and windows 8 with python 2.7.

Appreciate a response.
Saeed

Deprecation warning EclKW

calling EclKW methods returns deprecation warning, e.g.:

ecl_file.iget_named_kw('BO',0)
/project/res/x86_64_RH_7/share/ert/release/stable/lib/python2.7/site-packages/ecl/ecl/ecl_kw.py:958: DeprecationWarning: EclTypeEnum is deprecated. You should instead provide an EclDataType
  DeprecationWarning)

I can take a look at it when I'm finished with my current task

Crash when loading well information

From Resinsight Contact person Håkon Høgstøl in Statoil:

Hei
 
Det er et problem med krasj i ResInsight (well_conn_alloc_from_kw) ved import av en del  Peregrino 
modeller.  Kan du se på feilen? En mulig relevant observasjon er at krasj kommer fra Eclise 2017.1 
kjøringer, mens noen nesten like modeller fra Eclipse 2017.2 er ok.
 
Jeg har kopiert over et case som krasjer her:
Unix_tr:  /project/multiscale/OPM/Ceetron/simu/BUG_cases/2018.01.1_peregrino_wellcon/ R6_HM2016B_FFP_BASE.EGRID
 
 
Kopi av feilmelding:
 
rio-linrgs003:/project/peregrino/ressim/sector/main/2017b/ver001/e100/simu/amap/BNEUC64:$ ResInsight(13388)/ findLibraryInternal: plugins should not have a 'lib' prefix: "libkfilemodule.so"
ResInsight(13388)/ KPluginLoader::load: The plugin "libkfilemodule" doesn't contain a kde_plugin_verification_data structure                                                                
 
Error message: well_conn_alloc_from_kw: icon direction value:1369277249 not recognized
 
See file: /tmp/ert_abort_dump.hhgs.20180426-092917.log for more details of the crash.
Setting the environment variable "ERT_SHOW_BACKTRACE" will show the backtrace on stderr.
 
rio-linrgs003:/project/peregrino/ressim/sector/main/2017b/ver001/e100/simu/amap/BNEUC64:$ more /tmp/ert_abort_dump.hhgs.20180426-092917.log
 
 
Abort called from: well_conn_alloc_from_kw (/home/jenkinstr/workspace/ResInsight-Master-RH6-Octave3.8.1-odb/ThirdParty/Ert/lib/ecl/well_conn.c:216)
 
Error message: well_conn_alloc_from_kw: icon direction value:1369277249 not recognized
 
 
 
--------------------------------------------------------------------------------
#00 util_abort__(..)                                                              in ??:0
#01 well_conn_alloc_from_kw(..)                                                   in ??:0
#02 well_conn_collection_load_from_kw(..)                                         in ??:0
#03 ???(..)                                                                       in well_state.c:0
#04 well_state_add_connections2(..)                                               in ??:0
#05 well_state_alloc_from_file2(..)                                               in ??:0
#06 well_info_add_wells2(..)                                                      in ??:0
#07 well_info_add_UNRST_wells2(..)                                                in ??:0Hei
 

``

Installation problems when following the README

Followed the recipe in the README and met a couple of problems..

[...]$ git submodule update --init pycmake
error: pathspec 'pycmake' did not match any file(s) known to git.

and

[...]$ pip install statoil_libecl --prefix=/my/location
Collecting statoil_libecl
  Could not find a version that satisfies the requirement statoil_libecl (from versions: )
No matching distribution found for statoil_libecl

When fetching and installing pycmake from github and using the setup.py instead of pip, all is good. When that is done however, pip gives no warnings, so it appears to be problematic only until the first install..

Summary restart from the middle of history. Prediction shorter than total history.

Hei,

Det kan se ut som om når man restarter en kjøring og ser på summary-variable for denne (før den er ferdig), vises restart-kjøringens data også etter det tidspunktet man har kommet til. Bug? (Jeg regner med det er noe i gata at restart-vektoren oppdateres av data fra den nye kjøringen, men burde kanskje her ha en sjekk på at man sletter data som kommer etter siste tidspunkt for den nye kjøringen?)

Mvh Kari

strlen is called even with a null pointer in util_alloc_filename

I am experiencing segmentatio faults that seem to be caused in libecl when testing the 2018.10 release of OPM. The problem is in ecl_sum_set_case with input_arg being ./SPE1CASE1 for whatever reason the base variable is null after the call to util_alloc_file_components but this nullptr is passed to strlen inside of the call to util_alloc_filename.

Here is an excerpt of my gdb session:

Thread 1 received signal SIGTRAP, Trace/breakpoint trap.
0x00000000048389e2 in _vgr20070ZU_libcZdsoZa_strlen (str=0x0) at ../shared/vg_replace_strmem.c:460
460	 STRLEN(VG_Z_LIBC_SONAME,          strlen)
(gdb) p strlen
$1 = {size_t (*(void))(const char *)} 0x80321b0 <strlen_ifunc>
(gdb) up
#1  0x0000000007981de9 in util_alloc_filename (path=0xf5cf060 "./SPE1CASE1", basename=0x0, extension=extension@entry=0x0) at /home/mblatt/src/dune/opm-release-6/libecl/lib/util/util.c:4812
4812	  int    length = strlen(basename) + 1;
(gdb) p basename
$2 = 0x0
(gdb) up
#2  0x00000000079c0461 in ecl_sum_set_case (ecl_sum=ecl_sum@entry=0xf5cefc0, input_arg=input_arg@entry=0x1ffefff030 "./SPE1CASE1") at /home/mblatt/src/dune/opm-release-6/libecl/lib/ecl/ecl_sum.cpp:138
138	    ecl_sum->ecl_case = util_alloc_filename( path, base, NULL );
(gdb) p base
$3 = 0x0
(gdb) up
#3  0x00000000079c06bc in ecl_sum_alloc__ (key_join_string=0x24a2e26 ":", input_arg=0x1ffefff030 "./SPE1CASE1") at /home/mblatt/src/dune/opm-release-6/libecl/lib/ecl/ecl_sum.cpp:166
166	  ecl_sum_set_case( ecl_sum , input_arg );
(gdb) do
#2  0x00000000079c0461 in ecl_sum_set_case (ecl_sum=ecl_sum@entry=0xf5cefc0, input_arg=input_arg@entry=0x1ffefff030 "./SPE1CASE1") at /home/mblatt/src/dune/opm-release-6/libecl/lib/ecl/ecl_sum.cpp:138
138	    ecl_sum->ecl_case = util_alloc_filename( path, base, NULL );
(gdb) p input_arg
$4 = 0x1ffefff030 "./SPE1CASE1"
(gdb) p path
$5 = 0xf5cf060 "./SPE1CASE1"
(gdb) bt
#0  0x00000000048389e2 in _vgr20070ZU_libcZdsoZa_strlen (str=0x0) at ../shared/vg_replace_strmem.c:460
#1  0x0000000007981de9 in util_alloc_filename (path=0xf5cf060 "./SPE1CASE1", basename=0x0, extension=extension@entry=0x0) at /home/mblatt/src/dune/opm-release-6/libecl/lib/util/util.c:4812
#2  0x00000000079c0461 in ecl_sum_set_case (ecl_sum=ecl_sum@entry=0xf5cefc0, input_arg=input_arg@entry=0x1ffefff030 "./SPE1CASE1") at /home/mblatt/src/dune/opm-release-6/libecl/lib/ecl/ecl_sum.cpp:138
#3  0x00000000079c06bc in ecl_sum_alloc__ (key_join_string=0x24a2e26 ":", input_arg=0x1ffefff030 "./SPE1CASE1") at /home/mblatt/src/dune/opm-release-6/libecl/lib/ecl/ecl_sum.cpp:166
#4  ecl_sum_alloc_writer__ (nz=3, ny=10, nx=10, time_in_days=true, sim_start=1420070400, key_join_string=0x24a2e26 ":", unified=true, fmt_output=<optimized out>, restart_step=<optimized out>, restart_case=0x0, ecl_case=0x1ffefff030 "./SPE1CASE1") at /home/mblatt/src/dune/opm-release-6/libecl/lib/ecl/ecl_sum.cpp:333
#5  ecl_sum_alloc_restart_writer2 (ecl_case=0x1ffefff030 "./SPE1CASE1", restart_case=0x0, restart_step=-1, fmt_output=<optimized out>, unified=<optimized out>, key_join_string=0x24a2e26 ":", sim_start=1420070400, time_in_days=true, nx=10, ny=10, nz=3) at /home/mblatt/src/dune/opm-release-6/libecl/lib/ecl/ecl_sum.cpp:350
#6  0x00000000021dcf51 in Opm::out::Summary::Summary (this=0xf5ceb90, st=..., sum=..., grid_arg=..., schedule=..., basename=0x1ffefff030 "./SPE1CASE1") at /home/mblatt/src/dune/opm-release-6/opm-common/src/opm/output/eclipse/Summary.cpp:986
#7  0x00000000021dcbfa in Opm::out::Summary::Summary (this=0xf5ceb90, st=..., sum=..., grid_arg=..., schedule=...) at /home/mblatt/src/dune/opm-release-6/opm-common/src/opm/output/eclipse/Summary.cpp:954
#8  0x00000000021ca13a in Opm::EclipseIO::Impl::Impl (this=0xf5ceaa0, eclipseState=..., grid_=..., schedule_=..., summary_config=...) at /home/mblatt/src/dune/opm-release-6/opm-common/src/opm/output/eclipse/EclipseIO.cpp:231
#9  0x00000000021cbce1 in Opm::EclipseIO::EclipseIO (this=0xf5cea50, es=..., grid=..., schedule=..., summary_config=...) at /home/mblatt/src/dune/opm-release-6/opm-common/src/opm/output/eclipse/EclipseIO.cpp:517
#10 0x00000000014d1128 in Ewoms::EclWriter<Ewoms::Properties::TTag::EclFlowProblem>::EclWriter (this=0xf5aea70, simulator=...) at /home/mblatt/src/dune/opm-release-6/ewoms/ebos/eclwriter.hh:115
#11 0x000000000149ab2d in Ewoms::EclProblem<Ewoms::Properties::TTag::EclFlowProblem>::EclProblem (this=0xf5ae1d0, simulator=...) at /home/mblatt/src/dune/opm-release-6/ewoms/ebos/eclproblem.hh:496
#12 0x00000000014823a1 in Ewoms::Simulator<Ewoms::Properties::TTag::EclFlowProblem>::Simulator (this=0xeb87aa0, verbose=false) at /home/mblatt/src/dune/opm-release-6/ewoms/ewoms/common/simulator.hh:134
#13 0x0000000001468a64 in Opm::FlowMainEbos<Ewoms::Properties::TTag::EclFlowProblem>::setupEbosSimulator (this=0x1ffefff970) at /home/mblatt/src/dune/opm-release-6/opm-simulators/opm/autodiff/FlowMainEbos.hpp:445
#14 0x000000000145a0f4 in Opm::FlowMainEbos<Ewoms::Properties::TTag::EclFlowProblem>::execute (this=0x1ffefff970, argc=2, argv=0x1ffeffffd8) at /home/mblatt/src/dune/opm-release-6/opm-simulators/opm/autodiff/FlowMainEbos.hpp:211
#15 0x000000000141b9dc in Opm::flowEbosBlackoilMain (argc=2, argv=0x1ffeffffd8) at /home/mblatt/src/dune/opm-release-6/opm-simulators/flow/flow_ebos_blackoil.cpp:59
#16 0x000000000132ec09 in main (argc=2, argv=0x1ffeffffd8) at /home/mblatt/src/dune/opm-release-6/opm-simulators/flow/flow.cpp:216

windows python libecl Compile failure

Thanks to the author, hope to improve the compatibility for windows。

windows 10
python 3.6.6
msvc 2015.3
cmake 3.12

CIL: python setup.py build

ERROR:

TestArea.obj : error LNK2019: unresolved external symbol _test_work_area_alloc_input_path refer
enced in function "private: class std::basic_string<char,struct std::char_traits<char>,class std:
:allocator<char> > __thiscall ERT::TestArea::inputPath(class std::basic_string<char,struct std::c
har_traits<char>,class std::allocator<char> > const &)const " (?inputPath@TestArea@ERT@@ABE?AV?$b
asic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV34@@Z) [D:\Python\Python_Learning\dh
an16opm_libecl-0.1.5\build\temp.win-amd64-3.6\Release\lib\ecl.vcxproj]

C++ compilation error at make stage

Dear OPM team,
I've tried to install the 'libecl' library but meet with c++ compilation error which I don't know what to do with. Can you give me an advice about next action?

[Denis.Kolesnikov@frontend libecl]$ cmake .
– Found Linux
– OpenMP disabled
– A library with BLAS API found.
– A library with BLAS API found.
– A library with LAPACK API found.
– Configuring done
– Generating done
– Build files have been written to: /home/Denis.Kolesnikov/opm_build/libecl
[Denis.Kolesnikov@frontend libecl]$ make
[ 1%] Building CXX object lib/CMakeFiles/ecl.dir/util/TestArea.cpp.o
In file included from /home/Denis.Kolesnikov/opm_build/libecl/lib/include/ert/util/TestArea.hpp:26,
from /home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:21:
/home/Denis.Kolesnikov/opm_build/libecl/lib/include/ert/util/ert_unique_ptr.hpp:17: error: expected unqualified-id before ‘using’
In file included from /home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:21:
/home/Denis.Kolesnikov/opm_build/libecl/lib/include/ert/util/TestArea.hpp:97: error: ISO C++ forbids declaration of ‘ert_unique_ptr’ with no type
/home/Denis.Kolesnikov/opm_build/libecl/lib/include/ert/util/TestArea.hpp:97: error: expected ‘;’ before ‘<’ token
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp: In member function ‘void ERT::TestArea::enter(const std::string&)’:
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:38: error: ‘c_ptr’ was not declared in this scope
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp: In member function ‘void ERT::TestArea::setStore(bool)’:
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:43: error: ‘c_ptr’ was not declared in this scope
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp: In member function ‘std::string ERT::TestArea::getOriginalCwd() const’:
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:48: error: ‘c_ptr’ was not declared in this scope
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp: In member function ‘std::string ERT::TestArea::inputPath(const std::string&) const’:
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:64: error: ‘c_ptr’ was not declared in this scope
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp: In member function ‘void ERT::TestArea::assertOpen() const’:
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:73: error: ‘c_ptr’ was not declared in this scope
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp: In member function ‘void ERT::TestArea::copyFile(const std::string&) const’:
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:98: error: ‘c_ptr’ was not declared in this scope
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp: In member function ‘void ERT::TestArea::copyDirectory(const std::string&) const’:
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:104: error: ‘c_ptr’ was not declared in this scope
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp: In member function ‘void ERT::TestArea::copyDirectoryContent(const std::string&) const’:
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:109: error: ‘c_ptr’ was not declared in this scope
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp: In member function ‘void ERT::TestArea::copyParentContent(const std::string&) const’:
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:114: error: ‘c_ptr’ was not declared in this scope
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp: In member function ‘void ERT::TestArea::copyParentDirectory(const std::string&) const’:
/home/Denis.Kolesnikov/opm_build/libecl/lib/util/TestArea.cpp:119: error: ‘c_ptr’ was not declared in this scope
make[2]: *** [lib/CMakeFiles/ecl.dir/util/TestArea.cpp.o] Error 1
make[1]: *** [lib/CMakeFiles/ecl.dir/all] Error 2
make: *** [all] Error 2

Looking up summary data file fails on Windows

I want to lookup summary data files by calling ecl_util_alloc_summary_files().

On Windows the file extension pattern for looking up summary data files is 'S????'.
The corresponding pattern on Linux is 'S[0-9][0-9][0-9][0-9]'.

When calling the function stringlist_select_matching_files() on Windows, a .SAVE file is found (due to the pattern).
If this file is newer than the .UNSMRY file, the .SAVE file is returned as data file.
When later calling the function ecl_sum_fread_alloc() with that data file as argument, it returns NULL.

Call stack:
stringlist_select_matching_files(stringlist_struct * names, const char * path, const char * file_pattern) Line 759 C ecl_util_select_filelist(const char * path, const char * base, ecl_file_enum file_type, bool fmt_file, stringlist_struct * filelist) Line 586 C ecl_util_alloc_summary_data_files(const char * path, const char * base, bool fmt_file, stringlist_struct * filelist) Line 702 C ecl_util_alloc_summary_files(const char * path, const char * _base, const char * ext, char * * _header_file, stringlist_struct * filelist) Line 885 C

Ubuntu Kill Signal on loading EGRID file using EclGrid

EGRID is around 1.5 GB. On Mac I don't see any error but it freezes in
between. Loading using EclFile works fine.

ERROR:

Error message: Program received signal:11

See file: /tmp/ert_abort_dump.pradeep.20180805-024425.log for more details of the crash.
Setting the environment variable "ERT_SHOW_BACKTRACE" will show the backtrace on stderr.
Aborted (core dumped)

LOG:

Abort called from: util_abort_signal (libecl/lib/util/util.c:4652)

Error message: Program received signal:11
--------------------------------------------------------------------------------
 #00 util_abort__(..)             in /usr/include/x86_64-linux-gnu/bits/stdio2.h:97
 #01 ????
 #02 ???(..)                      in libecl/lib/ecl/ecl_grid.c:2951
 #03 ecl_grid_alloc_EGRID(..)     in libecl/lib/ecl/ecl_grid.c:2970
 #04 ecl_grid_load_case__(..)     in libecl/lib/ecl/ecl_grid.c:3716
 #05 ffi_call_unix64(..)          in ???
 #06 ffi_call(..)                 in ???
 #07 _ctypes_callproc(..)         in ???
 #08 ????
 #09 PyObject_Call(..)            in ???
 #10 PyEval_EvalFrameEx(..)       in ???
 #11 PyEval_EvalCodeEx(..)        in ???
 #12 ????
 #13 ????
 #14 PyObject_Call(..)            in ???
 #15 ????
 #16 PyEval_EvalFrameEx(..)       in ???
 #17 PyEval_EvalCodeEx(..)        in ???
 #18 ????
 #19 ????
 #20 ????
 #21 ????
 #22 PyEval_EvalFrameEx(..)       in ???
 #23 PyEval_EvalCodeEx(..)        in ???
 #24 ????
 #25 PyRun_FileExFlags(..)        in ???
 #26 PyRun_SimpleFileExFlags(..)  in ???
 #27 Py_Main(..)                  in ???
 #28 __libc_start_main(..)        in ???
 #29 _start(..)                   in ???
--------------------------------------------------------------------------------

Unable to load summary file

>>> grid = EclGrid('NORNE_ATW2013.EGRID')
>>> init = EclInitFile(grid, 'NORNE_ATW2013.INIT')
>>> smry = EclSum('NORNE_ATW2013.UNSMRY')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/ecl/ecl/ecl_sum.py", line 165, in __init__
    raise IOError("Failed to create summary instance from argument:%s" % load_case)
IOError: Failed to create summary instance from argument:NORNE_ATW2013.UNSMRY

NNC edit stuff

Jeg har sett på en IX-simulering fra et Total-felt som bruker ønsker å få importert i ResInsight.

Forslag til workaround for å støtte IX grid data i ResInsight:

  1. Når ACTNUM fra EGRID er forskjellig fra antall celleresultater i INIT/RST, bruk PORV > 0 som «actnum» (ref. tidligere forslag her OPM/ResInsight#1644)
    · ResInsight sjekker antall celle verdier?
  2. Les NNC1 og NNC2 fra INIT-fil sammen med TRANNNC. Det er forskjellig NNC-indeks eksport fra IX sammenlignet med Eclipse, henholdsvis til .INIT og .EGRID-filer (ikke dokumentert i Eclipse File Format Reference Manual).

Deprecating CamelCase: Discussion

Deprecating camelCase methods in Python

As per discussions earlier, we have decided to deprecate all camelCase methods in the Python ecl module.

The big issue is of course maintaining backwards compatibility for a while, since the ecl module has quite a few users.

We decided on making two copies of every method, one snake_case version (provided that the camelCase version already exists and is in use), and one camelCase version, with the added functionality that whenever you use the camelCase version of the method, you get a deprecation warning.

Decorators

I don't know exactly how we would go about making a method decorator without some very ugly monkey-patching on a class level, but a nice (from the user's perspective) way, would be if we could:

def SomeClass(object):
    @to_snake('MyLittleMethod')
    def my_little_method(*args):
        ...

The issue with this, is that SomeClass isn't a thing yet when we try to create the MyLittleMethod renaming, so I do not know how to git that method into the class (in the future?).

Plain old attribute addition (with setattr)

The following example shows one way of creating (albeit somewhat manually) functions with several names. Feedback is most welcome!

The use is illustrated below, but the function calls must be written explicitly, and manually (or with an incredulous Emacs macro).

def monkey_the_camel(class_, camel, method_, method_type=None):
    """Creates a method "class_.camel" in class_ which prints a warning and forwards
    to method_.  method_type should be one of (None, classmethod, staticmethod),
    and generates new methods accordingly.
    """
    def shift(*args):
        return args if (method_type != classmethod) else args[1:]
    def warned_method(*args):
        print('Warning, %s is deprecated' % camel)
        return method_(*shift(*args))
    if method_type == staticmethod:
        warned_method = staticmethod(warned_method)
    elif method_type == classmethod:
        warned_method = classmethod(warned_method)
    setattr(class_, camel, warned_method)

Showcase

#!/usr/bin/env python

def monkey_the_camel(class_, camel, method_, method_type=None):
    """Creates a method "class_.camel" in class_ which prints a warning and forwards
    to method_.  method_type should be one of (None, classmethod, staticmethod),
    and generates new methods accordingly.
    """
    def shift(*args):
        return args if (method_type != classmethod) else args[1:]
    def warned_method(*args):
        print('Warning, %s is deprecated' % camel)
        return method_(*shift(*args))
    if method_type == staticmethod:
        warned_method = staticmethod(warned_method)
    elif method_type == classmethod:
        warned_method = classmethod(warned_method)
    setattr(class_, camel, warned_method)


class MyClass(object):
    def __init__(self, name='no name'):
        self.name = name

    def my_camel_fun(self, a, b):
        return 'myCamelFun %s %s (%s)' % (a, b, self.name)

    def my_other_fun(self, a, b):
        return 'my_other_fun %s %s (%s)' % (a, b, self.name)

    @classmethod
    def my_class_met(cls, a, b):
        return 'my_class_met %s %s (%s)' % (a, b, cls)

    @staticmethod
    def my_static_fn(a, b):
        return 'my_static_fn %s %s' % (a, b)

monkey_the_camel(MyClass, 'myCamelFun', MyClass.my_camel_fun)
monkey_the_camel(MyClass, 'myOtherFun', MyClass.my_other_fun)
monkey_the_camel(MyClass, 'myClassMet', MyClass.my_class_met, classmethod)
monkey_the_camel(MyClass, 'myStaticFn', MyClass.my_static_fn, staticmethod)


##
## TEST IT
##


def doassert(exp, act):
    assert act == exp, '"%s" vs "%s"' % (act, exp)


try:
    x = MyClass('x')
    exp = 'myCamelFun x-sib 1 (x)'
    act = x.myCamelFun('x-sib', 1)
    doassert(exp, act)
    print 'x ok'
except Exception as ex:
    print('x fail: %s' % ex)

try:
    y = MyClass('y')
    exp = 'myCamelFun y-sib 2 (y)'
    act = y.myCamelFun('y-sib', 2)
    doassert(exp, act)
    print 'y ok'
except Exception as ex:
    print('y fail: %s' % ex)

try:
    z = MyClass('z')
    exp = 'my_other_fun z-sib 3 (z)'
    act = z.myOtherFun('z-sib', 3)
    doassert(exp, act)
    print 'z ok'
except Exception as ex:
    print('z fail: %s' % ex)

try:
    exp = 'my_class_met c-sib 4 (%s)' % MyClass
    act = MyClass.myClassMet('c-sib', 4)
    doassert(exp, act)
    print('c ok')
except Exception as ex:
    print('classmethod fail: %s' % ex)

try:
    exp = 'my_static_fn %s %s' % ('s-sib', 5)
    act = MyClass.myStaticFn('s-sib', 5)
    doassert(exp, act)
    print 's ok'
except Exception as ex:
    print('staticmethod fail: %s' % ex)

Outputs

Warning, myCamelFun is deprecated
x ok
Warning, myCamelFun is deprecated
y ok
Warning, myOtherFun is deprecated
z ok
Warning, myClassMet is deprecated
c ok
Warning, myStaticFn is deprecated
s ok

New organization of ecl Python module

Please come with suggestions and improvements and I will update them in this message body.

ecl
├── ecl_kw.py
├── ecl_type.py
├── ecl_util.py
│
├── eclfile                         * new
│   ├── ecl_3d_file.py              * these could be in root ecl
│   ├── ecl_file.py
│   ├── ecl_file_view.py
│   ├── ecl_init_file.py
│   ├── ecl_restart_file.py
│   └── fortio.py
├── fault                           * moved from ecl/faults to fault
│   ├── fault_block_collection.py
│   ├── fault_block_layer.py
│   ├── fault_block.py
│   ├── fault_collection.py
│   ├── fault_line.py
│   ├── fault.py
│   ├── fault_segments.py
│   └── layer.py
├── geometry                        * renamed from geo
│   ├── cpolyline_collection.py
│   ├── cpolyline.py
│   ├── geometry_tools.py
│   ├── geo_pointset.py
│   ├── geo_region.py
│   ├── polyline.py
│   ├── surface.py
│   └── xyz_io.py
├── gravimetry                      * renamed from grav
│   ├── ecl_grav_calc.py
│   ├── ecl_grav.py
│   └── ecl_subsidence.py
├── grid
│   ├── ecl_3dkw.py
│   ├── ecl_grid_generator.py
│   ├── ecl_grid.py
│   └── ecl_region.py
├── rft                             * moved from ecl/rft to rft
│   ├── ecl_rft_cell.py
│   ├── ecl_rft.py
│   ├── ecl_plt.py                  * new (extract from ecl_rft_cell.py)
│   ├── ecl_plt_cell.py             * ----
│   └── well_trajectory.py
├── summary                         * new
│   ├── ecl_cmp.py
│   ├── ecl_npv.py
│   ├── ecl_smspec_node.py
│   ├── ecl_sum_keyword_vector.py
│   ├── ecl_sum_node.py
│   ├── ecl_sum.py
│   ├── ecl_sum_tstep.py
│   ├── ecl_sum_var_type.py
│   └── ecl_sum_vector.py
├── test
│   ├── ecl_mock
│   │   └── ecl_sum_mock.py
│   ├── ert_test_context.py
│   ├── ert_test_runner.py
│   ├── extended_testcase.py
│   ├── lint_test_case.py
│   ├── path_context.py
│   ├── source_enumerator.py
│   ├── temp_area.py
│   ├── test_area.py
│   └── test_run.py
├── util
│   ├── arg_pack.py
│   ├── bool_vector.py
│   ├── buffer.py
│   ├── cthread_pool.py
│   ├── ctime.py
│   ├── double_vector.py
│   ├── enums
│   │   ├── llsq_result_enum.py
│   │   ├── rng_alg_type_enum.py
│   │   ├── rng_init_mode_enum.py
│   │   └── ui_return_status_enum.py
│   ├── hash.py
│   ├── install_abort_signals.py
│   ├── int_vector.py
│   ├── log.py
│   ├── lookup_table.py
│   ├── matrix.py
│   ├── path_format.py
│   ├── permutation_vector.py
│   ├── profiler.py
│   ├── rng.py
│   ├── stat.py
│   ├── stringlist.py
│   ├── substitution_list.py
│   ├── thread_pool.py
│   ├── time_vector.py
│   ├── ui_return.py
│   ├── util_func.py
│   ├── vector_template.py
│   └── version.py
└── well
    ├── well_connection_direction_enum.py
    ├── well_connection.py
    ├── well_info.py
    ├── well_segment.py
    ├── well_state.py
    ├── well_time_line.py
    └── well_type_enum.py

opening summary plots in python

Hello everyone,

I am trying to open the summary plots after running SPE1CASE1 input deck, but I am getting following error. Any help to resolve this issue will be highly appreciated !

ubuntu@ubuntu-xenial:~/opm-data-master/spe1$ python summaryplot WBHP:INJ WBHP:PROD WOPR:PROD WGPR:PROD WGIR:INJ SPE1CASE1.DATA
Traceback (most recent call last):
  File "summaryplot", line 58, in <module>
    from ecl.eclfile import EclFile
  File "/usr/lib/python2.7/dist-packages/ecl/__init__.py", line 121, in <module>
    from .util import EclVersion
  File "/usr/lib/python2.7/dist-packages/ecl/util/__init__.py", line 46, in <module>
    class UtilPrototype(Prototype):
  File "/usr/lib/python2.7/dist-packages/ecl/util/__init__.py", line 47, in UtilPrototype
    lib = ecl.load("libecl")
  File "/usr/lib/python2.7/dist-packages/ecl/__init__.py", line 118, in load
    return cwrapload(name, path=ecl_lib_path, so_version=ert_so_version)
  File "/usr/lib/python2.7/dist-packages/cwrap/clib.py", line 90, in load
    raise ImportError(error_msg)
ImportError:
Failed to load shared library:libecl

dlopen() error: libecl.so: cannot open shared object file: No such file or directory

The runtime linker has searched through the default location of shared
libraries, and also the locations mentioned in your LD_LIBRARY_PATH
variable. Your current LD_LIBRARY_PATH setting is:

LD_LIBRARY_PATH:

You might need to update this variable?

ubuntu@ubuntu-xenial:~/opm-data-master/spe1$

EGRID ACTNUM different from INIT/RST active cells

grid = EclGrid('Eclipse.EGRID')
init = EclInitFile(grid, 'Eclipse.INIT')
permx = init['PERMX'][0]
permx3d = Ecl3DKW.castFromKW(permx, grid)

ERROR:
raise ValueError("Size mismatch - must have size matching global/active size of grid")

ACTNUM in EGRID is different from defined cells in INIT and RST files. I checked the data in Petrel. Need to modify the number of active cells based on PORV cut off. How can I do this?

Is requiring exact 2.7 python version really intended?

CMake deactivates python on my system with

-- Found PythonInterp: /usr/bin/python (found version "2.7.9") 
-- Could NOT find PythonInterp: Found unsuitable version "2.7.9", but required is exact version "2.7" (found /usr/bin/python)

Is this intended?

Error handling of `fortio`

fortio_fopen potentially returns a NULL stream if an error occurred and sets the errno variable. This is handled by fortio_open_writer by returning NULL if an error occurred. This not generally checked by any caller and instead rely on the fortio api for handling this case.

For instance, ecl_kw_fwrite_param (in lib/ecl_kw.c) will call fortio_open_fwriter without checking for errors. Eventually this calls fortio_get_FILE which dereferences the writer which is NULL, so returns an unitinitialized file-handle. This may therefore create all sorts of weird errors later.

Generally, it seems that there is a need for a more careful approach to error-handling of fortio.

Create ACTNUM EclKW from PORV

The most natural way to infer information about/inactive cells is from the Grid, but it can also be inferred from the PORV keyword in the INIT file - where PORV has value 0 for inactive cells. The purpose of this issue is to be able to create a ACTNUM EclKW from a PORV keyword - quite simple stuff, but it should be fast.

compilation broken

I just cloned and tried a fresh build in a new machine and I got the following message.

OPM/libecl/applications/ecl/ecl_quantile.c:27:27: fatal error: ert/util/util.h: No such file or directory
compilation terminated.
applications/CMakeFiles/ecl_quantile.dir/build.make:62: recipe for target 'applications/CMakeFiles/ecl_quantile.dir/ecl/ecl_quantile.c.o' failed
make[2]: *** [applications/CMakeFiles/ecl_quantile.dir/ecl/ecl_quantile.c.o] Error 1
CMakeFiles/Makefile2:476: recipe for target 'applications/CMakeFiles/ecl_quantile.dir/all' failed
make[1]: *** [applications/CMakeFiles/ecl_quantile.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
ert done!

problem with output summary file

Hello everyone !

I am new to OPM flow simulation. I just ran the Norne case using AWS cloud. I could open the .EGRID file in ResInsight, but the .SMSPEC generated after the simulation is not loading in ResInsight. Can someone please help me with this ?

Any tips/guidance will be greatly appreciated !

Thank you,
Shri

Make the ecl python wrappers work on macOS

Hi

Can someone explain how to make the ecl python wrappers work on macOS?

I did the following steps:

git clone https://github.com/Statoil/libecl.git
cd libecl
mkdir build
cd build
cmake ..
make
make install

And then added libecl/python/python/ecl to the PYTHONPATH env variable. When I try to run summaryplot, it gives the following error:

Traceback (most recent call last):
  File "Documents/partTime/reserMine/rmine-backend/extras/summaryplot", line 52, in <module>
    import ecl.ecl as ecl
  File "/Users/AkhilaRasamrtaMurthih/Documents/partTime/reserMine/setup/libecl/python/python/ecl/ecl/__init__.py", line 75, in <module>
    import ecl.util
ImportError: No module named util

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.