示例#1
0
def main():
    """
    Main
    """
    global time_series

    # get arguments from command line
    args_parser = get_args_parser()
    args = args_parser.parse_args()

    # apply arguments
    splashFilename = args.splashfile
    time_series = args.time

    # create the list of requested splash files
    splash_files = list()
    if time_series:
        splashFilename = splash2xdmf.get_common_filename(splashFilename)
        for s_filename in glob.glob("{}_*.h5".format(splashFilename)):
            splash_files.append(s_filename)
    else:
        splash_files.append(splashFilename)
        tmp = splashFilename.rfind(".h5")
        splashFilename = splashFilename[:tmp]

    output_filename = "{}.xmf".format(splashFilename)

    if args.o:
        if args.o.endswith(".xmf"):
            output_filename = args.o
        else:
            print "The script was stopped, because your output filename doesn't have\nan ending paraview can work with. Please use the ending '.xmf'!"
            sys.exit()

    if args.no_splitgrid:
        # create the basic xml structure using splash2xdmf
        xdmf_root = splash2xdmf.create_xdmf_xml(splash_files, args)
        # transform this xml using our pic semantic knowledge
        transform_xdmf_xml(xdmf_root)
        # create a xml file from the transformed structure
        doc.appendChild(xdmf_root)
        # write data to output file
        splash2xdmf.write_xml_to_file(output_filename, doc)
    else:
        # create the basic xml structure for grid and poly using splash2xdmf
        grid_xdmf_root, poly_xdmf_root = splash2xdmf.create_xdmf_xml(splash_files, args)
        # transform these xml using our pic semantic knowledge
        transform_xdmf_xml(grid_xdmf_root)
        transform_xdmf_xml(poly_xdmf_root)
        # create the xml files from the transformed structures
        grid_doc.appendChild(grid_xdmf_root)
        poly_doc.appendChild(poly_xdmf_root)
        # create list of two output filenames with _grid and _poly extension
        output_filename_list = splash2xdmf.handle_user_filename(output_filename)
        # use output filename list to write data to the relating output file
        for output_file in output_filename_list:
            if output_file.endswith("_grid.xmf"):
                splash2xdmf.write_xml_to_file(output_file, grid_doc)
            if output_file.endswith("_poly.xmf"):
                splash2xdmf.write_xml_to_file(output_file, poly_doc)
def main():
    """
    Main
    """
    global time_series

    # get arguments from command line
    args_parser = get_args_parser()
    args = args_parser.parse_args()

    # apply arguments
    splashFilename = args.splashfile
    time_series = args.time

    # create the list of requested splash files
    splash_files = list()
    if time_series:
        splashFilename = splash2xdmf.get_common_filename(splashFilename)
        for s_filename in glob.glob("{}_*.h5".format(splashFilename)):
            splash_files.append(s_filename)
    else:
        splash_files.append(splashFilename)
        tmp = splashFilename.rfind(".h5")
        splashFilename = splashFilename[:tmp]

    output_filename = "{}.xmf".format(splashFilename)

    if args.o:
        if args.o.endswith(".xmf"):
            output_filename = args.o
        else:
            print "The script was stopped, because your output filename doesn't have\nan ending paraview can work with. Please use the ending '.xmf'!"
            sys.exit()

    if args.no_splitgrid:
        # create the basic xml structure using splash2xdmf
        xdmf_root = splash2xdmf.create_xdmf_xml(splash_files, args)
        # transform this xml using our pic semantic knowledge
        transform_xdmf_xml(xdmf_root)
        # create a xml file from the transformed structure
        doc.appendChild(xdmf_root)
        # write data to output file
        splash2xdmf.write_xml_to_file(output_filename, doc)
    else:
        # create the basic xml structure for grid and poly using splash2xdmf
        grid_xdmf_root, poly_xdmf_root = splash2xdmf.create_xdmf_xml(splash_files, args)
        # transform these xml using our pic semantic knowledge
        transform_xdmf_xml(grid_xdmf_root)
        transform_xdmf_xml(poly_xdmf_root)
        # create the xml files from the transformed structures
        grid_doc.appendChild(grid_xdmf_root)
        poly_doc.appendChild(poly_xdmf_root)
        # create list of two output filenames with _grid and _poly extension
        output_filename_list = splash2xdmf.handle_user_filename(output_filename)
        # use output filename list to write data to the relating output file
        for output_file in output_filename_list:
            if output_file.endswith("_grid.xmf"):
                splash2xdmf.write_xml_to_file(output_file, grid_doc)
            if output_file.endswith("_poly.xmf"):
                splash2xdmf.write_xml_to_file(output_file, poly_doc)
示例#3
0
def main():
    """
    Main
    """

    # get arguments from command line
    args_parser = get_args_parser()
    args = args_parser.parse_args()

    # apply arguments
    splashFilename = args.splashfile
    time_series = args.time

    # create the list of requested splash files
    splash_files = list()
    if time_series:
        splashFilename = splash2xdmf.get_common_filename(splashFilename)
        for s_filename in glob.glob("{}_*.h5".format(splashFilename)):
            splash_files.append(s_filename)
    else:
        splash_files.append(splashFilename)

    # create the basic xml structure using splas2xdmf
    xdmf_root = splash2xdmf.create_xdmf_xml(splash_files)
    # transform this xml using our pic semantic knowledge
    transform_xdmf_xml(xdmf_root)

    # create a xml file from the transformed structure
    doc.appendChild(xdmf_root)

    output_filename = "{}.xmf".format(splashFilename)
    if args.o:
        output_filename = args.o
    splash2xdmf.write_xml_to_file(output_filename, doc)
示例#4
0
def main():
    """
    Main
    """

    # get arguments from command line
    args_parser = get_args_parser()
    args = args_parser.parse_args()

    # apply arguments
    splashFilename = args.splashfile
    time_series = args.time

    # create the list of requested splash files
    splash_files = list()
    if time_series:
        splashFilename = splash2xdmf.get_common_filename(splashFilename)
        for s_filename in glob.glob("{}_*.h5".format(splashFilename)):
            splash_files.append(s_filename)
    else:
        splash_files.append(splashFilename)
        
    # create the basic xml structure using splas2xdmf
    xdmf_root = splash2xdmf.create_xdmf_xml(splash_files)
    # transform this xml using our pic semantic knowledge
    transform_xdmf_xml(xdmf_root)

    # create a xml file from the transformed structure
    doc.appendChild(xdmf_root)
    
    output_filename = "{}.xmf".format(splashFilename)
    if args.o:
        output_filename = args.o
    splash2xdmf.write_xml_to_file(output_filename, doc)