cmflow 0.1.1.dev55__tar.gz → 0.3.1__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.
Files changed (35) hide show
  1. cmflow-0.3.1/.github/workflows/pypi.yml +32 -0
  2. {cmflow-0.1.1.dev55 → cmflow-0.3.1}/.github/workflows/unittest.yml +2 -7
  3. cmflow-0.3.1/.gitignore +33 -0
  4. cmflow-0.3.1/PKG-INFO +152 -0
  5. {cmflow-0.1.1.dev55 → cmflow-0.3.1}/README.md +21 -11
  6. cmflow-0.3.1/cmflow/conceptual_models.py +631 -0
  7. cmflow-0.1.1.dev55/cmflow/conceptual_models.py → cmflow-0.3.1/cmflow/conceptual_models.py.bak +36 -11
  8. cmflow-0.3.1/cmflow/geom_3dface_utils.py +409 -0
  9. cmflow-0.3.1/cmflow/geom_surface_utils.py +457 -0
  10. cmflow-0.3.1/cmflow/t2data_utils.py +458 -0
  11. cmflow-0.1.1.dev55/cmflow/t2data_utils.py → cmflow-0.3.1/cmflow/t2data_utils.py.bak +28 -0
  12. cmflow-0.3.1/cmflow/test_conceptual_models.py +285 -0
  13. cmflow-0.3.1/cmflow/test_conceptual_models.py.bak +285 -0
  14. cmflow-0.3.1/pyproject.toml +45 -0
  15. cmflow-0.1.1.dev55/.github/workflows/pypi.yml +0 -32
  16. cmflow-0.1.1.dev55/AUTHORS +0 -1
  17. cmflow-0.1.1.dev55/ChangeLog +0 -89
  18. cmflow-0.1.1.dev55/PKG-INFO +0 -130
  19. cmflow-0.1.1.dev55/cmflow/schema_wet_surface_features.json +0 -27
  20. cmflow-0.1.1.dev55/cmflow/test_conceptual_models.py +0 -150
  21. cmflow-0.1.1.dev55/cmflow/test_geom_3dface_utils_geom.dat +0 -12770
  22. cmflow-0.1.1.dev55/cmflow.egg-info/PKG-INFO +0 -130
  23. cmflow-0.1.1.dev55/cmflow.egg-info/SOURCES.txt +0 -24
  24. cmflow-0.1.1.dev55/cmflow.egg-info/dependency_links.txt +0 -1
  25. cmflow-0.1.1.dev55/cmflow.egg-info/not-zip-safe +0 -1
  26. cmflow-0.1.1.dev55/cmflow.egg-info/pbr.json +0 -1
  27. cmflow-0.1.1.dev55/cmflow.egg-info/top_level.txt +0 -1
  28. cmflow-0.1.1.dev55/setup.cfg +0 -24
  29. cmflow-0.1.1.dev55/setup.py +0 -8
  30. {cmflow-0.1.1.dev55 → cmflow-0.3.1}/cmflow/__init__.py +0 -0
  31. /cmflow-0.1.1.dev55/cmflow/geom_3dface_utils.py → /cmflow-0.3.1/cmflow/geom_3dface_utils.py.bak +0 -0
  32. /cmflow-0.1.1.dev55/cmflow/geom_surface_utils.py → /cmflow-0.3.1/cmflow/geom_surface_utils.py.bak +0 -0
  33. {cmflow-0.1.1.dev55 → cmflow-0.3.1}/cmflow/test_geom_3dface_utils.py +0 -0
  34. {cmflow-0.1.1.dev55 → cmflow-0.3.1}/cmflow/test_geom_3dface_utils_ex.ts +0 -0
  35. {cmflow-0.1.1.dev55 → cmflow-0.3.1}/cmflow/test_geom_surface_utils.py +0 -0
@@ -0,0 +1,32 @@
1
+ name: Publish on PyPI
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - 'develop'
7
+ - 'master'
8
+
9
+ jobs:
10
+ deploy:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: [3.13]
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+ with:
18
+ fetch-depth: 0
19
+ - name: Set up Python 3.13
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: '3.13'
23
+ - name: Install Hatch
24
+ run: |
25
+ python -m pip install --upgrade pip hatch
26
+ - name: Build and publish on PyPI
27
+ env:
28
+ HATCH_INDEX_USER: __token__
29
+ HATCH_INDEX_AUTH: ${{ secrets.PYPI_PASSWORD }}
30
+ run: |
31
+ hatch build
32
+ hatch publish --no-prompt dist/*
@@ -11,7 +11,7 @@ jobs:
11
11
  runs-on: ubuntu-latest
12
12
  strategy:
13
13
  matrix:
14
- python-version: [2.7]
14
+ python-version: [3.13]
15
15
  steps:
16
16
  - uses: actions/checkout@v1
17
17
  - name: Set up Python ${{ matrix.python-version }}
@@ -31,12 +31,7 @@ jobs:
31
31
  pip install matplotlib
32
32
  pip install shapely
33
33
  pip install rtree
34
- pip install descartes
35
- mkdir pytough
36
- cd pytough
37
- git clone https://github.com/acroucher/PyTOUGH.git .
38
- pip install .
39
- cd ..
34
+ pip install pytough
40
35
  - name: Unit tests
41
36
  env:
42
37
  TWINE_USERNAME: __token__
@@ -0,0 +1,33 @@
1
+ *.pyc
2
+ *.pyo
3
+ *.npy
4
+ *.dat
5
+ *.json
6
+ *.incon
7
+ *.png
8
+ *.csv
9
+ *.xyz
10
+
11
+ # Sphinx
12
+ doc/source/reference/api/
13
+
14
+ # Files created by releasenotes build
15
+ releasenotes/build
16
+
17
+ # Packages/installer info
18
+ *.eggs
19
+ *.egg
20
+ *.egg-info
21
+ dist
22
+ build
23
+
24
+ # Other
25
+ AUTHORS
26
+ ChangeLog
27
+
28
+ # Editor files
29
+ *~
30
+ *.swp
31
+
32
+ # virtualenv
33
+ env_*/
cmflow-0.3.1/PKG-INFO ADDED
@@ -0,0 +1,152 @@
1
+ Metadata-Version: 2.4
2
+ Name: cmflow
3
+ Version: 0.3.1
4
+ Summary: Building TOUGH2/Waiwera models from layers of conceptual models
5
+ Project-URL: Homepage, https://github.com/cyeh015/cmflow
6
+ Project-URL: Source Code, https://github.com/cyeh015/cmflow
7
+ Author-email: Angus Yeh <a.yeh@auckland.ac.nz>
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
+ Requires-Dist: pytough
20
+ Requires-Dist: rtree
21
+ Requires-Dist: shapely
22
+ Description-Content-Type: text/markdown
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
+
141
+ # Build and Publish
142
+
143
+ To bump version, create a tag, eg. `v0.1.0`.
144
+
145
+ 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.
146
+
147
+ Publish to PyPI:
148
+
149
+ ```console
150
+ hatch build
151
+ hatch publish dist/*
152
+ ```
@@ -4,20 +4,16 @@
4
4
 
5
5
  # Install Dependency
6
6
 
7
- On Windows, `Shapely` and `Rtree` are easier to be installed by using Christoph Gohlke's non-official build:
7
+ On most platforms, you should be able to install these packages by:
8
8
 
9
- - [https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely](https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely)
10
- - [https://www.lfd.uci.edu/~gohlke/pythonlibs/#rtree](https://www.lfd.uci.edu/~gohlke/pythonlibs/#rtree)
11
-
12
- `descartes` can be installed on all platform by:
13
-
14
- pip install descartes
9
+ pip install shapely
10
+ pip install rtree
11
+ pip install pytough
15
12
 
16
13
  On Linux (Ubuntu shown here) these can be installed via apt-get:
17
14
 
18
15
  sudo apt-get install -y python-shapely
19
16
  sudo apt-get install -y python-rtree
20
- sudo apt-get install -y python-descartes
21
17
 
22
18
  # Example
23
19
 
@@ -53,9 +49,11 @@ A BMStats object can be reused (very fast) to eg.
53
49
 
54
50
  # list all rocks in cell 'abc12'
55
51
  rocks = [bm_geology.zones[i] for i in np.nonzero(cs)]
56
-
57
-
58
-
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
+
59
57
 
60
58
  # BMStats
61
59
 
@@ -117,3 +115,15 @@ objects. It means the conceptual model is "applied" onto the bm_geo.
117
115
 
118
116
 
119
117
 
118
+ # Build and Publish
119
+
120
+ To bump version, create a tag, eg. `v0.1.0`.
121
+
122
+ 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.
123
+
124
+ Publish to PyPI:
125
+
126
+ ```console
127
+ hatch build
128
+ hatch publish dist/*
129
+ ```