FIELD_STATISTICS
Calculate mean, stdev and estimated facies probabilities from field parameters using ERTBOX grid.
The script is relevant only if the FMU model uses field parameters and the user wants to check the prior and updated ensembles of the field parameters. Note that all field parameters that are updated using the ERT FIELD keyword in ERT config file, are temporarily stored in the help grid(s) often called ‘ERTBOX’ grids. There can be one common ERTBOX grid for all geomodel zones in the RMS project and in the ERT config file, or there can be one individual ERTBOX grid per zone.
The script reads ensembles of realizations from scratch disk from <RUN_PATH> directory:
share/results/grids/<geogridname>--<propertyname>.roff.
Optionally also temporary field parameters coming from APS or petrophysical field parameters can be used to calculate mean and standard deviations. The ensemble of realizations are usually located under <RUN_PATH> directory:
rms/output/aps
Since the realizations may have a grid geometry that is realization dependent and may have multiple zones, the values are first copied over to a static grid called ERTBOX grid. Depending on the grid conformity of the geogrid zones, the values are filled up from top or bottom of the ERTBOX grid. This is to ensure that zones with varying number of layers for each realization can be handled when calculating mean, standard deviation or estimated facies probabilities.
The grid cell indices in the ERTBOX grid is a label of the parameter value, and mean, standard deviation and facies fractions are calculated for each specified property for each individual grid cell (I,J,K) in the ERTBOX grid. Number of realizations of property values may vary from grid cell to grid cell due to varying number of layers per realization and due to stair case faults. Therefore also a parameter counting the number of realizations present for each individual grid cell is also calculated and used in the estimates of mean, standard deviation and facies probabilities.
The assumption behind this method (using ERTBOX grid as a fixed common grid for all realizations) is:
The lateral extension of the geogrid is close to a regular grid with same orientation and grid resolution as the ERTBOX grid.
The ERTBOX grid should be the same as used in ERT when field parameters are updated using the ERT keyword FIELD in the ERT configuration file.
Any lateral variability of the geometry of the geogrid from realization to realization or curved shaped lateral grid is ignored. Only the cell indices are used to identify grid cell field parameters from each realization. This means that mean, standard deviation and estimated facies probabilities are estimated for each cell labeled with index (I,J,K) and not physical position (x,y,z).
The output statistical properties (mean, stdev, prob) is saved in a user specified folder for the ERTBOX grid, but default if not specified is ‘share/grid_statistics’ folder under the top level of the scratch directory for the ERT case. The default estimate of standard deviation is the sample standard deviation.
and number of realizations must be at least 2. Optionally, the population standard deviation
can be specified.
For grid cells where number of realizations are less than 2, the standard deviation parameter calculated will be set to 0.
The ERTBOX grid can now also be individual per geological zone. This means that the user can define one ERTBOX grid per zone having the same lateral number of grid cells as for the geomodel grid and number of layers that are at least as large as the number of layers in the zone (for all realizations).
The advantage of using individual ERTBOX grid per geomodel grid zone is to reduce unwanted disk space, memory and runtime when running on a case with multiple zones in the geomodel where the size of the different zones in number of grid cells is varying a lot. Another possibility is that it is now possible to split a geogrid with multiple zones into single zone grids and define different grid resolutions not only vertically but also laterally if that is needed to represent the geology with different resolutions for different zones in the geomodel workflow. The upscaling can then be applied to get the properties into a simulation grid from each of the single zone geomodel grids.
The script will read info about ERTBOX grid size for each individual grid from the FMU project specified (The <CONFIG_PATH>) from the location:
rms/output/aps
The script assumes that the keyword FACIES_ZONE keyword is defined in the global_variables.yml file specified in the FMU project (The <CONFIG_PATH>) from the location:
fmuconfig/output/global_variables.yml
If it is not defined, the keyword ‘facies_per_zone’ must be specified in the config file instead.
Example of format for FACIES_ZONE keyword in global_variables.yml file from the Drogon case:
FACIES_ZONE:
Valysar:
0: Floodplain
1: Channel
2: Crevasse
5: Coal
Therys:
6: Calcite
10: Offshore
11: Lowershoreface
12: Uppershoreface
Volon:
0: Floodplain
1: Channel
6: Calcite
If this does not exist, add the keyword ‘facies_per_zone’ to the config file within the section under the keyword ‘geogrid_fields’. The ‘facies_per_zone’ keyword for the config file is defined in same way as ‘FACIES_ZONE’ keyword is defined in the global variables file.
There is an option to copy the resulting statistical estimates into the geogrid for a single realization of the grid. This makes it possible to visualize the results together with well paths. But be aware that the statistical estimates does not in general match 100% a single realization of the grid. So, comparing estimated facies probability with a facies log for a particular realization of the grid, will only give you an approximate impression of the well conditioning since the blocked wells grid cells may vary from realization to realization due to the variability of the grid which is due to structural uncertainty.
If this ERT workflow is run before the realizations are generated for all specified iterations, the script will not start calculating statistics, but return without doing anything.
If the option is chosen to generate python script for RMS to load the result into RMS, (option -z for the command line when running field_statistics), the generated load script is used as a python job in RMS. It might be necessary to edit the path to location of the yml file for the field_statistics config file and to define your own ‘label’ for the ensemble in case you want to load multiple ensembles from different ERT runs in the same RMS project. Since all the field parameter statistics are calculated in the zones individual (or common) ERTBOX grid, the results will also be loaded into the zones individual (or common) ERTBOX grids. Therefore, they must exist in the RMS project before loading. One possibility is to load the results into the RMS project used as forward model in ERT since the ERTBOX grids already exists there.
usage: field_statistics [-h] -c CONFIGFILE [-p ERTCONFIGPATH] -e ENSEMBLEPATH
[-r RESULTPATH] [-z GENERATE_RMS_LOAD_SCRIPT] [-g]
[--version]
Named Arguments
- -c, --configfile
Name of YAML config file
- -p, --ertconfigpath
Path to the configuration of ERT (<CONFIG_PATH>).
Default:
'./'- -e, --ensemblepath
File path to ensemble directory on scratch disk
- -r, --resultpath
Relative file path to result files relative to ensemble directory on scratch disk
Default:
'share/grid_statistics'- -z, --generate_rms_load_script
Output script to be used in RMS to load results into RMS for visualization.
Default:
'tmp_import_ensemble_field_statistics.py'- -g, --copy_result_to_geogrid
Option to copy results into realization-0 for the geogrid under realization-0/iter-<iter>/share/results/grids/
Default:
False- --version
show program’s version number and exit
# Configuration file for script wf_field_param_statistics.py
field_stat:
# Number of realizations for specified ensemble
# Required.
nreal: 100
# Iteration numbers from ES-MDA in ERT (iteration = 0 is initial ensemble,
# usually iteration=3 is final updated ensemble)
# Required.
iterations: [0, 3]
# Standard deviation estimator.
# Optional. Default is False which means that
# sample standard deviation ( normalize by (N-1)) is used
# where N is number of realizations.
# The alternative is True which means that
# population standard deviation ( normalize by N) is used.
use_population_stdev: False
# Specify path to directory where the ertbox grids are stored
# relative to config path (ert/model)
relative_path_ertbox_grids: "../../rms/output/aps"
# Specify ertbox grids per zone and/or a default global ertbox grid.
# The ertbox names are the same as the filenames except for the suffix.
# The specified default ertbox grid is only used for zones where
# individual ertbox grid is not specified. The default ertbox grid name
# must be the same as the ertbox grid specified in the global GRID keyword
# in ERT.
# Note that specification of 'ertbox_per_zone' must be consistent with
# the specification of the FIELD keyword in ERT.
# If the FIELD keyword in ERT config file does not use the
# sub-keyword GRID for any zone, skip the keyword 'ertbox_per_zone'
# and use only ertbox_default keyword.This means that all zones use the
# same ertbox grid size.
# If some or all FIELD keywords in ERT use the sub-keyword GRID,
# then specify 'ertbox_per_zone' keyword for all zones and use the
# same ertbox grid for each zone as specified in ERT keyword FIELD.
# If some of the FIELD keywords don't use sub-keyword GRID, it means
# that the ertbox grid specified by the global GRID keyword in ERT
# is used. In this case, specify the name of the default ertbox grid
# for those zones. In this way it is possible to define the ertbox grid
# in the same ways here for field_statistics as was done in ERT config file.
ertbox_per_zone:
"Valysar": "ertbox_valysar"
"Therys": "ertbox_therys"
"Volon": "ertbox_volon"
ertbox_default: "ERTBOX"
# Zone numbers with zone name dictionary
zone_code_names:
1: "Valysar"
2: "Therys"
3: "Volon"
# Specify which geogrid fields to use
# Geogrid fields are typically found in:
# <RUN_PATH>/share/results/grids/<geogridname>--<property-name>.roff
# Optional keyword
geogrid_fields:
# Prefix (name of geogrid) to be used for field parameters related to the
# geogrid.
geogrid_name: "geogrid"
# Selected set of zone names to use in calculations of statistics.
# Must be one or more of the defined zones.
# Require at least one zone to be selected.
use_zones: ["Valysar", "Therys", "Volon"]
# Specify facies per zone either here or in global variables file.
facies_per_zone:
Valysar:
0: Floodplain
1: Channel
2: Crevasse
5: Coal
Therys:
6: Calcite
10: Offshore
11: Lowershoreface
12: Uppershoreface
Volon:
0: Floodplain
1: Channel
6: Calcite
# For each zone specify either Proportional, Top_conform or Base_conform
# as grid conformity.
# Conformity can be checked by opening the RMS job that has created
# the geogrid and check the grid settings for grid layers.
# Proportional means that number of layers is specified.
# Top or base conform means that grid cell thickness is specified.
# Required (but only for zones you want to use)
zone_conformity:
"Valysar": "Proportional"
"Therys": "Top_conform"
"Volon": "Proportional"
# For each zone specify which discrete parameter to use to calculate
# facies probability estimates.
# Possible names are those found in the
# share/results/grids/<geogridname>--<name>.roff
# files that are of discrete type.
# This key can be omitted or some of the lines specifying parameters
# for a zone if you don't want to use it.
discrete_property_param_per_zone:
"Valysar": ["facies"]
"Therys": ["facies"]
"Volon": ["facies"]
# For each zone specify which continuous parameter to use to
# calculate estimate of mean and stdev over ensemble.
# Possible names are those found in the
# share/results/grids/<geogridname>--<name>.roff
# files that are of continuous type
# This key can be omitted or some of the lines specifying
# parameters for a zone if you don't want to use it.
continuous_property_param_per_zone:
"Valysar": ["phit", "klogh"]
"Therys": ["phit", "klogh"]
"Volon": ["phit", "klogh"]
# Specify which temporary field parameters (in ertbox) to use
# to calculate mean and stdev
# Optional keyword
temporary_ertbox_fields:
# Relative path relative to ERT <RUN_PATH> for localisation of
# initial ensemble of field parameters
initial_relative_path: "rms/output/aps"
# Field parameter names as specified in ERT FIELD keywords
# grouped by zone
parameter_name_per_zone:
Volon: [ aps_Volon_GRF1, aps_Volon_GRF2, aps_Volon_GRF3]
Therys: [ aps_Therys_GRF1, aps_Therys_GRF2, aps_Therys_GRF3]
Valysar: [ aps_Valysar_GRF1, aps_Valysar_GRF2, aps_Valysar_GRF3]