ECLCOMPRESS
eclcompress
is a command line utility to compress Eclipse grid files using
the Eclipse syntax number*value
so that the dataset:
0 0 0 1 2 3 2 2 2 2
becomes:
3*0 1 2 3 4*2
This compression technique is called run-length encoding.
If called with no arguments, a default list of files will be used, equivalent to specifying a file list like:
eclipse/include/grid/*
eclipse/include/regions/*
eclipse/include/props/*
The --verbose
option is recommended to see what happens, and is default when
run via ERT.
Command line
Apply run-length encoding to Eclipse input files, such that consecutive numbers like “1 1 1 1” are compressed to “4*1”. The script processes one file at a time, replacing the files with compressed versions.
If called with no arguments, a default file list is used.
If called with <FILES>
, the argument provided must be a filepath to
a text file containing a file list to compress.
usage: eclcompress [-h] [--dryrun] [--keeporiginal] [-v] [--files FILES]
[--version]
[grdeclfiles [grdeclfiles ...]]
Positional Arguments
- grdeclfiles
List of Eclipse grdecl files to compress, supporting wildcards. If no files are given, a default wildcard list will be used. Wildcards should be enclosed in quotes when called on the command line.
Named Arguments
- --dryrun
Dry run only. No files on disk will be modified, but compression statistics will be outputted.
Default: False
- --keeporiginal
Copy original to filename.orig
Default: False
- -v, --verbose
Be verbose
Default: False
- --files
Path to a text file containing one wildcard filepath per line, specifying which files to apply compression to. Defaults to everything below eclipse/include, but only if no files are specified on the command line.
- --version
show program’s version number and exit
Default list of files to compress is eclipse/include/grid/* eclipse/include/regions/* eclipse/include/props/*
ERT usage
Eclcompress is available as a pre-installed forward model in ERT. In your ERT config, include:
FORWARD_MODEL ECLCOMPRESS
between RMS and Eclipse to effectuate compression. If you have a custom file-list, add that using the FILES argument to the forward model:
FORWARD_MODEL ECLCOMPRESS(<FILES>=paths_to_compress.txt)
where paths_to_compress.txt
contains a list of files or filepaths to
compress.
eclipse/include/grid/*
eclipse/include/regions/*
eclipse/include/props/*
Notes
Existing whitespace (spaces and end-of-lines and such) are not preserved, not around ‘/’ characters either.
Filenames often contains slashes ‘/’, so if the file in question contains the INCLUDE keyword it will be skipped and left untouched.
If there are comments within the data section of a keyword, that data section will not be compressed.
The script is designed for compression of one parameter pr. file, one at a time. It can handle more, but the more complex Eclipse syntax you put into the files you try to compress, eventually you might encounter some bug or limitation. Check the test-function in the source code for what it at least can handle.
The compression factor outputted on the command line and in the header of the compressed file, does not take the extra header (two lines) in the compressed file into account.
Eclipse loading time of the compressed file is probably reduced by the same factor as the compression factor.
Only known compressable keywords are compressed.
Possible improvements
Support for comments inside data sections.