<jupyter_start><jupyter_text>Uncertainty indicators for property fieldsIn the geosciences, uncertainty quantification relies on ensemble of models / realizations. The type of variables analysed can be viewed as: - Inputs for forward models (such as geomodelling, geophysical, hyrogeological, ... engines ) - Model outputs, which can be either of them e.g. density can be the output of a geo-modelling engine and an input for a geo-physical simulation.Or they can also be depicted as: - Categorical:      - lithocode     - any classification code   - Continuous:      - potential fields (from implicit modeling)     - hydro-, geo-, petro-, physical- properties (e.g. porosity, hydraulic conductivity, density, mag, velocity, ...)    Warning: Indicators based on discrete or categorical variable require a standard classification for the realizations of the considered ensemble. Note that it is not the case for the 1 million noddyverse models, but we will ignore this fact, just to illustrate the computation of the indicators.     Here, we focus on uncertainty quantification of property field and for the purpose of illustration we will use the following:  - 3D litho code (categorical) - 3D underlying scalar-field (continuous), byproduct of implicit modellingGiven an ensemble of property fields, there are two main ways to compute uncertainty indicators: - based on local cell comparison throughout the ensemble of realizations (e.g. Cardinality or Entropy) - note that it requires the same meshing for all realizations of the ensemble - using distances (Wasserstein, Jenson-Shannon, Fisher information metric ...) between summary statistics (e.g. semi-variogram, connectivity functions, MPH, topology indicators (matrices+....), persistent homology... that are computed for each realization) - in that case meshing might vary, and it enables the classification of realizations of an ensemble into clustersOne can note that cell-based uncertainty indicators will provide information about the local spatial variability of the property fields while distance-based ones will inform more about structural dis-similarity of the property fields.  DependenciesTo run these notebooks:% - noddyverse (available at https://github.com/Loop3D/noddyverse)  - numpy - pandas - urllib - gzip - matplotlib - datetime - pickle - seaborn - sklearn - scipy - pywt - mpl_toolkits   Download property fields<jupyter_code># import modules
from matplotlib import pyplot as plt
import matplotlib.colors as mcolors
import numpy as np
from datetime import datetime
import pickle
from loopUI import plot_voxet

picklefilenamedata = "./pickledata/synthetic-case-data.pickle"

# plotting parameters
slice_ix=0
slice_iy=0
slice_iz=7
aspectratio = 1 # !! in pixels !!

# import data
with open(picklefilenamedata, 'rb') as f:
    [lithocode_100,lithocode_50A,lithocode_50B,scalarfield_100,scalarfield_50A,
     scalarfield_50B,nx,ny,nz,nbsamples,clblab,clblabsf] = pickle.load(f)<jupyter_output><empty_output><jupyter_text>Property field plots<jupyter_code># CONTROL PLOT
print((datetime.now()).strftime('%d-%b-%Y (%H:%M:%S)')+" - "+"CONTROL PLOTs OF "+str(nbsamples)+" lithocode_100 MODELS.")
for s in [0]: #range(nbsamples): #
    plot_voxet(lithocode_100,s,clblab,slice_ix,slice_iy,slice_iz,aspectratio)
print((datetime.now()).strftime('%d-%b-%Y (%H:%M:%S)')+" - "+"CONTROL PLOTs OF "+str(nbsamples)+" lithocode_50A MODELS.")
for s in [0]: #range(nbsamples): #[0]: #
    plot_voxet(lithocode_50A,s,clblab,slice_ix,slice_iy,slice_iz,aspectratio)
print((datetime.now()).strftime('%d-%b-%Y (%H:%M:%S)')+" - "+"CONTROL PLOTs OF "+str(nbsamples)+" lithocode_50B MODELS.")
for s in [0]: #range(nbsamples): #[0]: #
    plot_voxet(lithocode_50B,s,clblab,slice_ix,slice_iy,slice_iz,aspectratio)

print((datetime.now()).strftime('%d-%b-%Y (%H:%M:%S)')+" - "+"CONTROL PLOTs OF "+str(nbsamples)+" scalarfield_100 MODELS.")
for s in [0]: #range(nbsamples): #
    plot_voxet(scalarfield_100,s,clblabsf,slice_ix,slice_iy,slice_iz,aspectratio)
print((datetime.now()).strftime('%d-%b-%Y (%H:%M:%S)')+" - "+"CONTROL PLOTs OF "+str(nbsamples)+" scalarfield_50A MODELS.")
for s in [0]: #range(nbsamples): #[0]: #
    plot_voxet(scalarfield_50A,s,clblabsf,slice_ix,slice_iy,slice_iz,aspectratio)
print((datetime.now()).strftime('%d-%b-%Y (%H:%M:%S)')+" - "+"CONTROL PLOTs OF "+str(nbsamples)+" scalarfield_50B MODELS.")
for s in [0]: #range(nbsamples): #[0]: #
    plot_voxet(scalarfield_50B,s,clblabsf,slice_ix,slice_iy,slice_iz,aspectratio)<jupyter_output>08-Nov-2021 (13:06:51) - CONTROL PLOTs OF 10 lithocode_100 MODELS.
{'fraction_non_alphanumeric': 0.11792967896920725, 'fraction_numerical': 0.016815898667831404, 'mean_word_length': 5.589928057553957, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '529241', 'license': 'MIT', 'n_tokens_mistral': 1536, 'n_tokens_neox': 1440, 'n_words': 451, 'path': 'ui-0-data.ipynb', 'repo_name': 'Loop3D/uncertaintyIndicators', 'size': '4579'}