def make_fgmax(FG): """Deprecated -- use FGmaxGrid.write_input_data""" print "---------------------------------------------- " x1, x2 = FG.x1, FG.x2 y1, y2 = FG.y1, FG.y2 point_style = FG.point_style if point_style not in [1, 2, 3]: raise NotImplementedError("make_fgmax not implemented for point_style %i" \ % point_style) if point_style == 2: # 2d grid of points if FG.nx is None: dx = FG.dx nx = int(round((x2 - x1) / dx)) + 1 if abs((nx - 1) * dx + x1 - x2) > 1e-6: print "Warning: abs((nx-1)*dx + x1 - x2) = ", \ abs((nx-1)*dx + x1 - x2) print " old x2: %22.16e" % x2 x2 = x1 + dx * (nx - 1) print " resetting x2 to %22.16e" % x2 else: nx = FG.nx dx = (x2 - x1) / (nx + 1.) if FG.dx is not None: print "*** Warning: dx specified over-ridden by: ", dx if FG.ny is None: dy = FG.dy if dy is None: dy = dx ny = int(round((y2 - y1) / dy)) + 1 if abs((ny - 1) * dy + y1 - y2) > 1e-6: print "Warning: abs((ny-1)*dy + y1 - y2) = ", \ abs((ny-1)*dy + y1 - y2) print " old y2: %22.16e" % y2 y2 = y1 + dy * (ny - 1) print " resetting y2 to %22.16e" % y2 else: ny = FG.ny dy = (y2 - y1) / (ny + 1.) if FG.dy is not None: print "*** Warning: dy specified over-ridden by: ", dy npts = nx * ny fid = open(FG.fname, 'w') fid.write("%16.10e # tstart_max\n" % FG.tstart_max) fid.write("%16.10e # tend_max\n" % FG.tend_max) fid.write("%16.10e # dt_check\n" % FG.dt_check) fid.write("%i %s # min_level_check\n" \ % (FG.min_level_check,16*" ")) fid.write("%16.10e # arrival_tol\n" % FG.arrival_tol) fid.write("%i %s # point_style\n" \ % (FG.point_style,16*" ")) fid.write("%i %i %s # nx,ny\n" \ % (nx,ny,10*" ")) fid.write("%16.10e %20.10e # x1, y1\n" % (x1, y1)) fid.write("%16.10e %20.10e # x2, y2\n" % (x2, y2)) fid.close() print "Created file ", FG.fname print " specifying fixed grid with shape %i by %i, with %i points" \ % (nx,ny,npts) print " lower left = (%15.10f,%15.10f)" % (x1, y1) print " upper right = (%15.10f,%15.10f)" % (x2, y2) print " dx = %15.10e, dy = %15.10e" % (dx, dy) xy = [x1, x2, y1, y2] fname_root = os.path.splitext(FG.fname)[0] kml_file = fname_root + '.kml' kmltools.box2kml(xy, kml_file, fname_root, color='8888FF') elif point_style == 1: # 1d transect of points if FG.npts is None: dx = FG.dx npts = int(round(sqrt((x2 - x1)**2 + (y2 - y1)**2) / dx)) + 1 if abs((npts - 1) * dx + x1 - x2) > 1e-6: print "Warning: abs((npts-1)*dx + x1 - x2) = ", \ abs((npts-1)*dx + x1 - x2) x2 = x1 + dx * (npts - 1) y2 = y1 + dx * (npts - 1) print " resetting x2 to %g" % x2 print " resetting y2 to %g" % y2 else: npts = FG.npts dx = sqrt((x2 - x1)**2 + (y2 - y1)**2) / (npts + 1.) if FG.dx is not None: print "*** Warning: dx specified over-ridden by: ", dx print "Creating 1d fixed grid with %s points" % npts print " dx = %g" % dx fid = open(FG.fname, 'w') fid.write("%g # tstart_max\n" % FG.tstart_max) fid.write("%g # tend_max\n" % FG.tend_max) fid.write("%g # dt_check\n" % FG.dt_check) fid.write("%i # min_level_check\n" % FG.min_level_check) fid.write("%g # arrival_tol\n" % FG.arrival_tol) fid.write("%g # point_style\n" % FG.point_style) fid.write("%i # npts\n" % (npts)) fid.write("%g %g # x1, y1\n" % (x1, y1)) fid.write("%g %g # x2, y2\n" % (x2, y2)) fid.close() print "Created file ", FG.fname print " specifying fixed grid with %i points equally spaced from " \ % npts print " (%g,%g) to (%g,%g)" % (x1, y1, x2, y2) # not yet implemented: #fname_root = os.path.splitext(FG.fname)[0] #kml_file = fname_root + '.kml' #kmltools.line2kml(xy, kml_file, fname_root, color='8888FF') elif point_style == 3: # arbitrary quadrilateral x3, x4 = FG.x3, FG.x4 y3, y4 = FG.y3, FG.y4 if FG.n12 is None: raise NotImplementedError("Need to set n12 and n23") else: npts = FG.n12 * FG.n23 fid = open(FG.fname, 'w') fid.write("%g # tstart_max\n" % FG.tstart_max) fid.write("%g # tend_max\n" % FG.tend_max) fid.write("%g # dt_check\n" % FG.dt_check) fid.write("%i # min_level_check\n" % FG.min_level_check) fid.write("%g # arrival_tol\n" % FG.arrival_tol) fid.write("%g # point_style\n" % FG.point_style) fid.write("%i %i %s # FG.n12,FG.n23\n" \ % (FG.n12,FG.n23,10*" ")) fid.write("%16.10e %20.10e # x1, y1\n" % (x1, y1)) fid.write("%16.10e %20.10e # x2, y2\n" % (x2, y2)) fid.write("%16.10e %20.10e # x3, y3\n" % (x3, y3)) fid.write("%16.10e %20.10e # x4, y4\n" % (x4, y4)) fid.close() print "Created file ", FG.fname print " specifying fixed grid as a quadrilateral" print " %i by %i, with %i points" \ % (FG.n12,FG.n23,npts) print " corner 1 = (%15.10f,%15.10f)" % (x1, y1) print " corner 2 = (%15.10f,%15.10f)" % (x2, y2) print " corner 3 = (%15.10f,%15.10f)" % (x3, y3) print " corner 4 = (%15.10f,%15.10f)" % (x4, y4) xy = [x1, y1, x2, y2, x3, y3, x4, y4] fname_root = os.path.splitext(FG.fname)[0] kml_file = fname_root + '.kml' kmltools.quad2kml(xy, kml_file, fname_root, color='8888FF')
def make_fgmax(FG): """Deprecated -- use FGmaxGrid.write_input_data""" print("---------------------------------------------- ") x1,x2 = FG.x1, FG.x2 y1,y2 = FG.y1, FG.y2 point_style = FG.point_style if point_style not in [1,2,3]: raise NotImplementedError("make_fgmax not implemented for point_style %i" \ % point_style) if point_style == 2: # 2d grid of points if FG.nx is None: dx = FG.dx nx = int(round((x2-x1)/dx)) + 1 if abs((nx-1)*dx + x1 - x2) > 1e-6: print("Warning: abs((nx-1)*dx + x1 - x2) = ", \ abs((nx-1)*dx + x1 - x2)) print(" old x2: %22.16e" % x2) x2 = x1 + dx*(nx-1) print(" resetting x2 to %22.16e" % x2) else: nx = FG.nx dx = (x2-x1)/(nx+1.) if FG.dx is not None: print("*** Warning: dx specified over-ridden by: ",dx) if FG.ny is None: dy = FG.dy if dy is None: dy = dx ny = int(round((y2-y1)/dy)) + 1 if abs((ny-1)*dy + y1 - y2) > 1e-6: print("Warning: abs((ny-1)*dy + y1 - y2) = ", \ abs((ny-1)*dy + y1 - y2)) print(" old y2: %22.16e" % y2) y2 = y1 + dy*(ny-1) print(" resetting y2 to %22.16e" % y2) else: ny = FG.ny dy = (y2-y1)/(ny+1.) if FG.dy is not None: print("*** Warning: dy specified over-ridden by: ",dy) npts = nx*ny fid = open(FG.fname,'w') fid.write("%16.10e # tstart_max\n" % FG.tstart_max) fid.write("%16.10e # tend_max\n" % FG.tend_max) fid.write("%16.10e # dt_check\n" % FG.dt_check) fid.write("%i %s # min_level_check\n" \ % (FG.min_level_check,16*" ")) fid.write("%16.10e # arrival_tol\n" % FG.arrival_tol) fid.write("%i %s # point_style\n" \ % (FG.point_style,16*" ")) fid.write("%i %i %s # nx,ny\n" \ % (nx,ny,10*" ")) fid.write("%16.10e %20.10e # x1, y1\n" % (x1,y1)) fid.write("%16.10e %20.10e # x2, y2\n" % (x2,y2)) fid.close() print("Created file ", FG.fname) print(" specifying fixed grid with shape %i by %i, with %i points" \ % (nx,ny,npts)) print(" lower left = (%15.10f,%15.10f)" % (x1,y1)) print(" upper right = (%15.10f,%15.10f)" % (x2,y2)) print(" dx = %15.10e, dy = %15.10e" % (dx,dy)) xy = [x1,x2,y1,y2] fname_root = os.path.splitext(FG.fname)[0] kml_file = fname_root + '.kml' kmltools.box2kml(xy, kml_file, fname_root, color='8888FF') elif point_style==1: # 1d transect of points if FG.npts is None: dx = FG.dx npts = int(round(sqrt((x2-x1)**2 + (y2-y1)**2)/dx)) + 1 if abs((npts-1)*dx + x1 - x2) > 1e-6: print("Warning: abs((npts-1)*dx + x1 - x2) = ", \ abs((npts-1)*dx + x1 - x2)) x2 = x1 + dx*(npts-1) y2 = y1 + dx*(npts-1) print(" resetting x2 to %g" % x2) print(" resetting y2 to %g" % y2) else: npts = FG.npts dx = sqrt((x2-x1)**2 + (y2-y1)**2)/(npts+1.) if FG.dx is not None: print("*** Warning: dx specified over-ridden by: ",dx) print("Creating 1d fixed grid with %s points" % npts) print(" dx = %g" % dx) fid = open(FG.fname,'w') fid.write("%g # tstart_max\n" % FG.tstart_max) fid.write("%g # tend_max\n" % FG.tend_max) fid.write("%g # dt_check\n" % FG.dt_check) fid.write("%i # min_level_check\n" % FG.min_level_check) fid.write("%g # arrival_tol\n" % FG.arrival_tol) fid.write("%g # point_style\n" % FG.point_style) fid.write("%i # npts\n" % (npts)) fid.write("%g %g # x1, y1\n" % (x1,y1)) fid.write("%g %g # x2, y2\n" % (x2,y2)) fid.close() print("Created file ", FG.fname) print(" specifying fixed grid with %i points equally spaced from " \ % npts) print(" (%g,%g) to (%g,%g)" % (x1,y1,x2,y2)) # not yet implemented: #fname_root = os.path.splitext(FG.fname)[0] #kml_file = fname_root + '.kml' #kmltools.line2kml(xy, kml_file, fname_root, color='8888FF') elif point_style==3: # arbitrary quadrilateral x3,x4 = FG.x3, FG.x4 y3,y4 = FG.y3, FG.y4 if FG.n12 is None: raise NotImplementedError("Need to set n12 and n23") else: npts = FG.n12 * FG.n23 fid = open(FG.fname,'w') fid.write("%g # tstart_max\n" % FG.tstart_max) fid.write("%g # tend_max\n" % FG.tend_max) fid.write("%g # dt_check\n" % FG.dt_check) fid.write("%i # min_level_check\n" % FG.min_level_check) fid.write("%g # arrival_tol\n" % FG.arrival_tol) fid.write("%g # point_style\n" % FG.point_style) fid.write("%i %i %s # FG.n12,FG.n23\n" \ % (FG.n12,FG.n23,10*" ")) fid.write("%16.10e %20.10e # x1, y1\n" % (x1,y1)) fid.write("%16.10e %20.10e # x2, y2\n" % (x2,y2)) fid.write("%16.10e %20.10e # x3, y3\n" % (x3,y3)) fid.write("%16.10e %20.10e # x4, y4\n" % (x4,y4)) fid.close() print("Created file ", FG.fname) print(" specifying fixed grid as a quadrilateral") print(" %i by %i, with %i points" \ % (FG.n12,FG.n23,npts)) print(" corner 1 = (%15.10f,%15.10f)" % (x1,y1)) print(" corner 2 = (%15.10f,%15.10f)" % (x2,y2)) print(" corner 3 = (%15.10f,%15.10f)" % (x3,y3)) print(" corner 4 = (%15.10f,%15.10f)" % (x4,y4)) xy = [x1,y1,x2,y2,x3,y3,x4,y4] fname_root = os.path.splitext(FG.fname)[0] kml_file = fname_root + '.kml' kmltools.quad2kml(xy, kml_file, fname_root, color='8888FF')
def write_input_data(self, input_file_name=None): r""" Write input data from a file like *fgmax.txt* that will be read in by GeoClaw as input data. """ if input_file_name is not None: self.input_file_name = input_file_name print "---------------------------------------------- " point_style = self.point_style if point_style not in [0, 1, 2, 3]: raise NotImplementedError("make_fgmax not implemented for point_style %i" \ % point_style) # write header, independent of point_style: fid = open(self.input_file_name, 'w') fid.write("%16.10e # tstart_max\n" % self.tstart_max) fid.write("%16.10e # tend_max\n" % self.tend_max) fid.write("%16.10e # dt_check\n" % self.dt_check) fid.write("%i %s # min_level_check\n" \ % (self.min_level_check,16*" ")) fid.write("%16.10e # arrival_tol\n" % self.arrival_tol) fid.write("%i %s # point_style\n" \ % (self.point_style,16*" ")) if point_style == 0: # list of points npts = self.npts print "Creating unstructured grid of %s points" % npts fid.write("%i # npts\n" % (npts)) for k in range(npts): fid.write("%g %g \n" % (self.X[k], self.Y[k])) fid.close() print "Created file ", self.input_file_name elif point_style == 1: # 1d transect of points x1, x2 = self.x1, self.x2 y1, y2 = self.y1, self.y2 if self.npts is None: dx = self.dx npts = int(round(sqrt((x2 - x1)**2 + (y2 - y1)**2) / dx)) + 1 if abs((npts - 1) * dx + x1 - x2) > 1e-6: print "Warning: abs((npts-1)*dx + x1 - x2) = ", \ abs((npts-1)*dx + x1 - x2) x2 = x1 + dx * (npts - 1) y2 = y1 + dx * (npts - 1) print " resetting x2 to %g" % x2 print " resetting y2 to %g" % y2 else: npts = self.npts dx = sqrt((x2 - x1)**2 + (y2 - y1)**2) / (npts + 1.) if self.dx is not None: print "*** Warning: dx specified over-ridden by: ", dx print "Creating 1d fixed grid with %s points" % npts print " dx = %g" % dx fid.write("%i # npts\n" % (npts)) fid.write("%g %g # x1, y1\n" % (x1, y1)) fid.write("%g %g # x2, y2\n" % (x2, y2)) fid.close() print "Created file ", self.input_file_name print " specifying fixed grid with %i points equally spaced from " \ % npts print " (%g,%g) to (%g,%g)" % (x1, y1, x2, y2) # not yet implemented: #fname_root = os.path.splitext(self.input_file_name)[0] #kml_file = fname_root + '.kml' #kmltools.line2kml(xy, kml_file, fname_root, color='8888FF') if point_style == 2: # 2d grid of points x1, x2 = self.x1, self.x2 y1, y2 = self.y1, self.y2 if self.nx is None: dx = self.dx nx = int(round((x2 - x1) / dx)) + 1 if abs((nx - 1) * dx + x1 - x2) > 1e-6: print "Warning: abs((nx-1)*dx + x1 - x2) = ", \ abs((nx-1)*dx + x1 - x2) print " old x2: %22.16e" % x2 x2 = x1 + dx * (nx - 1) print " resetting x2 to %22.16e" % x2 else: nx = self.nx dx = (x2 - x1) / (nx + 1.) if self.dx is not None: print "*** Warning: dx specified over-ridden by: ", dx if self.ny is None: dy = self.dy if dy is None: dy = dx ny = int(round((y2 - y1) / dy)) + 1 if abs((ny - 1) * dy + y1 - y2) > 1e-6: print "Warning: abs((ny-1)*dy + y1 - y2) = ", \ abs((ny-1)*dy + y1 - y2) print " old y2: %22.16e" % y2 y2 = y1 + dy * (ny - 1) print " resetting y2 to %22.16e" % y2 else: ny = self.ny dy = (y2 - y1) / (ny + 1.) if self.dy is not None: print "*** Warning: dy specified over-ridden by: ", dy npts = nx * ny fid.write("%i %i %s # nx,ny\n" \ % (nx,ny,10*" ")) fid.write("%16.10e %20.10e # x1, y1\n" % (x1, y1)) fid.write("%16.10e %20.10e # x2, y2\n" % (x2, y2)) fid.close() print "Created file ", self.input_file_name print " specifying fixed grid with shape %i by %i, with %i points" \ % (nx,ny,npts) print " lower left = (%15.10f,%15.10f)" % (x1, y1) print " upper right = (%15.10f,%15.10f)" % (x2, y2) print " dx = %15.10e, dy = %15.10e" % (dx, dy) xy = [x1, x2, y1, y2] fname_root = os.path.splitext(self.input_file_name)[0] kml_file = fname_root + '.kml' kmltools.box2kml(xy, kml_file, fname_root, color='8888FF') elif point_style == 3: # arbitrary quadrilateral x1, x2 = self.x1, self.x2 y1, y2 = self.y1, self.y2 x3, x4 = self.x3, self.x4 y3, y4 = self.y3, self.y4 if self.n12 is None: raise NotImplementedError("Need to set n12 and n23") else: npts = self.n12 * self.n23 fid.write("%i %i %s # self.n12,self.n23\n" \ % (self.n12,self.n23,10*" ")) fid.write("%16.10e %20.10e # x1, y1\n" % (x1, y1)) fid.write("%16.10e %20.10e # x2, y2\n" % (x2, y2)) fid.write("%16.10e %20.10e # x3, y3\n" % (x3, y3)) fid.write("%16.10e %20.10e # x4, y4\n" % (x4, y4)) fid.close() print "Created file ", self.input_file_name print " specifying fixed grid as a quadrilateral" print " %i by %i, with %i points" \ % (self.n12,self.n23,npts) print " corner 1 = (%15.10f,%15.10f)" % (x1, y1) print " corner 2 = (%15.10f,%15.10f)" % (x2, y2) print " corner 3 = (%15.10f,%15.10f)" % (x3, y3) print " corner 4 = (%15.10f,%15.10f)" % (x4, y4) xy = [x1, y1, x2, y2, x3, y3, x4, y4] fname_root = os.path.splitext(self.input_file_name)[0] kml_file = fname_root + '.kml' kmltools.quad2kml(xy, kml_file, fname_root, color='8888FF')
def write_input_data(self, input_file_name=None): r""" Write input data from a file like *fgmax.txt* that will be read in by GeoClaw as input data. """ if input_file_name is not None: self.input_file_name = input_file_name print("---------------------------------------------- ") point_style = self.point_style if point_style not in [0,1,2,3]: raise NotImplementedError("make_fgmax not implemented for point_style %i" \ % point_style) # write header, independent of point_style: fid = open(self.input_file_name,'w') fid.write("%16.10e # tstart_max\n" % self.tstart_max) fid.write("%16.10e # tend_max\n" % self.tend_max) fid.write("%16.10e # dt_check\n" % self.dt_check) fid.write("%i %s # min_level_check\n" \ % (self.min_level_check,16*" ")) fid.write("%16.10e # arrival_tol\n" % self.arrival_tol) fid.write("%i %s # point_style\n" \ % (self.point_style,16*" ")) if point_style == 0: # list of points npts = self.npts print("Creating unstructured grid of %s points" % npts) fid.write("%i # npts\n" % (npts)) for k in range(npts): fid.write("%g %g \n" % (self.X[k],self.Y[k])) fid.close() print("Created file ", self.input_file_name) elif point_style==1: # 1d transect of points x1,x2 = self.x1, self.x2 y1,y2 = self.y1, self.y2 if self.npts is None: dx = self.dx npts = int(round(sqrt((x2-x1)**2 + (y2-y1)**2)/dx)) + 1 if abs((npts-1)*dx + x1 - x2) > 1e-6: print("Warning: abs((npts-1)*dx + x1 - x2) = ", \ abs((npts-1)*dx + x1 - x2)) x2 = x1 + dx*(npts-1) y2 = y1 + dx*(npts-1) print(" resetting x2 to %g" % x2) print(" resetting y2 to %g" % y2) else: npts = self.npts dx = sqrt((x2-x1)**2 + (y2-y1)**2)/(npts+1.) if self.dx is not None: print("*** Warning: dx specified over-ridden by: ",dx) print("Creating 1d fixed grid with %s points" % npts) print(" dx = %g" % dx) fid.write("%i # npts\n" % (npts)) fid.write("%g %g # x1, y1\n" % (x1,y1)) fid.write("%g %g # x2, y2\n" % (x2,y2)) fid.close() print("Created file ", self.input_file_name) print(" specifying fixed grid with %i points equally spaced from " \ % npts) print(" (%g,%g) to (%g,%g)" % (x1,y1,x2,y2)) # not yet implemented: #fname_root = os.path.splitext(self.input_file_name)[0] #kml_file = fname_root + '.kml' #kmltools.line2kml(xy, kml_file, fname_root, color='8888FF') if point_style == 2: # 2d grid of points x1,x2 = self.x1, self.x2 y1,y2 = self.y1, self.y2 if self.nx is None: dx = self.dx nx = int(round((x2-x1)/dx)) + 1 if abs((nx-1)*dx + x1 - x2) > 1e-6: print("Warning: abs((nx-1)*dx + x1 - x2) = ", \ abs((nx-1)*dx + x1 - x2)) print(" old x2: %22.16e" % x2) x2 = x1 + dx*(nx-1) print(" resetting x2 to %22.16e" % x2) else: nx = self.nx dx = (x2-x1)/(nx+1.) if self.dx is not None: print("*** Warning: dx specified over-ridden by: ",dx) if self.ny is None: dy = self.dy if dy is None: dy = dx ny = int(round((y2-y1)/dy)) + 1 if abs((ny-1)*dy + y1 - y2) > 1e-6: print("Warning: abs((ny-1)*dy + y1 - y2) = ", \ abs((ny-1)*dy + y1 - y2)) print(" old y2: %22.16e" % y2) y2 = y1 + dy*(ny-1) print(" resetting y2 to %22.16e" % y2) else: ny = self.ny dy = (y2-y1)/(ny+1.) if self.dy is not None: print("*** Warning: dy specified over-ridden by: ",dy) npts = nx*ny fid.write("%i %i %s # nx,ny\n" \ % (nx,ny,10*" ")) fid.write("%16.10e %20.10e # x1, y1\n" % (x1,y1)) fid.write("%16.10e %20.10e # x2, y2\n" % (x2,y2)) fid.close() print("Created file ", self.input_file_name) print(" specifying fixed grid with shape %i by %i, with %i points" \ % (nx,ny,npts)) print(" lower left = (%15.10f,%15.10f)" % (x1,y1)) print(" upper right = (%15.10f,%15.10f)" % (x2,y2)) print(" dx = %15.10e, dy = %15.10e" % (dx,dy)) xy = [x1,x2,y1,y2] fname_root = os.path.splitext(self.input_file_name)[0] kml_file = fname_root + '.kml' kmltools.box2kml(xy, kml_file, fname_root, color='8888FF') elif point_style==3: # arbitrary quadrilateral x1,x2 = self.x1, self.x2 y1,y2 = self.y1, self.y2 x3,x4 = self.x3, self.x4 y3,y4 = self.y3, self.y4 if self.n12 is None: raise NotImplementedError("Need to set n12 and n23") else: npts = self.n12 * self.n23 fid.write("%i %i %s # self.n12,self.n23\n" \ % (self.n12,self.n23,10*" ")) fid.write("%16.10e %20.10e # x1, y1\n" % (x1,y1)) fid.write("%16.10e %20.10e # x2, y2\n" % (x2,y2)) fid.write("%16.10e %20.10e # x3, y3\n" % (x3,y3)) fid.write("%16.10e %20.10e # x4, y4\n" % (x4,y4)) fid.close() print("Created file ", self.input_file_name) print(" specifying fixed grid as a quadrilateral") print(" %i by %i, with %i points" \ % (self.n12,self.n23,npts)) print(" corner 1 = (%15.10f,%15.10f)" % (x1,y1)) print(" corner 2 = (%15.10f,%15.10f)" % (x2,y2)) print(" corner 3 = (%15.10f,%15.10f)" % (x3,y3)) print(" corner 4 = (%15.10f,%15.10f)" % (x4,y4)) xy = [x1,y1,x2,y2,x3,y3,x4,y4] fname_root = os.path.splitext(self.input_file_name)[0] kml_file = fname_root + '.kml' kmltools.quad2kml(xy, kml_file, fname_root, color='8888FF')