def main(input_shp_files, validate=False, *, output=None): """ Convert multiple ESRI Shapefile(s) into a single NRML source model file. """ input_parser = shapefileparser.ShapefileParser() source_model = input_parser.read(input_shp_files[0], validate) for f in input_shp_files[1:]: source_model.sources.extend(input_parser.read(f, validate).sources) if not output: output = os.path.splitext(input_shp_files[0])[0] shapefileparser.SourceModelParser().write(output + '.xml', source_model)
def main(input_nrml_file, validate=False, *, output=None): """ Convert a NRML source model file to ESRI Shapefile(s). For each type of source geometry defined in the NRML file (point, area, simple fault, complex fault, planar) a separate shapefile is created. Each shapefile is differentiated by a specific ending('_point', '_area', '_simple', '_complex', '_planar'). NB: nonparametric sources are not supported. """ input_parser = shapefileparser.SourceModelParser() source_model = input_parser.read(input_nrml_file, validate) if not output: output = os.path.splitext(input_nrml_file)[0] print('Extracting %s_ files' % output) shapefileparser.ShapefileParser().write(output, source_model)