pygmi 2.2.7__zip

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 (106) hide show
  1. pygmi-2.2.7/LICENSE.txt +623 -0
  2. pygmi-2.2.7/MANIFEST.in +7 -0
  3. pygmi-2.2.7/PKG-INFO +47 -0
  4. pygmi-2.2.7/README.md +55 -0
  5. pygmi-2.2.7/README.rst +20 -0
  6. pygmi-2.2.7/log.txt +242 -0
  7. pygmi-2.2.7/pygmi/__init__.py +22 -0
  8. pygmi-2.2.7/pygmi/clust/__init__.py +4 -0
  9. pygmi-2.2.7/pygmi/clust/crisp_clust.py +708 -0
  10. pygmi-2.2.7/pygmi/clust/datatypes.py +65 -0
  11. pygmi-2.2.7/pygmi/clust/fuzzy_clust.py +906 -0
  12. pygmi-2.2.7/pygmi/clust/graphs.py +421 -0
  13. pygmi-2.2.7/pygmi/clust/graphtool.py +667 -0
  14. pygmi-2.2.7/pygmi/clust/menu.py +139 -0
  15. pygmi-2.2.7/pygmi/clust/var_ratio.py +92 -0
  16. pygmi-2.2.7/pygmi/clust/xie_beni.py +93 -0
  17. pygmi-2.2.7/pygmi/helpdocs/linepointer.png +0 -0
  18. pygmi-2.2.7/pygmi/helpdocs/pygmi.main.html +31 -0
  19. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.ddisp.html +15 -0
  20. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.iodefs.exportkmz.html +13 -0
  21. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.iodefs.importpicture.html +16 -0
  22. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.layer.html +17 -0
  23. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.mext.html +44 -0
  24. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.misc.rangedcopy.html +16 -0
  25. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.param.html +37 -0
  26. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.prof.html +32 -0
  27. pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.pview.html +26 -0
  28. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.gradients.html +14 -0
  29. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.tilt.html +14 -0
  30. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.visibility.html +14 -0
  31. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datagrid.html +13 -0
  32. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datamerge.html +11 -0
  33. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datareproj.html +11 -0
  34. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.rtp.html +14 -0
  35. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.ginterp.html +31 -0
  36. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.igrf.html +20 -0
  37. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.normalisation.html +14 -0
  38. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.smooth.html +22 -0
  39. pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.tiltdepth.html +20 -0
  40. pygmi-2.2.7/pygmi/images/Help.png +0 -0
  41. pygmi-2.2.7/pygmi/images/bringtofront.png +0 -0
  42. pygmi-2.2.7/pygmi/images/cgs2.emf +0 -0
  43. pygmi-2.2.7/pygmi/images/delete.png +0 -0
  44. pygmi-2.2.7/pygmi/images/linepointer.png +0 -0
  45. pygmi-2.2.7/pygmi/images/logo256.ico +0 -0
  46. pygmi-2.2.7/pygmi/images/logo256.png +0 -0
  47. pygmi-2.2.7/pygmi/images/pointer.png +0 -0
  48. pygmi-2.2.7/pygmi/images/pygmi.png +0 -0
  49. pygmi-2.2.7/pygmi/images/sendtoback.png +0 -0
  50. pygmi-2.2.7/pygmi/main.py +1037 -0
  51. pygmi-2.2.7/pygmi/menu_default.py +327 -0
  52. pygmi-2.2.7/pygmi/misc.py +147 -0
  53. pygmi-2.2.7/pygmi/pfmod/__init__.py +6 -0
  54. pygmi-2.2.7/pygmi/pfmod/cubes.py +1488 -0
  55. pygmi-2.2.7/pygmi/pfmod/datatypes.py +292 -0
  56. pygmi-2.2.7/pygmi/pfmod/grvmag3d.py +1265 -0
  57. pygmi-2.2.7/pygmi/pfmod/iodefs.py +1001 -0
  58. pygmi-2.2.7/pygmi/pfmod/menu.py +107 -0
  59. pygmi-2.2.7/pygmi/pfmod/misc.py +301 -0
  60. pygmi-2.2.7/pygmi/pfmod/pfmod.py +248 -0
  61. pygmi-2.2.7/pygmi/pfmod/tab_ddisp.py +425 -0
  62. pygmi-2.2.7/pygmi/pfmod/tab_layer.py +490 -0
  63. pygmi-2.2.7/pygmi/pfmod/tab_mext.py +544 -0
  64. pygmi-2.2.7/pygmi/pfmod/tab_param.py +548 -0
  65. pygmi-2.2.7/pygmi/pfmod/tab_prof.py +946 -0
  66. pygmi-2.2.7/pygmi/pfmod/tab_pview.py +740 -0
  67. pygmi-2.2.7/pygmi/raster/IGRF11.COF +1635 -0
  68. pygmi-2.2.7/pygmi/raster/__init__.py +14 -0
  69. pygmi-2.2.7/pygmi/raster/cooper.py +718 -0
  70. pygmi-2.2.7/pygmi/raster/dataprep.py +1640 -0
  71. pygmi-2.2.7/pygmi/raster/datatypes.py +123 -0
  72. pygmi-2.2.7/pygmi/raster/equation_editor.py +256 -0
  73. pygmi-2.2.7/pygmi/raster/ginterp.py +1901 -0
  74. pygmi-2.2.7/pygmi/raster/graphs.py +531 -0
  75. pygmi-2.2.7/pygmi/raster/igrf.py +860 -0
  76. pygmi-2.2.7/pygmi/raster/iodefs.py +813 -0
  77. pygmi-2.2.7/pygmi/raster/menu.py +307 -0
  78. pygmi-2.2.7/pygmi/raster/normalisation.py +187 -0
  79. pygmi-2.2.7/pygmi/raster/show_table.py +245 -0
  80. pygmi-2.2.7/pygmi/raster/smooth.py +406 -0
  81. pygmi-2.2.7/pygmi/raster/tiltdepth.py +590 -0
  82. pygmi-2.2.7/pygmi/seis/__init__.py +0 -0
  83. pygmi-2.2.7/pygmi/seis/beachball.py +751 -0
  84. pygmi-2.2.7/pygmi/seis/datatypes.py +605 -0
  85. pygmi-2.2.7/pygmi/seis/del_rec.py +410 -0
  86. pygmi-2.2.7/pygmi/seis/iodefs.py +1261 -0
  87. pygmi-2.2.7/pygmi/seis/menu.py +136 -0
  88. pygmi-2.2.7/pygmi/seis/scan_imp.py +795 -0
  89. pygmi-2.2.7/pygmi/test/__init__.py +6 -0
  90. pygmi-2.2.7/pygmi/test/pfmod.py +212 -0
  91. pygmi-2.2.7/pygmi/test/tests.py +39 -0
  92. pygmi-2.2.7/pygmi/vector/__init__.py +7 -0
  93. pygmi-2.2.7/pygmi/vector/datatypes.py +74 -0
  94. pygmi-2.2.7/pygmi/vector/graphs.py +443 -0
  95. pygmi-2.2.7/pygmi/vector/iodefs.py +345 -0
  96. pygmi-2.2.7/pygmi/vector/menu.py +127 -0
  97. pygmi-2.2.7/pygmi.egg-info/PKG-INFO +47 -0
  98. pygmi-2.2.7/pygmi.egg-info/SOURCES.txt +105 -0
  99. pygmi-2.2.7/pygmi.egg-info/dependency_links.txt +1 -0
  100. pygmi-2.2.7/pygmi.egg-info/entry_points.txt +3 -0
  101. pygmi-2.2.7/pygmi.egg-info/not-zip-safe +1 -0
  102. pygmi-2.2.7/pygmi.egg-info/requires.txt +7 -0
  103. pygmi-2.2.7/pygmi.egg-info/top_level.txt +1 -0
  104. pygmi-2.2.7/quickstart.py +35 -0
  105. pygmi-2.2.7/setup.cfg +8 -0
  106. pygmi-2.2.7/setup.py +80 -0
@@ -0,0 +1,544 @@
1
+ # -----------------------------------------------------------------------------
2
+ # Name: tab_mext.py (part of PyGMI)
3
+ #
4
+ # Author: Patrick Cole
5
+ # E-Mail: pcole@geoscience.org.za
6
+ #
7
+ # Copyright: (c) 2013 Council for Geoscience
8
+ # Licence: GPL-3.0
9
+ #
10
+ # This file is part of PyGMI
11
+ #
12
+ # PyGMI is free software: you can redistribute it and/or modify
13
+ # it under the terms of the GNU General Public License as published by
14
+ # the Free Software Foundation, either version 3 of the License, or
15
+ # (at your option) any later version.
16
+ #
17
+ # PyGMI is distributed in the hope that it will be useful,
18
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
19
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20
+ # GNU General Public License for more details.
21
+ #
22
+ # You should have received a copy of the GNU General Public License
23
+ # along with this program. If not, see <http://www.gnu.org/licenses/>.
24
+ # -----------------------------------------------------------------------------
25
+ """ Model Extension Display Tab Routines """
26
+
27
+ from PyQt4 import QtGui
28
+ import numpy as np
29
+ import scipy.interpolate as si
30
+
31
+
32
+ class MextDisplay(object):
33
+ """ Widget class to call the main interface """
34
+ def __init__(self, parent):
35
+ self.parent = parent
36
+ self.lmod1 = parent.lmod1 # actual model
37
+ self.lmod2 = parent.lmod2
38
+ self.showtext = parent.showtext
39
+ self.pbars = self.parent.pbars
40
+
41
+ self.userint = QtGui.QWidget()
42
+
43
+ self.combo_model = QtGui.QComboBox()
44
+ self.combo_regional = QtGui.QComboBox()
45
+ self.pb_regional = QtGui.QPushButton()
46
+ self.combo_dtm = QtGui.QComboBox()
47
+ self.combo_mag = QtGui.QComboBox()
48
+ self.combo_grv = QtGui.QComboBox()
49
+ self.combo_reggrv = QtGui.QComboBox()
50
+ self.combo_dataset = QtGui.QComboBox()
51
+ self.dsb_utlx = QtGui.QDoubleSpinBox()
52
+ self.dsb_utly = QtGui.QDoubleSpinBox()
53
+ self.dsb_utlz = QtGui.QDoubleSpinBox()
54
+ self.dsb_xextent = QtGui.QDoubleSpinBox()
55
+ self.dsb_yextent = QtGui.QDoubleSpinBox()
56
+ self.dsb_zextent = QtGui.QDoubleSpinBox()
57
+ self.dsb_xycell = QtGui.QDoubleSpinBox()
58
+ self.dsb_zcell = QtGui.QDoubleSpinBox()
59
+ self.sb_cols = QtGui.QSpinBox()
60
+ self.sb_rows = QtGui.QSpinBox()
61
+ self.sb_layers = QtGui.QSpinBox()
62
+ self.pb_apply_changes = QtGui.QPushButton()
63
+
64
+ self.setupui()
65
+ self.init()
66
+
67
+ def setupui(self):
68
+ """ Setup UI """
69
+ verticallayout = QtGui.QVBoxLayout(self.userint)
70
+ groupbox_model = QtGui.QGroupBox()
71
+ groupbox_extent = QtGui.QGroupBox()
72
+ groupbox_data_info = QtGui.QGroupBox()
73
+
74
+ gridlayout_model = QtGui.QGridLayout(groupbox_model)
75
+ gridlayout = QtGui.QGridLayout(groupbox_extent)
76
+ gridlayout_2 = QtGui.QGridLayout(groupbox_data_info)
77
+
78
+ sizepolicy2 = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred,
79
+ QtGui.QSizePolicy.Preferred)
80
+
81
+ # Current Models Groupbox
82
+ lbl1_model = QtGui.QLabel()
83
+ lbl2_model = QtGui.QLabel()
84
+ self.pb_regional.setSizePolicy(sizepolicy2)
85
+
86
+ # Data Information Groupbox
87
+ lbl1_2 = QtGui.QLabel()
88
+ lbl2_2 = QtGui.QLabel()
89
+ lbl3_2 = QtGui.QLabel()
90
+ lbl4_2 = QtGui.QLabel()
91
+
92
+ gridlayout_2.setColumnStretch(0, 1)
93
+ gridlayout_2.setColumnStretch(1, 1)
94
+ gridlayout_2.setColumnStretch(2, 1)
95
+
96
+ # Data Extents Groupbox
97
+ lbl0 = QtGui.QLabel()
98
+ lbl3 = QtGui.QLabel()
99
+ lbl4 = QtGui.QLabel()
100
+ lbl1 = QtGui.QLabel()
101
+ lbl8 = QtGui.QLabel()
102
+ lbl9 = QtGui.QLabel()
103
+ lbl10 = QtGui.QLabel()
104
+ lbl5 = QtGui.QLabel()
105
+ lbl6 = QtGui.QLabel()
106
+ # lbl7 = QtGui.QLabel()
107
+ # lbl11 = QtGui.QLabel()
108
+ # lbl2 = QtGui.QLabel()
109
+
110
+ self.dsb_utlx.setMinimum(-999999999.0)
111
+ self.dsb_utlx.setMaximum(999999999.0)
112
+ self.dsb_utly.setMinimum(-999999999.0)
113
+ self.dsb_utly.setMaximum(999999999.0)
114
+ self.dsb_utlz.setMinimum(-999999999.0)
115
+ self.dsb_utlz.setMaximum(999999999.0)
116
+ self.dsb_xextent.setEnabled(True)
117
+ self.dsb_xextent.setMinimum(0.1)
118
+ self.dsb_xextent.setMaximum(2000000000.0)
119
+ self.dsb_yextent.setEnabled(True)
120
+ self.dsb_yextent.setMinimum(0.1)
121
+ self.dsb_yextent.setMaximum(2000000000.0)
122
+ self.dsb_zextent.setEnabled(True)
123
+ self.dsb_zextent.setMinimum(0.1)
124
+ self.dsb_zextent.setMaximum(2000000000.0)
125
+ self.dsb_xycell.setEnabled(True)
126
+ self.dsb_xycell.setMinimum(0.1)
127
+ self.dsb_xycell.setMaximum(1000000.0)
128
+ self.dsb_zcell.setEnabled(True)
129
+ self.dsb_zcell.setDecimals(2)
130
+ self.dsb_zcell.setMinimum(0.1)
131
+ self.dsb_zcell.setMaximum(1000000.0)
132
+ self.dsb_zcell.setSingleStep(1.0)
133
+ self.sb_cols.setEnabled(False)
134
+ self.sb_cols.setMinimum(1)
135
+ self.sb_cols.setMaximum(1000000)
136
+ self.sb_cols.setPrefix('Columns (X): ')
137
+ self.sb_rows.setEnabled(False)
138
+ self.sb_rows.setMinimum(1)
139
+ self.sb_rows.setMaximum(1000000)
140
+ self.sb_rows.setPrefix('Rows (Y): ')
141
+ self.sb_layers.setEnabled(False)
142
+ self.sb_layers.setMinimum(1)
143
+ self.sb_layers.setMaximum(1000000)
144
+ self.sb_layers.setPrefix('Layers (Z): ')
145
+ self.pb_apply_changes.setSizePolicy(sizepolicy2)
146
+
147
+ groupbox_model.setTitle("Current Models")
148
+ lbl1_model.setText("Current Model:")
149
+ lbl2_model.setText("Regional Model:")
150
+ self.pb_regional.setText("Apply Regional Model")
151
+ groupbox_data_info.setTitle("Dataset Information")
152
+ lbl1_2.setText("DTM Dataset:")
153
+ lbl2_2.setText("Magnetic Dataset:")
154
+ lbl3_2.setText("Gravity Dataset:")
155
+ lbl4_2.setText("Gravity Regional Dataset:")
156
+ groupbox_extent.setTitle("Model Extent Properties")
157
+ lbl0.setText("Get Study Area from following Dataset:")
158
+ lbl3.setText("Upper Top Left X Coordinate:")
159
+ lbl4.setText("Upper Top Left Y Coordinate:")
160
+ lbl1.setText("Upper Top Left Z Coordinate (from DTM):")
161
+ lbl8.setText("Total X Extent:")
162
+ lbl9.setText("Total Y Extent:")
163
+ lbl10.setText("Total Z Extent (Depth):")
164
+ lbl5.setText("X and Y Cell Size:")
165
+ lbl6.setText("Z Cell Size:")
166
+ # lbl7.setText("Number of Columns (X Direction):")
167
+ # lbl11.setText("Number of Rows (Y Direction):")
168
+ # lbl2.setText("Number of Layers (Z Direction):")
169
+ self.pb_apply_changes.setText("Accept Proposed Changes")
170
+
171
+ # Apply Groupboxes to main layout
172
+ gridlayout_model.addWidget(lbl1_model, 0, 0, 1, 1)
173
+ gridlayout_model.addWidget(lbl2_model, 1, 0, 1, 1)
174
+ gridlayout_model.addWidget(self.combo_model, 0, 1, 1, 1)
175
+ gridlayout_model.addWidget(self.combo_regional, 1, 1, 1, 1)
176
+ gridlayout_model.addWidget(self.pb_regional, 0, 2, 2, 1)
177
+
178
+ gridlayout_2.addWidget(lbl1_2, 0, 0, 1, 1)
179
+ gridlayout_2.addWidget(lbl2_2, 1, 0, 1, 1)
180
+ gridlayout_2.addWidget(lbl3_2, 2, 0, 1, 1)
181
+ gridlayout_2.addWidget(lbl4_2, 3, 0, 1, 1)
182
+ gridlayout_2.addWidget(self.combo_dtm, 0, 1, 1, 1)
183
+ gridlayout_2.addWidget(self.combo_mag, 1, 1, 1, 1)
184
+ gridlayout_2.addWidget(self.combo_grv, 2, 1, 1, 1)
185
+ gridlayout_2.addWidget(self.combo_reggrv, 3, 1, 1, 1)
186
+
187
+ gridlayout.addWidget(lbl0, 0, 0, 1, 1)
188
+ gridlayout.addWidget(lbl3, 1, 0, 1, 1)
189
+ gridlayout.addWidget(lbl4, 2, 0, 1, 1)
190
+ gridlayout.addWidget(lbl1, 3, 0, 1, 1)
191
+ gridlayout.addWidget(lbl8, 4, 0, 1, 1)
192
+ gridlayout.addWidget(lbl9, 5, 0, 1, 1)
193
+ gridlayout.addWidget(lbl10, 6, 0, 1, 1)
194
+ gridlayout.addWidget(lbl5, 7, 0, 1, 1)
195
+ gridlayout.addWidget(lbl6, 8, 0, 1, 1)
196
+ # gridlayout.addWidget(lbl7, 9, 0, 1, 1)
197
+ # gridlayout.addWidget(lbl11, 10, 0, 1, 1)
198
+ # gridlayout.addWidget(lbl2, 11, 0, 1, 1)
199
+ gridlayout.addWidget(self.combo_dataset, 0, 1, 1, 1)
200
+ gridlayout.addWidget(self.dsb_utlx, 1, 1, 1, 1)
201
+ gridlayout.addWidget(self.dsb_utly, 2, 1, 1, 1)
202
+ gridlayout.addWidget(self.dsb_utlz, 3, 1, 1, 1)
203
+ gridlayout.addWidget(self.dsb_xextent, 4, 1, 1, 1)
204
+ gridlayout.addWidget(self.dsb_yextent, 5, 1, 1, 1)
205
+ gridlayout.addWidget(self.dsb_zextent, 6, 1, 1, 1)
206
+ gridlayout.addWidget(self.dsb_xycell, 7, 1, 1, 1)
207
+ gridlayout.addWidget(self.dsb_zcell, 8, 1, 1, 1)
208
+ gridlayout.addWidget(self.sb_cols, 1, 2, 1, 1)
209
+ gridlayout.addWidget(self.sb_rows, 2, 2, 1, 1)
210
+ gridlayout.addWidget(self.sb_layers, 3, 2, 1, 1)
211
+ # gridlayout.addWidget(self.sb_cols, 9, 1, 1, 1)
212
+ # gridlayout.addWidget(self.sb_rows, 10, 1, 1, 1)
213
+ # gridlayout.addWidget(self.sb_layers, 11, 1, 1, 1)
214
+ gridlayout.addWidget(self.pb_apply_changes, 7, 2, 2, 1)
215
+
216
+ verticallayout.addWidget(groupbox_model)
217
+ verticallayout.addWidget(groupbox_data_info)
218
+ verticallayout.addWidget(groupbox_extent)
219
+
220
+ # Link functions
221
+ self.pb_regional.clicked.connect(self.apply_regional)
222
+ self.pb_apply_changes.clicked.connect(self.apply_changes)
223
+ self.dsb_xycell.valueChanged.connect(self.xycell)
224
+ self.dsb_zcell.valueChanged.connect(self.zcell)
225
+ self.dsb_utlx.valueChanged.connect(self.upd_layers)
226
+ self.dsb_utly.valueChanged.connect(self.upd_layers)
227
+ self.dsb_utlz.valueChanged.connect(self.upd_layers)
228
+ self.dsb_xextent.valueChanged.connect(self.upd_layers)
229
+ self.dsb_yextent.valueChanged.connect(self.upd_layers)
230
+ self.dsb_zextent.valueChanged.connect(self.upd_layers)
231
+
232
+ self.combo_dataset.addItems(['None'])
233
+ self.combo_dataset.currentIndexChanged.connect(self.get_area)
234
+ self.combo_mag.addItems(['None'])
235
+ self.combo_grv.addItems(['None'])
236
+ self.combo_reggrv.addItems(['None'])
237
+ self.combo_dtm.addItems(['None'])
238
+ self.combo_dtm.currentIndexChanged.connect(self.choose_dtm)
239
+
240
+ self.combo_model.addItems(['None'])
241
+ self.combo_regional.addItems(['None'])
242
+ self.combo_model.currentIndexChanged.connect(self.choose_model)
243
+ self.combo_regional.currentIndexChanged.connect(self.choose_regional)
244
+
245
+ def apply_changes(self):
246
+ """ Update when changing from this tab """
247
+ self.pbars.resetall()
248
+ self.showtext('Working...')
249
+
250
+ self.choose_combo(self.combo_dtm, 'DTM Dataset')
251
+ self.choose_combo(self.combo_mag, 'Magnetic Dataset')
252
+ self.choose_combo(self.combo_grv, 'Gravity Dataset')
253
+ self.choose_combo(self.combo_reggrv, 'Gravity Regional')
254
+ self.choose_combo(self.combo_dataset, 'Study Area Dataset')
255
+
256
+ cols = self.sb_cols.value()
257
+ rows = self.sb_rows.value()
258
+ layers = self.sb_layers.value()
259
+ utlx = self.dsb_utlx.value()
260
+ utly = self.dsb_utly.value()
261
+ utlz = self.dsb_utlz.value()
262
+ dxy = self.dsb_xycell.value()
263
+ d_z = self.dsb_zcell.value()
264
+
265
+ self.lmod1.update(cols, rows, layers, utlx, utly, utlz, dxy, d_z)
266
+
267
+ self.update_vals()
268
+
269
+ self.pbars.incr()
270
+ self.parent.outdata['Raster'] = list(self.lmod1.griddata.values())
271
+ self.showtext('Changes applied.')
272
+
273
+ def apply_regional(self):
274
+ """ Applies the regional model to the current model """
275
+ self.lmod1.lith_index[self.lmod1.lith_index > 899] = 0
276
+
277
+ ctxt = str(self.combo_regional.currentText())
278
+ if ctxt == 'None':
279
+ self.showtext('No regional model selected!')
280
+ return
281
+
282
+ self.pbars.resetall(self.lmod1.numx)
283
+ for i in range(self.lmod1.numx):
284
+ self.pbars.incr()
285
+ for j in range(self.lmod1.numy):
286
+ for k in range(self.lmod1.numz):
287
+ x = self.lmod1.xrange[0]+(i+0.5)*self.lmod1.dxy
288
+ y = self.lmod1.yrange[0]+(j+0.5)*self.lmod1.dxy
289
+ z = self.lmod1.zrange[-1]-(k+0.5)*self.lmod1.d_z
290
+ ii = int((x-self.lmod2.xrange[0])/self.lmod2.dxy)
291
+ jj = int((y-self.lmod2.yrange[0])/self.lmod2.dxy)
292
+ kk = int((self.lmod2.zrange[-1]-z)/self.lmod2.d_z)
293
+ tmp = self.lmod2.lith_index[ii, jj, kk]
294
+ if tmp > 0 and ii > -1 and jj > -1 and kk > -1:
295
+ self.lmod1.lith_index[i, j, k] = 900+tmp
296
+
297
+ for i in np.unique(self.lmod1.lith_index):
298
+ if i > 900:
299
+ self.lmod1.mlut[i] = self.lmod2.mlut[i-900]
300
+
301
+ self.showtext('Regional model applied.')
302
+
303
+ def choose_combo(self, combo, dtxt):
304
+ """ Combo box choice routine """
305
+ ctxt = str(combo.currentText())
306
+ if ctxt != 'None' and ctxt != '':
307
+ self.lmod1.griddata[dtxt] = self.parent.inraster[ctxt]
308
+ elif ctxt == 'None' and dtxt in self.lmod1.griddata:
309
+ self.lmod1.griddata.pop(dtxt)
310
+
311
+ def choose_dtm(self):
312
+ """ Combo box to choose current dataset """
313
+ ctxt = str(self.combo_dtm.currentText())
314
+ if ctxt != 'None' and ctxt != '':
315
+ curgrid = self.parent.inraster[ctxt]
316
+
317
+ self.dsb_utlz.setValue(curgrid.data.max())
318
+ zextent = curgrid.data.ptp()+self.dsb_zcell.value()
319
+ if zextent > self.dsb_zextent.value():
320
+ self.dsb_zextent.setValue(zextent)
321
+
322
+ self.upd_layers()
323
+
324
+ def choose_model(self):
325
+ """ Choose which model file to use """
326
+ ctxt = str(self.combo_model.currentText())
327
+ if ctxt == 'None' or 'Model3D' not in self.parent.indata:
328
+ return
329
+ # print('choose model')
330
+ for i in self.parent.indata['Model3D']:
331
+ if i.name == ctxt:
332
+ self.lmod1 = i
333
+ self.parent.lmod1 = i
334
+ self.update_vals()
335
+ self.update_combos()
336
+
337
+ def choose_regional(self):
338
+ """ Choose which regional model file to use """
339
+ ctxt = str(self.combo_regional.currentText())
340
+ if ctxt == 'None' or 'Model3D' not in self.parent.indata:
341
+ return
342
+ # print('choose regional')
343
+ for i in self.parent.indata['Model3D']:
344
+ if i.name == ctxt:
345
+ self.lmod2 = i
346
+ self.parent.lmod2 = i
347
+
348
+ def extgrid(self, gdata):
349
+ """ Extrapolates the grid to get rid of nulls. Uses a masked grid """
350
+ gtmp = np.array(gdata) # gets rid of masked array
351
+ gmask = np.logical_not(np.isnan(gtmp))
352
+
353
+ if gmask.min() is True:
354
+ return gdata
355
+
356
+ points1 = np.where(gmask)
357
+ z = gdata[gmask]
358
+ outg = np.ones_like(gtmp)
359
+ points2 = np.where(outg)
360
+ outg = si.griddata(points1, z, points2, method='nearest')
361
+
362
+ outg.shape = gtmp.shape
363
+ outg[gmask] = gdata[gmask]
364
+ outg = np.ma.array(outg)
365
+ outg.mask = gdata.mask
366
+
367
+ return outg
368
+
369
+ def get_area(self):
370
+ """ Get area """
371
+ ctxt = str(self.combo_dataset.currentText())
372
+ if ctxt != 'None' and ctxt != u'':
373
+ curgrid = self.parent.inraster[ctxt]
374
+
375
+ utlx = curgrid.tlx
376
+ utly = curgrid.tly
377
+ xextent = curgrid.cols*curgrid.xdim
378
+ yextent = curgrid.rows*curgrid.ydim
379
+ cols = xextent/self.dsb_xycell.value()
380
+ rows = yextent/self.dsb_xycell.value()
381
+
382
+ self.dsb_utlx.setValue(utlx)
383
+ self.dsb_utly.setValue(utly)
384
+ self.dsb_xextent.setValue(xextent)
385
+ self.dsb_yextent.setValue(yextent)
386
+ self.sb_cols.setValue(cols)
387
+ self.sb_rows.setValue(rows)
388
+
389
+ def init(self):
390
+ """ Initialize parameters """
391
+ # Extent Parameters
392
+ self.dsb_utlx.setValue(0.0)
393
+ self.dsb_utly.setValue(0.0)
394
+ self.dsb_utlz.setValue(0.0)
395
+ self.dsb_xextent.setValue(self.lmod1.numx*self.lmod1.dxy)
396
+ self.dsb_yextent.setValue(self.lmod1.numy*self.lmod1.dxy)
397
+ self.dsb_zextent.setValue(self.lmod1.numz*self.lmod1.d_z)
398
+ self.dsb_xycell.setValue(self.lmod1.dxy)
399
+ self.dsb_zcell.setValue(self.lmod1.d_z)
400
+ self.sb_cols.setValue(self.lmod1.numx)
401
+ self.sb_rows.setValue(self.lmod1.numy)
402
+ self.sb_layers.setValue(self.lmod1.numz)
403
+
404
+ def upd_layers(self):
405
+ """ Update the layers """
406
+ xextent = self.dsb_xextent.value()
407
+ yextent = self.dsb_yextent.value()
408
+ zextent = self.dsb_zextent.value()
409
+ dxy = self.dsb_xycell.value()
410
+ d_z = self.dsb_zcell.value()
411
+
412
+ numx = int(xextent/dxy)
413
+ numy = int(yextent/dxy)
414
+ numz = int(zextent/d_z)
415
+ self.sb_cols.setValue(numx)
416
+ self.sb_rows.setValue(numy)
417
+ self.sb_layers.setValue(numz)
418
+
419
+ def update_model_combos(self):
420
+ """ Updates the model combos """
421
+ modnames = ['None']
422
+ if 'Model3D' in self.parent.indata:
423
+ for i in self.parent.indata['Model3D']:
424
+ modnames.append(i.name)
425
+
426
+ self.combo_model.currentIndexChanged.disconnect()
427
+ self.combo_regional.currentIndexChanged.disconnect()
428
+
429
+ self.combo_model.clear()
430
+ self.combo_model.addItems(modnames)
431
+ self.combo_model.setCurrentIndex(0)
432
+ self.combo_regional.clear()
433
+ self.combo_regional.addItems(modnames)
434
+ self.combo_regional.setCurrentIndex(0)
435
+
436
+ if len(modnames) >= 2:
437
+ self.combo_model.setCurrentIndex(1)
438
+ if len(modnames) > 2:
439
+ self.combo_regional.setCurrentIndex(2)
440
+
441
+ self.combo_model.currentIndexChanged.connect(self.choose_model)
442
+ self.combo_regional.currentIndexChanged.connect(self.choose_regional)
443
+
444
+ def update_combos(self):
445
+ """ Update the combos """
446
+ gkeys = list(self.parent.inraster.keys())
447
+ if 'Calculated Gravity' in gkeys:
448
+ gkeys.remove('Calculated Gravity')
449
+ if 'Calculated Magnetics' in gkeys:
450
+ gkeys.remove('Calculated Magnetics')
451
+ gkeys = ['None'] + gkeys
452
+
453
+ if len(gkeys) > 1:
454
+ self.combo_dtm.clear()
455
+ self.combo_dtm.addItems(gkeys)
456
+ self.combo_dtm.setCurrentIndex(0)
457
+ self.combo_mag.clear()
458
+ self.combo_mag.addItems(gkeys)
459
+ self.combo_mag.setCurrentIndex(0)
460
+ self.combo_grv.clear()
461
+ self.combo_grv.addItems(gkeys)
462
+ self.combo_grv.setCurrentIndex(0)
463
+ self.combo_reggrv.clear()
464
+ self.combo_reggrv.addItems(gkeys)
465
+ self.combo_reggrv.setCurrentIndex(0)
466
+ self.combo_dataset.clear()
467
+ self.combo_dataset.addItems(gkeys)
468
+ self.combo_dataset.setCurrentIndex(0)
469
+
470
+ lkeys = list(self.lmod1.griddata.keys())
471
+ if 'DTM Dataset' in lkeys:
472
+ tmp = self.lmod1.griddata['DTM Dataset'].dataid
473
+ self.combo_dtm.setCurrentIndex(gkeys.index(tmp))
474
+
475
+ if 'Magnetic Dataset' in lkeys:
476
+ tmp = self.lmod1.griddata['Magnetic Dataset'].dataid
477
+ self.combo_mag.setCurrentIndex(gkeys.index(tmp))
478
+
479
+ if 'Gravity Dataset' in lkeys:
480
+ tmp = self.lmod1.griddata['Gravity Dataset'].dataid
481
+ self.combo_grv.setCurrentIndex(gkeys.index(tmp))
482
+
483
+ if 'Gravity Regional' in lkeys:
484
+ tmp = self.lmod1.griddata['Gravity Regional'].dataid
485
+ self.combo_reggrv.setCurrentIndex(gkeys.index(tmp))
486
+
487
+ if 'Study Area Dataset' in lkeys:
488
+ tmp = self.lmod1.griddata['Study Area Dataset'].dataid
489
+ self.combo_dataset.setCurrentIndex(gkeys.index(tmp))
490
+
491
+ def update_vals(self):
492
+ """ Updates the visible model extent parameters"""
493
+ utlx = self.lmod1.xrange[0]
494
+ utly = self.lmod1.yrange[1]
495
+ utlz = self.lmod1.zrange[1]
496
+ xextent = self.lmod1.xrange[1]-self.lmod1.xrange[0]
497
+ yextent = self.lmod1.yrange[1]-self.lmod1.yrange[0]
498
+ zextent = self.lmod1.zrange[1]-self.lmod1.zrange[0]
499
+
500
+ self.dsb_utlx.setValue(utlx)
501
+ self.dsb_utly.setValue(utly)
502
+ self.dsb_xextent.setValue(xextent)
503
+ self.dsb_yextent.setValue(yextent)
504
+ self.dsb_xycell.setValue(self.lmod1.dxy)
505
+ self.sb_cols.setValue(self.lmod1.numx)
506
+ self.sb_rows.setValue(self.lmod1.numy)
507
+ self.sb_layers.setValue(self.lmod1.numz)
508
+ self.dsb_utlz.setValue(utlz)
509
+ self.dsb_zextent.setValue(zextent)
510
+ self.dsb_zcell.setValue(self.lmod1.d_z)
511
+
512
+ def xycell(self, dxy):
513
+ """ Function to adjust XY dimensions when cell size changes"""
514
+ xextent = self.dsb_xextent.value()
515
+ yextent = self.dsb_yextent.value()
516
+
517
+ if dxy > xextent:
518
+ dxy = xextent
519
+ self.dsb_xycell.setValue(dxy)
520
+
521
+ if dxy > yextent:
522
+ dxy = yextent
523
+ self.dsb_xycell.setValue(dxy)
524
+
525
+ self.upd_layers()
526
+
527
+ def zcell(self, d_z):
528
+ """ Function to adjust Z dimension when cell size changes"""
529
+ zextent = self.dsb_zextent.value()
530
+
531
+ if d_z > zextent:
532
+ d_z = zextent
533
+ self.dsb_zcell.setValue(d_z)
534
+
535
+ self.upd_layers()
536
+
537
+ def tab_activate(self):
538
+ """ Runs when the tab is activated """
539
+ self.update_model_combos()
540
+ self.choose_model()
541
+ self.choose_regional()
542
+ # self.lmod1 = self.parent.lmod1
543
+ self.update_vals()
544
+ self.update_combos()