Git Product home page Git Product logo

grid3d-maps's Introduction

grid3d-maps

tests Python Version License: GPL v3 Code style: black

Various scripts for generating maps from 3D grid properties.

Scripts included

Script Description
grid3d_hc_thickness Make Hydrocarbon thickness maps from Eclipse and/or Roff input
grid3d_average_map Make average maps from a 3D grid parameter, Eclipse or Roff input
grid3d_aggregate_map Make aggregated maps (min/max/mean/sum) from a 3D grid parameter, Eclipse or Roff input
grid3d_migration_time Make migration time maps aimed at tracking plume migration in CCS applications

Features

  • From Eclipse files (EGRID, INIT, UNRST) and/or RMS binary ROFF make HCPV thickness maps, or make weighted average maps
    • No need to invoke RMS
    • Efficient in FMU work flows
    • HC thickness maps and average maps for property differences is supported (see examples in YAML config files)
  • Outputs PNG figures and Irap (RMS) binary maps
  • Simple configuration through a YAML file
  • Configuration from YAML can be overriden by command line options
  • From version 1.3, output via fmu-dataio_ (to sumo_) is supported. See fmu-dataio and fmu-sumo

grid3d-maps's People

Contributors

asnyv avatar berland avatar erichsuter avatar jcrivenaes avatar jholba avatar markusdregi avatar mferrera avatar sondreso avatar tnatt avatar vegardkv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grid3d-maps's Issues

Simplify ERT forward model option names

The two forward model have option name CONFIG_AVGMAP and CONFIG_HCMAP, while they could have been simplified to CONFIG, also in-line with the command line option when called from command line.

Change how `generate_maps` (`grid3d_aggregate_maps.py`) handles undefined values

Currently, generate_maps (of grid3d_aggregate_maps.py), can ignore cells with properties below a certain threshold. The primary purpose of this is speed-up. However, this also affects the result: areas with no cell properties above this threshold is handled in the same manner as areas outside the extent of the grid. This can be confusing and also leads to issues when doing surface-surface operations with xtgeo (differences maps or statistics).

The default behavior should be the same for this function as it is for the functions under avghc (to the extent reasonable). One option could be to add an optional fill value to be used for undefined values, and perform this as a post-processing step before returning results in the generate_maps function. This should be relatively easy to implement, however it has the limitation that this value will also be used outside the grid extents.

Resolve warnings encountered in documentation generation in fmu-docs

https://github.com/equinor/fmu-docs/actions/runs/9364831055/job/25780692153?pr=120

When building fmu-docs, these warnings and errors were encountered:

/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/readme.rst:1: CRITICAL: Problems with "include" directive path:
InputError: [Errno 2] No such file or directory: 'README.rst'.
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
copying assets... copying static files... done
copying extra files... done
done
writing output... [  9%] authors
writing output... [ 18%] config-avg
writing output... [ 27%] config-hc
writing output... [ 36%] contributing
writing output... [ 45%] examples
writing output... [ 55%] history
writing output... [ 64%] howitworks
writing output... [ 73%] index
writing output... [ 82%] installation
writing output... [ 91%] readme
writing output... [100%] usage
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated

/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
generating indices... genindex done
highlighting module code... 
/home/runner/work/fmu-docs/fmu-docs/grid3d-maps/docs/index.rst:6: WARNING: toctree contains reference to document 'readme' that doesn't have a title: no link will be generated
writing additional pages... search done

Latest build initiated at fmu-docs can be viewed at https://test-fmu-docs.azurewebsites.net/

Rename this repository

Places to update:

  • FMU Docs
  • Atlas docs
  • FURE docs
  • Drogon docs (comments in configs)
  • Komodo
  • GitHub workflows

Reading Eclipse properties with spaces fails

In some cases, Eclipse keywords in e.g. UNRST contains spaces. This has been found when using E100 and tracers, where keywords with names like W8 F make occur.

This makes average maps to crash. It seems that the engine behind, xtgeo, can handle reading keywords with spaces, but the xtgeo scanning of properties seems to parse keyword with spaces in a wrong manner.

Dangling node in yaml file causes difficult error message

Attempt at reconstruction (taken from an example, not the real user config):

input:
  eclroot: ../xtgeo-testdata/3dgrids/reek/REEK
  grid: $eclroot.EGRID

  # alternative approach to read a variables and dates:
  properties:
    -
      name: PORO
      source: $eclroot.INIT
    -
      name: SWAT
      source: $eclroot.UNRST
      dates: !include_from tests/yaml/global_config3a.yml::global.DATES
      diffdates: !include_from tests/yaml/global_config3a.yml::global.DIFFDATES
    -
#      name: PRESSURE
#      source: $eclroot.UNRST
#      dates: !include_from tests/yaml/global_config3a.yml::global.DATES
#      diffdates: !include_from tests/yaml/global_config3a.yml::global.DIFFDATES

The dangling dash - causes the error TypeError: argument of type 'NoneType' is not iterable from line 242 in _configparser.py which does if 'name' not in prop

Tests incompatible with Numpy 1.24

With numpy bumped from 1.23 to 1.24, some numbers change making the tests fail:

Example failure:

    def test_aggregated_map2(datatree):
        result = datatree / "aggregate2_folder"
        result.mkdir(parents=True)
        cfg = "tests/yaml/aggregate2.yml"
    
        grid3d_aggregate_map.main(
            [
                "--config",
                cfg,
                "--mapfolder",
                str(result),
                "--plotfolder",
                str(result),
            ]
        )
        swat = xtgeo.surface_from_file(result / "all--min_swat--20030101.gri")
>       assert swat.values.mean() == pytest.approx(0.7908786104444353, abs=1e-8)
E       assert 0.7309275812612058 == 0.7908786104444353 ± 1.0e-08
E         comparison failed
E         Obtained: 0.7309275812612058
E         Expected: 0.7908786104444353 ± 1.0e-08

Run CI nightly

  schedule:
    # Run nightly to check that tests are working with latest dependencies
    - cron: "0 0 * * *"

Support date and zone filter for aggregated and migration time maps

grid3d_hc_thickness and grid3d_average_map both support filtering on dates and/or zones in the config file:

input:
  properties:
    - name: PORO
       dates: !include_from file/path/to/dates.yml

zonation:
  zproperty:
    source: path/to/zonefile.roff
    zones:
      - zone1: [1]
      - zone2: [2]

(the config file is incomplete, but should hopefully illustrate the issue)

This is not supported by grid3d_aggregate_map and grid3d_migration_time. Implementing this should help control the amount of data that is produced, which can be quite significant for large projects.

Move to ruff

Black is currently failing, let's move to ruff as with other repositories.

Pin numpy < 2.0

NumPy 2 will arrive Dec/Jan and NumPy have recommended pinning and testing against its release candidate(s) before using. Other Equinor packages are taking this action as well.

Update deprecated xtgeo usage

This package uses some functionality set to be deprecated with xtgeo 4.0.

grid3d_maps/avghc/_get_grid_props.py:399: DeprecatedWarning: values3d is deprecated as of 3.6 and will be removed in 4.0. Use gridprop.values instead
    xhcpv = ma.filled(initobjects[0].values3d, fill_value=0.0)

grid3d_maps/avghc/_get_grid_props.py:456: DeprecatedWarning: values3d is deprecated as of 3.6 and will be removed in 4.0. Use gridprop.values instead
    sgas[date] = ma.filled(prop.values3d, fill_value=1)

grid3d_maps/avghc/_get_grid_props.py:451: DeprecatedWarning: values3d is deprecated as of 3.6 and will be removed in 4.0. Use gridprop.values instead
    swat[date] = ma.filled(prop.values3d, fill_value=1)

...

This is a non-exhaustive list and other can be found in the test run output. These things can be fixed prior to xtgeo 4.0 being released.

Publish docs to GitHub pages

Documentation is built for FMU Docs. We could publish them on GitHub pages too, and then have fmu-docs point to them rather than build them.

Documentation inconsistent on ERT forward model

As reported by a user, the example given for GRID3D_AGGREGATE_MAP shows

FORWARD_MODEL GRID3D_AGGREGATE_MAP(<CONFIG_AGGMAP>=conf.yml, <ECLROOT>=<ECLBASE>)

while the forward model job takes

ARGLIST "--config"  <CONFIG_AGGREGATE> "--eclroot" <ECLROOT>

Note that CONFIG_AGGREGATE != CONFIG_AGGMAP.

Remove xtgeoapp-grd3dmaps from Komodo

Both of these packages are co-existing in Komodo and ert is preferring xtgeapp-grd3dmaps. Enough time has passed that we should reasonably be able to remove xtgeoapp-grd3dmaps from future Komodo versions, i.e., it will not cause trouble if it is removed and new Komodo patch releases must be made.

Parallelize generation on maps

On large datasets the generation of maps takes an extremely long time.

Ran generation of avg maps on the Snorre field took 8 hours to produce close to 500 maps.

Introducing async and possibly multiprocessing should cut that time significantly

Publish to pypi

Make this repository available on pypi

  • Registration on pypi
  • Make a github actions job that will publish on pypi when a release is made (see e.g. fmu-config)

A few tests fails on xtgeo >= 2.9

Tests test_average_map2b() and test_average_map2c() fails. The fails occur with newer xtgeo versions >= 2.9. The exact xtgeo commit where this happens is equinor/xtgeo@77b292a

Investions suggests that results are almost identical for most maps, and the tests mentioned above are rather special. So propose to just adjust the two tests.

Solve DeprecationWarning

https://github.com/equinor/xtgeoapp-grd3dmaps/blob/4a0709e7bbdaac8f22c9e9a79a836af64d74f6c3/src/xtgeoapp_grd3dmaps/hook_implementations/jobs.py#L3C11-L3C11

This shows up when starting ERT with komodo bleeding:

(bleeding-py38) [havb@st-linrgsn110:~/test_field_update_using_ertbox/ert/model]$ ert gui example.ert
/prog/res/komodo/bleeding-py38-rhel7/root/lib/python3.8/site-packages/xtgeoapp_grd3dmaps/hook_implementations/jobs.py:3: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
  from pkg_resources import resource_filename

Support for two-phase simulations

Hydrocarbon thickness computations only support three-phase, assuming both SGAS and SWAT present.

If a user tries grid3d_hc_thickness.py on a two-phase (oil-water) simulation, it ends with an error message that SGAS is not found.

Map aggregation from 3D grids

Xtgeoapp enables generation of average maps from 3D grids, but not other types of statistics (e.g. min/max-type of maps). This is useful in particular for CCS applications where the maximum CO2 saturation is of interest to avoid leaks into undesired parts of the reservoir. It is also useful for generating time migration maps, which requires a minimum-type of aggregation.

The idea here is to extend xtgeoapp with this functionality, possibly invoked via a new script, but based on a similar configuration file structure. For instance, a keyword could be added to the "computesettings" section of the configuration file, used to determine the type of aggregation ("mean", "min" or "max").

CCS simulations can often involve large grids to cover potential leakage over large areas. This means performance is important. Being able to ignore cells with insignificant amounts of CO2 has large potential for performance improvement as major portions of the grid will often have zero CO2.

The current approach of xtgeoapp uses a dz-weighting to ignore cells that should be excluded from the average calculation. However, this will not improve performance since the multiplication by 0 is still executed. This can be avoided, but will require significant changes to the existing functionality, including changes to the xtgeo repo. Instead, it is suggested to implement this as a completely separate submodule (alongside avghc), but making sure to create a user interface (i.e. Script arguments and configuration file structure) that is familiar to the two scripts grid3d_average_map and grid3d_hc_thickness.

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.