Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Install

pip install -U cmflow

Install Dependency

On most platforms, you should be able to install these packages by:

pip install shapely
pip install rtree
pip install pytough

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

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)]

# find all blocks intersect with the zone
blocks, ratios = bm_geology.blocks_in_zone('BASE1')
block_idx, ratios = bm_geology.blocks_in_zone('BASE1', indices=True)

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

Build and Publish

To bump version, create a tag, eg. v0.1.0.

If upload for the first time, create a PyPI account token, then use it for the publish step. The PyPI project will be created on first upload. Then revoke the account token and create a project token for later publishes.

Publish to PyPI:

hatch build
hatch publish dist/*

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.3.3.dev2.tar.gz (424.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cmflow-0.3.3.dev2-py3-none-any.whl (447.6 kB view details)

Uploaded Python 3

File details

Details for the file cmflow-0.3.3.dev2.tar.gz.

File metadata

  • Download URL: cmflow-0.3.3.dev2.tar.gz
  • Upload date:
  • Size: 424.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.1 {"ci":null,"cpu":"arm64","distro":{"name":"macOS","version":"26.6"},"implementation":{"name":"CPython","version":"3.11.15"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.6.2 7 Apr 2026","python":"3.11.15","system":{"name":"Darwin","release":"25.6.0"}} HTTPX2/2.9.1

File hashes

Hashes for cmflow-0.3.3.dev2.tar.gz
Algorithm Hash digest
SHA256 fbdc4d789236d4f8eb552f32a2a0cca8e01988ac7c676102a05804b2a1fdc948
MD5 72e5d115c9722638fc8375211b27efd2
BLAKE2b-256 e8ad70ea48d52793798096df92a061b6a32614a1dd75879d25694ec3d75bc57a

See more details on using hashes here.

File details

Details for the file cmflow-0.3.3.dev2-py3-none-any.whl.

File metadata

  • Download URL: cmflow-0.3.3.dev2-py3-none-any.whl
  • Upload date:
  • Size: 447.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Hatch/1.17.1 {"ci":null,"cpu":"arm64","distro":{"name":"macOS","version":"26.6"},"implementation":{"name":"CPython","version":"3.11.15"},"installer":{"name":"hatch","version":"1.17.1"},"openssl_version":"OpenSSL 3.6.2 7 Apr 2026","python":"3.11.15","system":{"name":"Darwin","release":"25.6.0"}} HTTPX2/2.9.1

File hashes

Hashes for cmflow-0.3.3.dev2-py3-none-any.whl
Algorithm Hash digest
SHA256 c48f048c48c5b0a853d2b88c63f9281f981df08f5f11ee2d06e9e8352afdf5b2
MD5 fa6ef24ca0d4958fc79df3b4d2f0c1e8
BLAKE2b-256 b2c65f27d413dcd54684748d9a520405697dd8e0968aa4bf0b647430a7599b34

See more details on using hashes here.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page