Esempio n. 1
0
def load_mesh_file(mesh_file):
	tg = tri_grid()
	if not os.path.exists(mesh_file):
		print "Mesh file: " + mesh_file + " not found"
		sys.exit(2)
	else:
		fh = open(mesh_file, 'rb')
		tg.load(fh)
		fh.close()
		print "Loaded mesh file " + mesh_file
	return tg
Esempio n. 2
0
                               ['mesh_file=', 'out_name=', 'level='])
    mesh_file = ""
    l = 0
    out_name = ""
    for opt, val in opts:
        if opt in ['--mesh_file', '-m']:
            mesh_file = val
        if opt in ['--out_name', '-o']:
            out_name = val
        if opt in ['--level', '-l']:
            l = int(val)

    # initialise the Dymaxion map
    init()
    # load the triangular grid in
    tg = tri_grid()
    fh = open(mesh_file, 'rb')
    tg.load(fh)
    fh.close()
    # create the plotting surface
    sp = plt.subplot(111)

    # draw the triangles
    draw_mesh(sp, tg, l)
    # draw original twelve triangles
    draw_outer_mesh()
    # draw the continents
    draw_map(sp)
    # remove the axis
    sp.axis('off')
    # set the map size
    opts, args = getopt.getopt(sys.argv[1:], "m:o:l:", ["mesh_file=", "out_name=", "level="])
    mesh_file = ""
    l = 0
    out_name = ""
    for opt, val in opts:
        if opt in ["--mesh_file", "-m"]:
            mesh_file = val
        if opt in ["--out_name", "-o"]:
            out_name = val
        if opt in ["--level", "-l"]:
            l = int(val)

            # initialise the Dymaxion map
    init()
    # load the triangular grid in
    tg = tri_grid()
    fh = open(mesh_file, "rb")
    tg.load(fh)
    fh.close()
    # create the plotting surface
    sp = plt.subplot(111)

    # draw the triangles
    draw_mesh(sp, tg, l)
    # draw original twelve triangles
    draw_outer_mesh()
    # draw the continents
    draw_map(sp)
    # remove the axis
    sp.axis("off")
    # set the map size