Skip to main content

Building TOUGH2/Waiwera models from layers of conceptual models

Project description

Install

pip install -U cmflow

Install Dependency

On Windows, Shapely and Rtree are easier to be installed by using Christoph Gohlke's non-official build:

descartes can be installed on all platform by:

pip install descartes

On Linux (Ubuntu shown here) these can be installed via apt-get:

sudo apt-get install -y python-shapely
sudo apt-get install -y python-rtree
sudo apt-get install -y python-descartes

Example

Creates BMStats that can be used later, from Leapfrog Geology:

# (ONLY ONCE) geo used to get geology from Leapfrog geological model
cmgeo = mulgrid('g_very_fine.dat')

# CSV file created by Leapfrog using cmgeo above
leapfrog = LeapfrogGM()
leapfrog.import_leapfrog_csv('grid_gtmp_ay2017_03_6_fit.csv')

cm_geology = CM_Blocky(cmgeo, leapfrog)

# whatever active model we are working on
bmgeo = mulgrid('gwaixx_yy.dat')

bms_geology = cm_geology.calc_bmstats(bm_geo)
bms_geology.save('a.json')

A BMStats object can be reused (very fast) to eg.

bms_geology = BMStats('a.json')

# get a cell's stats
cs = bms_geology.cellstats['abc12']

# rock that occupies most in cell 'abc12'
rock_name = bms_geology.zones[np.argmax(cs)]

# how many rock in cell 'abc12'
n_rock = len(np.nonzero(cs))

# list all rocks in cell 'abc12'
rocks = [bm_geology.zones[i] for i in np.nonzero(cs)]

BMStats

This is the object that we keep for later use. It is associated to a certain "geometry" file. So each cell has information on zones. Usually this is generated by cm.populate_model(), which can be expensive.

  • ? should I call it CMStats?
  • ? TODO, .cellstats access by cell index
  • ? TODO, .

Base Model Stats, mainly numpy arrays with rows corresponding to mulgrid blocks, and columns corresponding to zones. Each is a value, usually between 0.0 and 1.0. Often 1.0 is indicating that particular block is fully within the zone.

.stats numpy array (n,m), n = num of model blocks, m = num of zones .zones list of zone names (str) .zonestats dict of stats column by zone names .cellstats dict of stats row by block name

6 elements, 3 zones
 A    B    C
0.0, 0.7, 0.3,  -> row sum to 1.0, element 0, 0.7 rock B, 0.3 rock C 
1.0, 0.0, 0.0, 
1.0, 0.0, 0.0, 
0.0, 0.5, 0.5, 
0.1, 0.2, 0.7, 
0.0, 1.0, 0.0, 
(this is only one way of using it, such as a rocktype)

.stats, numpy array (n * m), n number of geometry cells, m number of zones .zones, a list of zone name, eg. geology rock names, fault names etc .zonestats, a dict keyed by zone name, an array of size number of cells, each cell is between .cellstats, a dict of stats by cell name

.save() .load() .add_stats() add another bmstat, merge stats .add_cm() calls cm.populate_model, and merge stats

CM

CM_Blocky

CM_Prism

CM_Faults

These are the objects that can be created in order to create the final BMStats objects. The common method .populate_model(bm_geo) is called to create BMStats objects. It means the conceptual model is "applied" onto the bm_geo.

  • TODO, .populate_model() should return BMStats instead
  • ? TODO, .populate_model() should be called something else?

.populate_model(bm_geo) takes a target geometry, and return/creates BMStats

LeapfrogGM

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cmflow-0.1.1.dev55.tar.gz (500.0 kB view details)

Uploaded Source

Built Distribution

cmflow-0.1.1.dev55-py2-none-any.whl (500.7 kB view details)

Uploaded Python 2

File details

Details for the file cmflow-0.1.1.dev55.tar.gz.

File metadata

  • Download URL: cmflow-0.1.1.dev55.tar.gz
  • Upload date:
  • Size: 500.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.17

File hashes

Hashes for cmflow-0.1.1.dev55.tar.gz
Algorithm Hash digest
SHA256 eef8347a88e8b91eee04d6bfcc6c79f913d68b22c0c9fcae72c47c8e5966f584
MD5 29f22005a3da7abc11543ad22a93ffac
BLAKE2b-256 d2869cebe7582eaaee545fc61e7770fa6ac4e6cecb3f6bc52a03fb72bdb531bd

See more details on using hashes here.

File details

Details for the file cmflow-0.1.1.dev55-py2-none-any.whl.

File metadata

  • Download URL: cmflow-0.1.1.dev55-py2-none-any.whl
  • Upload date:
  • Size: 500.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/2.7.17

File hashes

Hashes for cmflow-0.1.1.dev55-py2-none-any.whl
Algorithm Hash digest
SHA256 16e39bc060a8cc2d4f82b5d49e599233a76a838c73cdb2d1481fc9e00297472c
MD5 25ab10eda2b7f926d5f6062ecf9d87dd
BLAKE2b-256 2700d5e1db417a4fb1d0c6bfd5b032099abe4fe29a03fc281b12de371ff1d029

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page