|
9 | 9 | from qgis.core import QgsMapLayerRegistry
|
10 | 10 | from geosurf.qgs_tools import loaded_point_layers, get_point_data
|
11 | 11 |
|
| 12 | +from processing import plot_stereonet |
| 13 | + |
12 | 14 |
|
13 | 15 | class geocouche_QWidget( QWidget ):
|
14 | 16 |
|
@@ -225,35 +227,44 @@ def process_geodata(self):
|
225 | 227 | _, structural_data = get_point_data(self.point_layer, self.actual_field_names, selected)
|
226 | 228 |
|
227 | 229 | input_data_types = self.get_actual_data_type()
|
228 |
| - |
229 |
| - xy_vals, plane_orientations, lineament_orientations = self.parse_geodata(input_data_types, structural_data) |
230 |
| - |
231 |
| - for rec in lineament_orientations: |
232 |
| - print rec |
| 230 | + |
| 231 | + try: |
| 232 | + _, plane_orientations, lineament_orientations = self.parse_geodata(input_data_types, structural_data) |
| 233 | + except Exception, msg: |
| 234 | + self.warn(str(msg)) |
| 235 | + return |
| 236 | + |
| 237 | + plot_stereonet(plane_orientations, lineament_orientations) |
233 | 238 |
|
234 | 239 |
|
235 | 240 | def parse_geodata(self, input_data_types, structural_data):
|
236 | 241 |
|
237 | 242 | xy_vals = [ (float(rec[0]), float(rec[1]) ) for rec in structural_data]
|
238 | 243 |
|
239 |
| - if input_data_types["planar_data"]: |
240 |
| - if input_data_types["planar_az_type"] == "dip_dir": |
241 |
| - dipdir_vals = [ float(rec[2]) for rec in structural_data] |
242 |
| - elif input_data_types["planar_az_type"] == "strike_rhr": |
243 |
| - dipdir_raw_vals = [ float(rec[2]) + 90.0 for rec in structural_data] |
244 |
| - dipdir_vals = [ val if val < 360.0 else val - 360.0 for val in dipdir_raw_vals ] |
245 |
| - dipangle_vals = [ float(rec[3]) for rec in structural_data] |
246 |
| - plane_vals = zip(dipdir_vals, dipangle_vals) |
247 |
| - line_data_ndx_start = 4 |
248 |
| - else: |
249 |
| - plane_vals = None |
250 |
| - line_data_ndx_start = 2 |
251 |
| - |
252 |
| - if input_data_types["linear_data"]: |
253 |
| - line_vals = [ (float(rec[line_data_ndx_start]), float(rec[line_data_ndx_start + 1])) for rec in structural_data] |
254 |
| - else: |
255 |
| - line_vals = None |
256 |
| - |
| 244 | + try: |
| 245 | + if input_data_types["planar_data"]: |
| 246 | + if input_data_types["planar_az_type"] == "dip_dir": |
| 247 | + dipdir_vals = [ float(rec[2]) for rec in structural_data] |
| 248 | + elif input_data_types["planar_az_type"] == "strike_rhr": |
| 249 | + dipdir_raw_vals = [ float(rec[2]) + 90.0 for rec in structural_data] |
| 250 | + dipdir_vals = [ val if val < 360.0 else val - 360.0 for val in dipdir_raw_vals ] |
| 251 | + dipangle_vals = [ float(rec[3]) for rec in structural_data] |
| 252 | + plane_vals = zip(dipdir_vals, dipangle_vals) |
| 253 | + line_data_ndx_start = 4 |
| 254 | + else: |
| 255 | + plane_vals = None |
| 256 | + line_data_ndx_start = 2 |
| 257 | + except: |
| 258 | + raise Exception, "Error in planar data" |
| 259 | + |
| 260 | + try: |
| 261 | + if input_data_types["linear_data"]: |
| 262 | + line_vals = [ (float(rec[line_data_ndx_start]), float(rec[line_data_ndx_start + 1])) for rec in structural_data] |
| 263 | + else: |
| 264 | + line_vals = None |
| 265 | + except: |
| 266 | + raise Exception, "Error in linear data" |
| 267 | + |
257 | 268 | return xy_vals, plane_vals, line_vals
|
258 | 269 |
|
259 | 270 |
|
|
0 commit comments