Пример #1
0
 def read(self, nrml_file, validate=False,
          simple_fault_spacing=1.0, complex_mesh_spacing=5.0,
          mfd_spacing=0.1):
     """
     Build the source model from nrml format
     """
     self.source_file = nrml_file
     if validate:
         converter = SourceConverter(1.0, simple_fault_spacing,
                                     complex_mesh_spacing,
                                     mfd_spacing,
                                     10.0)
         converter.fname = nrml_file
     root = nrml.read(nrml_file)
     if root['xmlns'] == 'http://openquake.org/xmlns/nrml/0.4':
         sg_nodes = [root.sourceModel.nodes]
     else:  # NRML 0.5
         sg_nodes = root.sourceModel.nodes
     sources = []
     for sg_node in sg_nodes:
         for no, src_node in enumerate(sg_node, 1):
             if validate:
                 print("Validating Source %s" % src_node.attrib["id"])
                 converter.convert_node(src_node)
             sources.append(src_node)
     return SourceModel(sources)
Пример #2
0
 def read(self,
          nrml_file,
          validate=False,
          simple_fault_spacing=1.0,
          complex_mesh_spacing=5.0,
          mfd_spacing=0.1):
     """
     Build the source model from nrml format
     """
     self.source_file = nrml_file
     if validate:
         converter = SourceConverter(1.0, simple_fault_spacing,
                                     complex_mesh_spacing, mfd_spacing,
                                     10.0)
         converter.fname = nrml_file
     src_nodes = nrml.read(nrml_file).sourceModel
     sources = []
     for no, src_node in enumerate(src_nodes, 1):
         if validate:
             print("Validating Source %s" % src_node.attrib["id"])
             converter.convert_node(src_node)
         sources.append(src_node)
     return SourceModel(sources)