Metadata-Version: 2.1
Name: cmflow
Version: 0.1.1.dev9
Summary: Building TOUGH2/Waiwera models from layers of conceptual models
Home-page: http://pypi.python.org/pypi/cmflow
Author: Angus Yeh
Author-email: a.yeh@auckland.ac.nz
License: LGPLv3
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 2
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Operating System :: OS Independent

# 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.populate_model(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, .

.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



