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.
- pygmi-2.2.7/LICENSE.txt +623 -0
- pygmi-2.2.7/MANIFEST.in +7 -0
- pygmi-2.2.7/PKG-INFO +47 -0
- pygmi-2.2.7/README.md +55 -0
- pygmi-2.2.7/README.rst +20 -0
- pygmi-2.2.7/log.txt +242 -0
- pygmi-2.2.7/pygmi/__init__.py +22 -0
- pygmi-2.2.7/pygmi/clust/__init__.py +4 -0
- pygmi-2.2.7/pygmi/clust/crisp_clust.py +708 -0
- pygmi-2.2.7/pygmi/clust/datatypes.py +65 -0
- pygmi-2.2.7/pygmi/clust/fuzzy_clust.py +906 -0
- pygmi-2.2.7/pygmi/clust/graphs.py +421 -0
- pygmi-2.2.7/pygmi/clust/graphtool.py +667 -0
- pygmi-2.2.7/pygmi/clust/menu.py +139 -0
- pygmi-2.2.7/pygmi/clust/var_ratio.py +92 -0
- pygmi-2.2.7/pygmi/clust/xie_beni.py +93 -0
- pygmi-2.2.7/pygmi/helpdocs/linepointer.png +0 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.main.html +31 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.ddisp.html +15 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.iodefs.exportkmz.html +13 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.iodefs.importpicture.html +16 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.layer.html +17 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.mext.html +44 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.misc.rangedcopy.html +16 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.param.html +37 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.prof.html +32 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.pfmod.pview.html +26 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.gradients.html +14 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.tilt.html +14 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.cooper.visibility.html +14 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datagrid.html +13 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datamerge.html +11 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.datareproj.html +11 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.dataprep.rtp.html +14 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.ginterp.html +31 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.igrf.html +20 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.normalisation.html +14 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.smooth.html +22 -0
- pygmi-2.2.7/pygmi/helpdocs/pygmi.raster.tiltdepth.html +20 -0
- pygmi-2.2.7/pygmi/images/Help.png +0 -0
- pygmi-2.2.7/pygmi/images/bringtofront.png +0 -0
- pygmi-2.2.7/pygmi/images/cgs2.emf +0 -0
- pygmi-2.2.7/pygmi/images/delete.png +0 -0
- pygmi-2.2.7/pygmi/images/linepointer.png +0 -0
- pygmi-2.2.7/pygmi/images/logo256.ico +0 -0
- pygmi-2.2.7/pygmi/images/logo256.png +0 -0
- pygmi-2.2.7/pygmi/images/pointer.png +0 -0
- pygmi-2.2.7/pygmi/images/pygmi.png +0 -0
- pygmi-2.2.7/pygmi/images/sendtoback.png +0 -0
- pygmi-2.2.7/pygmi/main.py +1037 -0
- pygmi-2.2.7/pygmi/menu_default.py +327 -0
- pygmi-2.2.7/pygmi/misc.py +147 -0
- pygmi-2.2.7/pygmi/pfmod/__init__.py +6 -0
- pygmi-2.2.7/pygmi/pfmod/cubes.py +1488 -0
- pygmi-2.2.7/pygmi/pfmod/datatypes.py +292 -0
- pygmi-2.2.7/pygmi/pfmod/grvmag3d.py +1265 -0
- pygmi-2.2.7/pygmi/pfmod/iodefs.py +1001 -0
- pygmi-2.2.7/pygmi/pfmod/menu.py +107 -0
- pygmi-2.2.7/pygmi/pfmod/misc.py +301 -0
- pygmi-2.2.7/pygmi/pfmod/pfmod.py +248 -0
- pygmi-2.2.7/pygmi/pfmod/tab_ddisp.py +425 -0
- pygmi-2.2.7/pygmi/pfmod/tab_layer.py +490 -0
- pygmi-2.2.7/pygmi/pfmod/tab_mext.py +544 -0
- pygmi-2.2.7/pygmi/pfmod/tab_param.py +548 -0
- pygmi-2.2.7/pygmi/pfmod/tab_prof.py +946 -0
- pygmi-2.2.7/pygmi/pfmod/tab_pview.py +740 -0
- pygmi-2.2.7/pygmi/raster/IGRF11.COF +1635 -0
- pygmi-2.2.7/pygmi/raster/__init__.py +14 -0
- pygmi-2.2.7/pygmi/raster/cooper.py +718 -0
- pygmi-2.2.7/pygmi/raster/dataprep.py +1640 -0
- pygmi-2.2.7/pygmi/raster/datatypes.py +123 -0
- pygmi-2.2.7/pygmi/raster/equation_editor.py +256 -0
- pygmi-2.2.7/pygmi/raster/ginterp.py +1901 -0
- pygmi-2.2.7/pygmi/raster/graphs.py +531 -0
- pygmi-2.2.7/pygmi/raster/igrf.py +860 -0
- pygmi-2.2.7/pygmi/raster/iodefs.py +813 -0
- pygmi-2.2.7/pygmi/raster/menu.py +307 -0
- pygmi-2.2.7/pygmi/raster/normalisation.py +187 -0
- pygmi-2.2.7/pygmi/raster/show_table.py +245 -0
- pygmi-2.2.7/pygmi/raster/smooth.py +406 -0
- pygmi-2.2.7/pygmi/raster/tiltdepth.py +590 -0
- pygmi-2.2.7/pygmi/seis/__init__.py +0 -0
- pygmi-2.2.7/pygmi/seis/beachball.py +751 -0
- pygmi-2.2.7/pygmi/seis/datatypes.py +605 -0
- pygmi-2.2.7/pygmi/seis/del_rec.py +410 -0
- pygmi-2.2.7/pygmi/seis/iodefs.py +1261 -0
- pygmi-2.2.7/pygmi/seis/menu.py +136 -0
- pygmi-2.2.7/pygmi/seis/scan_imp.py +795 -0
- pygmi-2.2.7/pygmi/test/__init__.py +6 -0
- pygmi-2.2.7/pygmi/test/pfmod.py +212 -0
- pygmi-2.2.7/pygmi/test/tests.py +39 -0
- pygmi-2.2.7/pygmi/vector/__init__.py +7 -0
- pygmi-2.2.7/pygmi/vector/datatypes.py +74 -0
- pygmi-2.2.7/pygmi/vector/graphs.py +443 -0
- pygmi-2.2.7/pygmi/vector/iodefs.py +345 -0
- pygmi-2.2.7/pygmi/vector/menu.py +127 -0
- pygmi-2.2.7/pygmi.egg-info/PKG-INFO +47 -0
- pygmi-2.2.7/pygmi.egg-info/SOURCES.txt +105 -0
- pygmi-2.2.7/pygmi.egg-info/dependency_links.txt +1 -0
- pygmi-2.2.7/pygmi.egg-info/entry_points.txt +3 -0
- pygmi-2.2.7/pygmi.egg-info/not-zip-safe +1 -0
- pygmi-2.2.7/pygmi.egg-info/requires.txt +7 -0
- pygmi-2.2.7/pygmi.egg-info/top_level.txt +1 -0
- pygmi-2.2.7/quickstart.py +35 -0
- pygmi-2.2.7/setup.cfg +8 -0
- pygmi-2.2.7/setup.py +80 -0
|
@@ -0,0 +1,345 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Name: iodefs.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
|
+
""" Import Data """
|
|
26
|
+
|
|
27
|
+
from PyQt4 import QtGui
|
|
28
|
+
import numpy as np
|
|
29
|
+
from osgeo import ogr
|
|
30
|
+
from .datatypes import PData
|
|
31
|
+
from .datatypes import VData
|
|
32
|
+
import os
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class ImportLEMI417Data(object):
|
|
36
|
+
"""
|
|
37
|
+
Import LEMI-417 ASCII MT Data
|
|
38
|
+
|
|
39
|
+
This is a class used to import LEMI-417 MT Data in ASCII format.
|
|
40
|
+
|
|
41
|
+
Attributes
|
|
42
|
+
----------
|
|
43
|
+
name : str
|
|
44
|
+
item name
|
|
45
|
+
pbar : progressbar
|
|
46
|
+
reference to a progress bar.
|
|
47
|
+
parent : parent
|
|
48
|
+
reference to the parent routine
|
|
49
|
+
outdata : dictionary
|
|
50
|
+
dictionary of output datasets
|
|
51
|
+
ifile : str
|
|
52
|
+
input file name. Used in main.py
|
|
53
|
+
"""
|
|
54
|
+
def __init__(self, parent=None):
|
|
55
|
+
self.name = "Import LEMI-417 Data: "
|
|
56
|
+
self.pbar = None
|
|
57
|
+
self.parent = parent
|
|
58
|
+
self.outdata = {}
|
|
59
|
+
self.ifile = ""
|
|
60
|
+
|
|
61
|
+
def settings(self):
|
|
62
|
+
"""Entry point into item. Data imported from here."""
|
|
63
|
+
ext = "LEMI-417 Text DataAll Files (*.t*)"
|
|
64
|
+
|
|
65
|
+
filename = QtGui.QFileDialog.getOpenFileName(
|
|
66
|
+
self.parent, 'Open File', '.', ext)
|
|
67
|
+
if filename == '':
|
|
68
|
+
return False
|
|
69
|
+
os.chdir(filename.rpartition('/')[0])
|
|
70
|
+
self.ifile = str(filename)
|
|
71
|
+
|
|
72
|
+
datatmp = np.loadtxt(filename, unpack=True)
|
|
73
|
+
|
|
74
|
+
dat = []
|
|
75
|
+
dataid = ['Year', 'Month', 'Day', 'Hour', 'Minute', 'Second',
|
|
76
|
+
'Bx (nT)', 'By (nT)', 'Bz (nT)', 'TE (degrees C)',
|
|
77
|
+
'TF (degrees C)', 'E1 ('+chr(956)+'V/m)',
|
|
78
|
+
'E2 ('+chr(956)+'V/m)', 'E3 ('+chr(956)+'V/m)',
|
|
79
|
+
'E4 ('+chr(956)+'V/m)']
|
|
80
|
+
|
|
81
|
+
for i in range(datatmp.shape[0]):
|
|
82
|
+
dat.append(PData())
|
|
83
|
+
dat[i].zdata = datatmp[i]
|
|
84
|
+
dat[i].dataid = dataid[i]
|
|
85
|
+
|
|
86
|
+
dat = dat[6:]
|
|
87
|
+
dat = dat[0:3]+dat[5:]
|
|
88
|
+
|
|
89
|
+
self.outdata['Point'] = dat
|
|
90
|
+
return True
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class ImportPointData(object):
|
|
94
|
+
"""
|
|
95
|
+
Import Point Data
|
|
96
|
+
|
|
97
|
+
This class imports ASCII point data.
|
|
98
|
+
|
|
99
|
+
Attributes
|
|
100
|
+
----------
|
|
101
|
+
name : str
|
|
102
|
+
item name
|
|
103
|
+
pbar : progressbar
|
|
104
|
+
reference to a progress bar.
|
|
105
|
+
parent : parent
|
|
106
|
+
reference to the parent routine
|
|
107
|
+
outdata : dictionary
|
|
108
|
+
dictionary of output datasets
|
|
109
|
+
ifile : str
|
|
110
|
+
input file name. Used in main.py
|
|
111
|
+
"""
|
|
112
|
+
def __init__(self, parent=None):
|
|
113
|
+
self.name = "Import Point/Line Data: "
|
|
114
|
+
self.pbar = None
|
|
115
|
+
self.parent = parent
|
|
116
|
+
self.indata = {}
|
|
117
|
+
self.outdata = {}
|
|
118
|
+
self.ifile = ""
|
|
119
|
+
|
|
120
|
+
def settings(self):
|
|
121
|
+
"""Entry point into item. Data imported from here."""
|
|
122
|
+
ext = ("Common Formats (*.csv *.dat *.xyz *.txt);;"
|
|
123
|
+
"All Files (*.*)")
|
|
124
|
+
|
|
125
|
+
filename = QtGui.QFileDialog.getOpenFileName(
|
|
126
|
+
self.parent, 'Open File', '.', ext)
|
|
127
|
+
if filename == '':
|
|
128
|
+
return False
|
|
129
|
+
os.chdir(filename.rpartition('/')[0])
|
|
130
|
+
self.ifile = str(filename)
|
|
131
|
+
|
|
132
|
+
tmp = QtGui.QMessageBox.question(self.parent, 'Data Query',
|
|
133
|
+
'Are the first two columns X and Y?',
|
|
134
|
+
QtGui.QMessageBox.Yes |
|
|
135
|
+
QtGui.QMessageBox.No)
|
|
136
|
+
|
|
137
|
+
dlim = None
|
|
138
|
+
if filename[-3:] == 'csv':
|
|
139
|
+
dlim = ','
|
|
140
|
+
|
|
141
|
+
pntfile = open(filename)
|
|
142
|
+
ltmp = pntfile.readline()
|
|
143
|
+
pntfile.close()
|
|
144
|
+
|
|
145
|
+
isheader = any(c.isalpha() for c in ltmp)
|
|
146
|
+
|
|
147
|
+
srows = 0
|
|
148
|
+
ltmp = ltmp.split(dlim)
|
|
149
|
+
if isheader:
|
|
150
|
+
srows = 1
|
|
151
|
+
else:
|
|
152
|
+
ltmp = [str(c) for c in range(len(ltmp))]
|
|
153
|
+
|
|
154
|
+
datatmp = np.genfromtxt(filename, unpack=True, delimiter=dlim,
|
|
155
|
+
skiprows=srows, usemask=True)
|
|
156
|
+
|
|
157
|
+
# datatmp.mask = np.logical_or(datatmp.mask, np.isnan(datatmp.data))
|
|
158
|
+
# pdb.set_trace()
|
|
159
|
+
# try:
|
|
160
|
+
# datatmp = np.loadtxt(filename, unpack=True, delimiter=dlim,
|
|
161
|
+
# skiprows=srows)
|
|
162
|
+
# except ValueError:
|
|
163
|
+
# QtGui.QMessageBox.critical(self.parent, 'Import Error',
|
|
164
|
+
# 'There was a problem loading the file.'
|
|
165
|
+
# ' You may have a text character in one'
|
|
166
|
+
# ' of your columns.')
|
|
167
|
+
# return False
|
|
168
|
+
|
|
169
|
+
dat = []
|
|
170
|
+
if tmp == QtGui.QMessageBox.Yes:
|
|
171
|
+
for i in range(2, datatmp.shape[0]):
|
|
172
|
+
dat.append(PData())
|
|
173
|
+
dat[-1].xdata = datatmp[0]
|
|
174
|
+
dat[-1].ydata = datatmp[1]
|
|
175
|
+
dat[-1].zdata = datatmp[i]
|
|
176
|
+
dat[-1].dataid = ltmp[i]
|
|
177
|
+
else:
|
|
178
|
+
for i in range(datatmp.shape[0]):
|
|
179
|
+
dat.append(PData())
|
|
180
|
+
dat[i].zdata = datatmp[i]
|
|
181
|
+
dat[i].dataid = ltmp[i]
|
|
182
|
+
|
|
183
|
+
self.outdata['Point'] = dat
|
|
184
|
+
return True
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
class ExportPoint(object):
|
|
188
|
+
"""
|
|
189
|
+
Export Point Data
|
|
190
|
+
|
|
191
|
+
Attributes
|
|
192
|
+
----------
|
|
193
|
+
name : str
|
|
194
|
+
item name
|
|
195
|
+
pbar : progressbar
|
|
196
|
+
reference to a progress bar.
|
|
197
|
+
parent : parent
|
|
198
|
+
reference to the parent routine
|
|
199
|
+
indata : dictionary
|
|
200
|
+
dictionary of input datasets
|
|
201
|
+
showtext : text output
|
|
202
|
+
reference to the show process log text output on the main interface
|
|
203
|
+
"""
|
|
204
|
+
|
|
205
|
+
def __init__(self, parent):
|
|
206
|
+
self.name = "Export Point: "
|
|
207
|
+
self.pbar = None
|
|
208
|
+
self.parent = parent
|
|
209
|
+
self.indata = {}
|
|
210
|
+
self.showtext = self.parent.showprocesslog
|
|
211
|
+
|
|
212
|
+
def run(self):
|
|
213
|
+
""" Runs routine """
|
|
214
|
+
if 'Point' not in self.indata:
|
|
215
|
+
self.showtext('Error: You need to have a point data first!')
|
|
216
|
+
return
|
|
217
|
+
|
|
218
|
+
filename = QtGui.QFileDialog.getSaveFileName(
|
|
219
|
+
self.parent, 'Save File', '.', 'csv (*.csv)')
|
|
220
|
+
|
|
221
|
+
if filename == '':
|
|
222
|
+
return
|
|
223
|
+
|
|
224
|
+
os.chdir(filename.rpartition('/')[0])
|
|
225
|
+
ofile = str(filename.rpartition('/')[-1][:-4])
|
|
226
|
+
# self.ext = filename[-3:]
|
|
227
|
+
data = self.indata['Point']
|
|
228
|
+
|
|
229
|
+
for i in range(len(data)):
|
|
230
|
+
datid = data[i].dataid
|
|
231
|
+
if datid is '':
|
|
232
|
+
datid = str(i)
|
|
233
|
+
|
|
234
|
+
dattmp = np.transpose([data[i].xdata, data[i].ydata,
|
|
235
|
+
data[i].zdata])
|
|
236
|
+
|
|
237
|
+
ofile2 = ofile+'_'+''.join(x for x in datid if x.isalnum())+'.csv'
|
|
238
|
+
|
|
239
|
+
np.savetxt(ofile2, dattmp, delimiter=',')
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
class ImportShapeData(object):
|
|
243
|
+
"""
|
|
244
|
+
Import Shapefile Data
|
|
245
|
+
|
|
246
|
+
Attributes
|
|
247
|
+
----------
|
|
248
|
+
name : str
|
|
249
|
+
item name
|
|
250
|
+
pbar : progressbar
|
|
251
|
+
reference to a progress bar.
|
|
252
|
+
parent : parent
|
|
253
|
+
reference to the parent routine
|
|
254
|
+
outdata : dictionary
|
|
255
|
+
dictionary of output datasets
|
|
256
|
+
ifile : str
|
|
257
|
+
input file name. Used in main.py
|
|
258
|
+
"""
|
|
259
|
+
def __init__(self, parent=None):
|
|
260
|
+
self.name = "Import Shapefile Data: "
|
|
261
|
+
self.pbar = None
|
|
262
|
+
self.parent = parent
|
|
263
|
+
self.outdata = {}
|
|
264
|
+
self.ifile = ""
|
|
265
|
+
|
|
266
|
+
def settings(self):
|
|
267
|
+
"""Entry point into item. Data imported from here."""
|
|
268
|
+
ext = \
|
|
269
|
+
"Shapefile (*.shp);;" +\
|
|
270
|
+
"All Files (*.*)"
|
|
271
|
+
|
|
272
|
+
filename = QtGui.QFileDialog.getOpenFileName(
|
|
273
|
+
self.parent, 'Open File', '.', ext)
|
|
274
|
+
if filename == '':
|
|
275
|
+
return False
|
|
276
|
+
os.chdir(filename.rpartition('/')[0])
|
|
277
|
+
self.ifile = str(filename)
|
|
278
|
+
|
|
279
|
+
ifile = str(filename)
|
|
280
|
+
|
|
281
|
+
# Line data
|
|
282
|
+
shapef = ogr.Open(ifile)
|
|
283
|
+
if shapef is None:
|
|
284
|
+
err = ('There was a problem importing the shapefile. Please make '
|
|
285
|
+
'sure you have at all the individual files which make up '
|
|
286
|
+
'the shapefile.')
|
|
287
|
+
QtGui.QMessageBox.warning(self.parent, 'Error', err,
|
|
288
|
+
QtGui.QMessageBox.Ok,
|
|
289
|
+
QtGui.QMessageBox.Ok)
|
|
290
|
+
return False
|
|
291
|
+
|
|
292
|
+
lyr = shapef.GetLayer()
|
|
293
|
+
dat = VData()
|
|
294
|
+
attrib = {}
|
|
295
|
+
allcrds = []
|
|
296
|
+
|
|
297
|
+
for i in range(lyr.GetFeatureCount()):
|
|
298
|
+
feat = lyr.GetFeature(i)
|
|
299
|
+
ftmp = feat.items()
|
|
300
|
+
for j in ftmp.keys():
|
|
301
|
+
if attrib.get(j) is None:
|
|
302
|
+
attrib[j] = [ftmp[j]]
|
|
303
|
+
else:
|
|
304
|
+
attrib[j] = attrib[j]+[ftmp[j]]
|
|
305
|
+
|
|
306
|
+
if lyr.GetGeomType() is ogr.wkbPoint:
|
|
307
|
+
for i in range(lyr.GetFeatureCount()):
|
|
308
|
+
feat = lyr.GetFeature(i)
|
|
309
|
+
geom = feat.GetGeometryRef()
|
|
310
|
+
pnts = np.array(geom.GetPoints()).tolist()
|
|
311
|
+
if pnts[0][0] > -1.e+308:
|
|
312
|
+
allcrds.append(pnts)
|
|
313
|
+
dat.dtype = 'Point'
|
|
314
|
+
|
|
315
|
+
if lyr.GetGeomType() is ogr.wkbPolygon:
|
|
316
|
+
for i in range(lyr.GetFeatureCount()):
|
|
317
|
+
feat = lyr.GetFeature(i)
|
|
318
|
+
geom = feat.GetGeometryRef()
|
|
319
|
+
ifin = 0
|
|
320
|
+
if geom.GetGeometryName() == 'MULTIPOLYGON':
|
|
321
|
+
imax = 0
|
|
322
|
+
for i in range(geom.GetGeometryCount()):
|
|
323
|
+
geom.GetGeometryRef(i)
|
|
324
|
+
itmp = geom.GetGeometryRef(i)
|
|
325
|
+
itmp = itmp.GetGeometryRef(0).GetPointCount()
|
|
326
|
+
if itmp > imax:
|
|
327
|
+
imax = itmp
|
|
328
|
+
ifin = i
|
|
329
|
+
geom = geom.GetGeometryRef(ifin)
|
|
330
|
+
pnts = np.array(geom.GetPoints()).tolist()
|
|
331
|
+
allcrds.append(pnts)
|
|
332
|
+
dat.dtype = 'Poly'
|
|
333
|
+
|
|
334
|
+
if lyr.GetGeomType() is ogr.wkbLineString:
|
|
335
|
+
for i in range(lyr.GetFeatureCount()):
|
|
336
|
+
feat = lyr.GetFeature(i)
|
|
337
|
+
geom = feat.GetGeometryRef()
|
|
338
|
+
pnts = np.array(geom.GetPoints()).tolist()
|
|
339
|
+
allcrds.append(pnts)
|
|
340
|
+
dat.dtype = 'Line'
|
|
341
|
+
|
|
342
|
+
dat.crds = allcrds
|
|
343
|
+
dat.attrib = attrib
|
|
344
|
+
self.outdata['Vector'] = dat
|
|
345
|
+
return True
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Name: menu.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
|
+
""" Vector Menu Routines """
|
|
26
|
+
|
|
27
|
+
from PyQt4 import QtGui
|
|
28
|
+
from . import iodefs
|
|
29
|
+
from . import graphs
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
class MenuWidget(object):
|
|
33
|
+
"""
|
|
34
|
+
Widget class to call the main interface
|
|
35
|
+
|
|
36
|
+
This widget class creates the vector menus to be found on the main
|
|
37
|
+
interface. Normal as well as context menus are defined here.
|
|
38
|
+
|
|
39
|
+
Attributes
|
|
40
|
+
----------
|
|
41
|
+
parent : MainWidget
|
|
42
|
+
Reference to MainWidget class found in main.py
|
|
43
|
+
"""
|
|
44
|
+
def __init__(self, parent):
|
|
45
|
+
|
|
46
|
+
self.parent = parent
|
|
47
|
+
self.parent.add_to_context('Point')
|
|
48
|
+
self.parent.add_to_context('Vector')
|
|
49
|
+
context_menu = self.parent.context_menu
|
|
50
|
+
|
|
51
|
+
self.menufile = QtGui.QMenu(parent.menubar)
|
|
52
|
+
self.menufile.setTitle("Vector")
|
|
53
|
+
parent.menubar.addAction(self.menufile.menuAction())
|
|
54
|
+
|
|
55
|
+
self.action_import_shape_data = QtGui.QAction(parent)
|
|
56
|
+
self.action_import_shape_data.setText("Import Shapefile Data")
|
|
57
|
+
self.menufile.addAction(self.action_import_shape_data)
|
|
58
|
+
self.action_import_shape_data.triggered.connect(self.import_shape_data)
|
|
59
|
+
|
|
60
|
+
self.action_import_point_data = QtGui.QAction(parent)
|
|
61
|
+
self.action_import_point_data.setText("Import Point/Line Data")
|
|
62
|
+
self.menufile.addAction(self.action_import_point_data)
|
|
63
|
+
self.action_import_point_data.triggered.connect(self.import_point_data)
|
|
64
|
+
|
|
65
|
+
self.action_import_lemi417_data = QtGui.QAction(parent)
|
|
66
|
+
self.action_import_lemi417_data.setText("Import LEMI-417 Data")
|
|
67
|
+
self.menufile.addAction(self.action_import_lemi417_data)
|
|
68
|
+
self.action_import_lemi417_data.triggered.connect(
|
|
69
|
+
self.import_lemi417_data)
|
|
70
|
+
|
|
71
|
+
self.menufile.addSeparator()
|
|
72
|
+
|
|
73
|
+
# Context menus
|
|
74
|
+
context_menu['Point'].addSeparator()
|
|
75
|
+
|
|
76
|
+
self.action_export_point = QtGui.QAction(self.parent)
|
|
77
|
+
self.action_export_point.setText("Export Point Data")
|
|
78
|
+
context_menu['Point'].addAction(self.action_export_point)
|
|
79
|
+
self.action_export_point.triggered.connect(self.export_point)
|
|
80
|
+
|
|
81
|
+
self.action_show_point_data = QtGui.QAction(self.parent)
|
|
82
|
+
self.action_show_point_data.setText("Show Point Data")
|
|
83
|
+
context_menu['Point'].addAction(self.action_show_point_data)
|
|
84
|
+
self.action_show_point_data.triggered.connect(self.show_point_data)
|
|
85
|
+
|
|
86
|
+
context_menu['Vector'].addSeparator()
|
|
87
|
+
|
|
88
|
+
self.action_show_vector_data = QtGui.QAction(self.parent)
|
|
89
|
+
self.action_show_vector_data.setText("Show Vector Data")
|
|
90
|
+
context_menu['Vector'].addAction(self.action_show_vector_data)
|
|
91
|
+
self.action_show_vector_data.triggered.connect(self.show_vector_data)
|
|
92
|
+
|
|
93
|
+
self.action_show_rose_diagram = QtGui.QAction(self.parent)
|
|
94
|
+
self.action_show_rose_diagram.setText("Show Rose Diagram")
|
|
95
|
+
context_menu['Vector'].addAction(self.action_show_rose_diagram)
|
|
96
|
+
self.action_show_rose_diagram.triggered.connect(self.show_rose_diagram)
|
|
97
|
+
|
|
98
|
+
def export_point(self):
|
|
99
|
+
""" Export point data """
|
|
100
|
+
self.parent.launch_context_item(iodefs.ExportPoint)
|
|
101
|
+
|
|
102
|
+
def import_point_data(self):
|
|
103
|
+
""" Import point data"""
|
|
104
|
+
fnc = iodefs.ImportPointData(self.parent)
|
|
105
|
+
self.parent.item_insert("Io", "Import Point/Line Data", fnc)
|
|
106
|
+
|
|
107
|
+
def import_shape_data(self):
|
|
108
|
+
""" Import shape data"""
|
|
109
|
+
fnc = iodefs.ImportShapeData(self.parent)
|
|
110
|
+
self.parent.item_insert("Io", "Import Shapefile Data", fnc)
|
|
111
|
+
|
|
112
|
+
def import_lemi417_data(self):
|
|
113
|
+
""" Imports LEMI-417 MT data"""
|
|
114
|
+
fnc = iodefs.ImportLEMI417Data(self.parent)
|
|
115
|
+
self.parent.item_insert("Io", "Import LEMI-417 Data", fnc)
|
|
116
|
+
|
|
117
|
+
def show_point_data(self):
|
|
118
|
+
""" Show point data """
|
|
119
|
+
self.parent.launch_context_item(graphs.PlotPoints)
|
|
120
|
+
|
|
121
|
+
def show_vector_data(self):
|
|
122
|
+
""" Show vector data """
|
|
123
|
+
self.parent.launch_context_item(graphs.PlotVector)
|
|
124
|
+
|
|
125
|
+
def show_rose_diagram(self):
|
|
126
|
+
""" Show rose diagram """
|
|
127
|
+
self.parent.launch_context_item(graphs.PlotRose)
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Metadata-Version: 1.1
|
|
2
|
+
Name: pygmi
|
|
3
|
+
Version: 2.2.7
|
|
4
|
+
Summary: Python Geophysical Modelling and Interpretation
|
|
5
|
+
Home-page: https://github.com/Patrick-Cole/pygmi
|
|
6
|
+
Author: Patrick Cole
|
|
7
|
+
Author-email: pcole@geoscience.org.za
|
|
8
|
+
License: GNU General Public License v3 (GPLv3)
|
|
9
|
+
Download-URL: https://github.com/Patrick-Cole/pygmi/archive/pygmi-2.2.7.tar.gz
|
|
10
|
+
Description: Overview
|
|
11
|
+
========
|
|
12
|
+
|
|
13
|
+
PyGMI stands for Python Geophysical Modelling and Interpretation. It is a modelling and interpretation suite aimed at magnetic, gravity and other datasets.
|
|
14
|
+
|
|
15
|
+
PyGMI is developed at the `Council for Geoscience <http://www.geoscience.org.za>`_ (Geological Survey of South Africa).
|
|
16
|
+
|
|
17
|
+
It includes:
|
|
18
|
+
|
|
19
|
+
* Magnetic and Gravity 3D forward modelling
|
|
20
|
+
* Cluster Analysis
|
|
21
|
+
* Routines for cutting, reprojecting and doing simple modifications to data
|
|
22
|
+
* Convenient display of data using pseudo-color, ternary and sunshaded representation.
|
|
23
|
+
* It is released under the `Gnu General Public License version 3.0 <http://www.gnu.org/copyleft/gpl.html>`_
|
|
24
|
+
|
|
25
|
+
View the PyGMI project on `GitHub <https://github.com/Patrick-Cole/pygmi>`_!
|
|
26
|
+
|
|
27
|
+
The latest release version can be found `here <https://github.com/Patrick-Cole/pygmi/releases>`_.
|
|
28
|
+
|
|
29
|
+
If you have any comments or queries, you can contact the author either through `GitHub <https://github.com/Patrick-Cole/pygmi>`_ or via email at pcole@geoscience.org.za
|
|
30
|
+
Keywords: Geophysics Magnetic Gravity Modelling Interpretation
|
|
31
|
+
Platform: UNKNOWN
|
|
32
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
33
|
+
Classifier: Environment :: Win32 (MS Windows)
|
|
34
|
+
Classifier: Environment :: X11 Applications :: Qt
|
|
35
|
+
Classifier: Intended Audience :: Education
|
|
36
|
+
Classifier: Intended Audience :: End Users/Desktop
|
|
37
|
+
Classifier: Intended Audience :: Science/Research
|
|
38
|
+
Classifier: License :: OSI Approved :: GNU General Public License v3 (GPLv3)
|
|
39
|
+
Classifier: Natural Language :: English
|
|
40
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
41
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
42
|
+
Classifier: Programming Language :: Python :: 2
|
|
43
|
+
Classifier: Programming Language :: Python :: 3
|
|
44
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
45
|
+
Classifier: Topic :: Scientific/Engineering :: Physics
|
|
46
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
47
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
LICENSE.txt
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
README.rst
|
|
5
|
+
log.txt
|
|
6
|
+
quickstart.py
|
|
7
|
+
setup.cfg
|
|
8
|
+
setup.py
|
|
9
|
+
pygmi/__init__.py
|
|
10
|
+
pygmi/main.py
|
|
11
|
+
pygmi/menu_default.py
|
|
12
|
+
pygmi/misc.py
|
|
13
|
+
pygmi.egg-info/PKG-INFO
|
|
14
|
+
pygmi.egg-info/SOURCES.txt
|
|
15
|
+
pygmi.egg-info/dependency_links.txt
|
|
16
|
+
pygmi.egg-info/entry_points.txt
|
|
17
|
+
pygmi.egg-info/not-zip-safe
|
|
18
|
+
pygmi.egg-info/requires.txt
|
|
19
|
+
pygmi.egg-info/top_level.txt
|
|
20
|
+
pygmi/clust/__init__.py
|
|
21
|
+
pygmi/clust/crisp_clust.py
|
|
22
|
+
pygmi/clust/datatypes.py
|
|
23
|
+
pygmi/clust/fuzzy_clust.py
|
|
24
|
+
pygmi/clust/graphs.py
|
|
25
|
+
pygmi/clust/graphtool.py
|
|
26
|
+
pygmi/clust/menu.py
|
|
27
|
+
pygmi/clust/var_ratio.py
|
|
28
|
+
pygmi/clust/xie_beni.py
|
|
29
|
+
pygmi/helpdocs/linepointer.png
|
|
30
|
+
pygmi/helpdocs/pygmi.main.html
|
|
31
|
+
pygmi/helpdocs/pygmi.pfmod.ddisp.html
|
|
32
|
+
pygmi/helpdocs/pygmi.pfmod.iodefs.exportkmz.html
|
|
33
|
+
pygmi/helpdocs/pygmi.pfmod.iodefs.importpicture.html
|
|
34
|
+
pygmi/helpdocs/pygmi.pfmod.layer.html
|
|
35
|
+
pygmi/helpdocs/pygmi.pfmod.mext.html
|
|
36
|
+
pygmi/helpdocs/pygmi.pfmod.misc.rangedcopy.html
|
|
37
|
+
pygmi/helpdocs/pygmi.pfmod.param.html
|
|
38
|
+
pygmi/helpdocs/pygmi.pfmod.prof.html
|
|
39
|
+
pygmi/helpdocs/pygmi.pfmod.pview.html
|
|
40
|
+
pygmi/helpdocs/pygmi.raster.cooper.gradients.html
|
|
41
|
+
pygmi/helpdocs/pygmi.raster.cooper.tilt.html
|
|
42
|
+
pygmi/helpdocs/pygmi.raster.cooper.visibility.html
|
|
43
|
+
pygmi/helpdocs/pygmi.raster.dataprep.datagrid.html
|
|
44
|
+
pygmi/helpdocs/pygmi.raster.dataprep.datamerge.html
|
|
45
|
+
pygmi/helpdocs/pygmi.raster.dataprep.datareproj.html
|
|
46
|
+
pygmi/helpdocs/pygmi.raster.dataprep.rtp.html
|
|
47
|
+
pygmi/helpdocs/pygmi.raster.ginterp.html
|
|
48
|
+
pygmi/helpdocs/pygmi.raster.igrf.html
|
|
49
|
+
pygmi/helpdocs/pygmi.raster.normalisation.html
|
|
50
|
+
pygmi/helpdocs/pygmi.raster.smooth.html
|
|
51
|
+
pygmi/helpdocs/pygmi.raster.tiltdepth.html
|
|
52
|
+
pygmi/images/Help.png
|
|
53
|
+
pygmi/images/bringtofront.png
|
|
54
|
+
pygmi/images/cgs2.emf
|
|
55
|
+
pygmi/images/delete.png
|
|
56
|
+
pygmi/images/linepointer.png
|
|
57
|
+
pygmi/images/logo256.ico
|
|
58
|
+
pygmi/images/logo256.png
|
|
59
|
+
pygmi/images/pointer.png
|
|
60
|
+
pygmi/images/pygmi.png
|
|
61
|
+
pygmi/images/sendtoback.png
|
|
62
|
+
pygmi/pfmod/__init__.py
|
|
63
|
+
pygmi/pfmod/cubes.py
|
|
64
|
+
pygmi/pfmod/datatypes.py
|
|
65
|
+
pygmi/pfmod/grvmag3d.py
|
|
66
|
+
pygmi/pfmod/iodefs.py
|
|
67
|
+
pygmi/pfmod/menu.py
|
|
68
|
+
pygmi/pfmod/misc.py
|
|
69
|
+
pygmi/pfmod/pfmod.py
|
|
70
|
+
pygmi/pfmod/tab_ddisp.py
|
|
71
|
+
pygmi/pfmod/tab_layer.py
|
|
72
|
+
pygmi/pfmod/tab_mext.py
|
|
73
|
+
pygmi/pfmod/tab_param.py
|
|
74
|
+
pygmi/pfmod/tab_prof.py
|
|
75
|
+
pygmi/pfmod/tab_pview.py
|
|
76
|
+
pygmi/raster/IGRF11.COF
|
|
77
|
+
pygmi/raster/__init__.py
|
|
78
|
+
pygmi/raster/cooper.py
|
|
79
|
+
pygmi/raster/dataprep.py
|
|
80
|
+
pygmi/raster/datatypes.py
|
|
81
|
+
pygmi/raster/equation_editor.py
|
|
82
|
+
pygmi/raster/ginterp.py
|
|
83
|
+
pygmi/raster/graphs.py
|
|
84
|
+
pygmi/raster/igrf.py
|
|
85
|
+
pygmi/raster/iodefs.py
|
|
86
|
+
pygmi/raster/menu.py
|
|
87
|
+
pygmi/raster/normalisation.py
|
|
88
|
+
pygmi/raster/show_table.py
|
|
89
|
+
pygmi/raster/smooth.py
|
|
90
|
+
pygmi/raster/tiltdepth.py
|
|
91
|
+
pygmi/seis/__init__.py
|
|
92
|
+
pygmi/seis/beachball.py
|
|
93
|
+
pygmi/seis/datatypes.py
|
|
94
|
+
pygmi/seis/del_rec.py
|
|
95
|
+
pygmi/seis/iodefs.py
|
|
96
|
+
pygmi/seis/menu.py
|
|
97
|
+
pygmi/seis/scan_imp.py
|
|
98
|
+
pygmi/test/__init__.py
|
|
99
|
+
pygmi/test/pfmod.py
|
|
100
|
+
pygmi/test/tests.py
|
|
101
|
+
pygmi/vector/__init__.py
|
|
102
|
+
pygmi/vector/datatypes.py
|
|
103
|
+
pygmi/vector/graphs.py
|
|
104
|
+
pygmi/vector/iodefs.py
|
|
105
|
+
pygmi/vector/menu.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
pygmi
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# -----------------------------------------------------------------------------
|
|
2
|
+
# Name: quickstart.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
|
+
""" This is a quick start routine to start the GUI form of PyGMI
|
|
26
|
+
|
|
27
|
+
This routine is used as a convenience function, typically if you do NOT
|
|
28
|
+
formally install PyGMI as a library and prefer to run it from within the
|
|
29
|
+
default extracted directory structure.
|
|
30
|
+
"""
|
|
31
|
+
|
|
32
|
+
import pygmi
|
|
33
|
+
|
|
34
|
+
if __name__ == "__main__":
|
|
35
|
+
pygmi.main()
|