cmflow 0.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
cmflow-0.0.0/PKG-INFO ADDED
@@ -0,0 +1,140 @@
1
+ Metadata-Version: 2.4
2
+ Name: cmflow
3
+ Version: 0.0.0
4
+ Summary: Building TOUGH2/Waiwera models from layers of conceptual models
5
+ Author-email: Angus Yeh <a.yeh@auckland.ac.nz>
6
+ Project-URL: Homepage, https://github.com/cyeh015/cmflow
7
+ Project-URL: Source Code, https://github.com/cyeh015/cmflow
8
+ Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.8
19
+ Description-Content-Type: text/markdown
20
+ Requires-Dist: shapely
21
+ Requires-Dist: rtree
22
+ Requires-Dist: PyTOUGH
23
+
24
+ # Install
25
+
26
+ pip install -U cmflow
27
+
28
+ # Install Dependency
29
+
30
+ On most platforms, you should be able to install these packages by:
31
+
32
+ pip install shapely
33
+ pip install rtree
34
+ pip install pytough
35
+
36
+ On Linux (Ubuntu shown here) these can be installed via apt-get:
37
+
38
+ sudo apt-get install -y python-shapely
39
+ sudo apt-get install -y python-rtree
40
+
41
+ # Example
42
+
43
+ Creates BMStats that can be used later, from Leapfrog Geology:
44
+
45
+ # (ONLY ONCE) geo used to get geology from Leapfrog geological model
46
+ cmgeo = mulgrid('g_very_fine.dat')
47
+
48
+ # CSV file created by Leapfrog using cmgeo above
49
+ leapfrog = LeapfrogGM()
50
+ leapfrog.import_leapfrog_csv('grid_gtmp_ay2017_03_6_fit.csv')
51
+
52
+ cm_geology = CM_Blocky(cmgeo, leapfrog)
53
+
54
+ # whatever active model we are working on
55
+ bmgeo = mulgrid('gwaixx_yy.dat')
56
+
57
+ bms_geology = cm_geology.calc_bmstats(bm_geo)
58
+ bms_geology.save('a.json')
59
+
60
+ A BMStats object can be reused (very fast) to eg.
61
+
62
+ bms_geology = BMStats('a.json')
63
+
64
+ # get a cell's stats
65
+ cs = bms_geology.cellstats['abc12']
66
+
67
+ # rock that occupies most in cell 'abc12'
68
+ rock_name = bms_geology.zones[np.argmax(cs)]
69
+
70
+ # how many rock in cell 'abc12'
71
+ n_rock = len(np.nonzero(cs))
72
+
73
+ # list all rocks in cell 'abc12'
74
+ rocks = [bm_geology.zones[i] for i in np.nonzero(cs)]
75
+
76
+ # find all blocks intersect with the zone
77
+ blocks, ratios = bm_geology.blocks_in_zone('BASE1')
78
+ block_idx, ratios = bm_geology.blocks_in_zone('BASE1', indices=True)
79
+
80
+
81
+ # BMStats
82
+
83
+ This is the object that we keep for later use. It is associated to a certain
84
+ "geometry" file. So each cell has information on zones. Usually this is
85
+ generated by cm.populate_model(), which can be expensive.
86
+
87
+ - ? should I call it CMStats?
88
+ - ? TODO, .cellstats access by cell index
89
+ - ? TODO, .
90
+
91
+ Base Model Stats, mainly numpy arrays with rows corresponding to mulgrid
92
+ blocks, and columns corresponding to zones. Each is a value, usually
93
+ between 0.0 and 1.0. Often 1.0 is indicating that particular block is fully
94
+ within the zone.
95
+
96
+ .stats numpy array (n,m), n = num of model blocks, m = num of zones
97
+ .zones list of zone names (str)
98
+ .zonestats dict of stats column by zone names
99
+ .cellstats dict of stats row by block name
100
+
101
+ 6 elements, 3 zones
102
+ A B C
103
+ 0.0, 0.7, 0.3, -> row sum to 1.0, element 0, 0.7 rock B, 0.3 rock C
104
+ 1.0, 0.0, 0.0,
105
+ 1.0, 0.0, 0.0,
106
+ 0.0, 0.5, 0.5,
107
+ 0.1, 0.2, 0.7,
108
+ 0.0, 1.0, 0.0,
109
+ (this is only one way of using it, such as a rocktype)
110
+
111
+ .stats, numpy array (n * m), n number of geometry cells, m number of zones
112
+ .zones, a list of zone name, eg. geology rock names, fault names etc
113
+ .zonestats, a dict keyed by zone name, an array of size number of cells, each cell is between
114
+ .cellstats, a dict of stats by cell name
115
+
116
+ .save()
117
+ .load()
118
+ .add_stats() add another bmstat, merge stats
119
+ .add_cm() calls cm.populate_model, and merge stats
120
+
121
+ # CM
122
+ # CM_Blocky
123
+ # CM_Prism
124
+ # CM_Faults
125
+
126
+ These are the objects that can be created in order to create the final BMStats
127
+ objects. The common method .populate_model(bm_geo) is called to create BMStats
128
+ objects. It means the conceptual model is "applied" onto the bm_geo.
129
+
130
+ - TODO, .populate_model() should return BMStats instead
131
+ - ? TODO, .populate_model() should be called something else?
132
+
133
+ .populate_model(bm_geo) takes a target geometry, and return/creates BMStats
134
+
135
+
136
+ # LeapfrogGM
137
+
138
+
139
+
140
+
cmflow-0.0.0/README.md ADDED
@@ -0,0 +1,117 @@
1
+ # Install
2
+
3
+ pip install -U cmflow
4
+
5
+ # Install Dependency
6
+
7
+ On most platforms, you should be able to install these packages by:
8
+
9
+ pip install shapely
10
+ pip install rtree
11
+ pip install pytough
12
+
13
+ On Linux (Ubuntu shown here) these can be installed via apt-get:
14
+
15
+ sudo apt-get install -y python-shapely
16
+ sudo apt-get install -y python-rtree
17
+
18
+ # Example
19
+
20
+ Creates BMStats that can be used later, from Leapfrog Geology:
21
+
22
+ # (ONLY ONCE) geo used to get geology from Leapfrog geological model
23
+ cmgeo = mulgrid('g_very_fine.dat')
24
+
25
+ # CSV file created by Leapfrog using cmgeo above
26
+ leapfrog = LeapfrogGM()
27
+ leapfrog.import_leapfrog_csv('grid_gtmp_ay2017_03_6_fit.csv')
28
+
29
+ cm_geology = CM_Blocky(cmgeo, leapfrog)
30
+
31
+ # whatever active model we are working on
32
+ bmgeo = mulgrid('gwaixx_yy.dat')
33
+
34
+ bms_geology = cm_geology.calc_bmstats(bm_geo)
35
+ bms_geology.save('a.json')
36
+
37
+ A BMStats object can be reused (very fast) to eg.
38
+
39
+ bms_geology = BMStats('a.json')
40
+
41
+ # get a cell's stats
42
+ cs = bms_geology.cellstats['abc12']
43
+
44
+ # rock that occupies most in cell 'abc12'
45
+ rock_name = bms_geology.zones[np.argmax(cs)]
46
+
47
+ # how many rock in cell 'abc12'
48
+ n_rock = len(np.nonzero(cs))
49
+
50
+ # list all rocks in cell 'abc12'
51
+ rocks = [bm_geology.zones[i] for i in np.nonzero(cs)]
52
+
53
+ # find all blocks intersect with the zone
54
+ blocks, ratios = bm_geology.blocks_in_zone('BASE1')
55
+ block_idx, ratios = bm_geology.blocks_in_zone('BASE1', indices=True)
56
+
57
+
58
+ # BMStats
59
+
60
+ This is the object that we keep for later use. It is associated to a certain
61
+ "geometry" file. So each cell has information on zones. Usually this is
62
+ generated by cm.populate_model(), which can be expensive.
63
+
64
+ - ? should I call it CMStats?
65
+ - ? TODO, .cellstats access by cell index
66
+ - ? TODO, .
67
+
68
+ Base Model Stats, mainly numpy arrays with rows corresponding to mulgrid
69
+ blocks, and columns corresponding to zones. Each is a value, usually
70
+ between 0.0 and 1.0. Often 1.0 is indicating that particular block is fully
71
+ within the zone.
72
+
73
+ .stats numpy array (n,m), n = num of model blocks, m = num of zones
74
+ .zones list of zone names (str)
75
+ .zonestats dict of stats column by zone names
76
+ .cellstats dict of stats row by block name
77
+
78
+ 6 elements, 3 zones
79
+ A B C
80
+ 0.0, 0.7, 0.3, -> row sum to 1.0, element 0, 0.7 rock B, 0.3 rock C
81
+ 1.0, 0.0, 0.0,
82
+ 1.0, 0.0, 0.0,
83
+ 0.0, 0.5, 0.5,
84
+ 0.1, 0.2, 0.7,
85
+ 0.0, 1.0, 0.0,
86
+ (this is only one way of using it, such as a rocktype)
87
+
88
+ .stats, numpy array (n * m), n number of geometry cells, m number of zones
89
+ .zones, a list of zone name, eg. geology rock names, fault names etc
90
+ .zonestats, a dict keyed by zone name, an array of size number of cells, each cell is between
91
+ .cellstats, a dict of stats by cell name
92
+
93
+ .save()
94
+ .load()
95
+ .add_stats() add another bmstat, merge stats
96
+ .add_cm() calls cm.populate_model, and merge stats
97
+
98
+ # CM
99
+ # CM_Blocky
100
+ # CM_Prism
101
+ # CM_Faults
102
+
103
+ These are the objects that can be created in order to create the final BMStats
104
+ objects. The common method .populate_model(bm_geo) is called to create BMStats
105
+ objects. It means the conceptual model is "applied" onto the bm_geo.
106
+
107
+ - TODO, .populate_model() should return BMStats instead
108
+ - ? TODO, .populate_model() should be called something else?
109
+
110
+ .populate_model(bm_geo) takes a target geometry, and return/creates BMStats
111
+
112
+
113
+ # LeapfrogGM
114
+
115
+
116
+
117
+
File without changes