def simpleGeom(utype, node, filename): if hasattr(node, 'simpleFaultGeometry'): node = node.simpleFaultGeometry _validate_simple_fault_geometry(utype, node, filename) spacing = node["spacing"] usd, lsd, dip = (~node.upperSeismoDepth, ~node.lowerSeismoDepth, ~node.dip) coords = split_coords_2d(~node.LineString.posList) trace = geo.Line([geo.Point(*p) for p in coords]) return trace, usd, lsd, dip, spacing
def _validate_simple_fault_geometry(utype, node, filename): try: coords = split_coords_2d(~node.LineString.posList) trace = geo.Line([geo.Point(*p) for p in coords]) except ValueError: # If the geometry cannot be created then use the LogicTreeError # to point the user to the incorrect node. Hence, if trace is # compiled successfully then len(trace) is True, otherwise it is # False trace = [] if len(trace): return raise LogicTreeError(node, filename, "'simpleFaultGeometry' node is not valid")