コード例 #1
0
            Xcent = random.uniform(L, R)
            Ycent = random.uniform(B, T)
        else:
            Xcent = L + ((R - L) / 2.0)
            Ycent = B + ((T - B) / 2.0)
    if binorm_stat == True:
        bin_max = (R - L) * 0.05  #max is 5%  of width
        bin_min = (R - L) * 0.001  #min is 0.1% of width
        Xstd = random.uniform(bin_min, bin_max)
        Ystd = Xstd * random.random()
    if (binorm_rho == True):
        Rho = random.uniform(-1.0, 1.0)
    #
    #generate the points
    #
    pnts = PM.binormal(n, Xcent, Ycent, Xstd, Ystd, Rho)
    #
    outPnts.append(pnts)
#
#optional shapefile creation
if outFC != "#":
    fieldsToAdd = [["Group", "LONG", "9", "#"], ["X", "DOUBLE", 16, 7],
                   ["Y", "DOUBLE", 16, 7]]
    py_gp.createPointFile(outFC, shapeClass, "#", outPnts, fieldsToAdd, arcpy)
    arcpy.AddMessage("\n" + "You can join the original table to " \
                  + "this shapefile table if you want other attributes." + "\n")
#
#optional csv file creation or output to screen
if outCSV != "#":
    PM.to_CSV(outCSV, outPnts)
#
コード例 #2
0
  if (binomCent == "random"):
    if numShapes > 1: 
      Xcent = random.uniform(L,R); Ycent = random.uniform(B,T)
    else:
      Xcent = L + ((R-L)/2.0); Ycent = B + ((T-B)/2.0)
  if binorm_stat == True:
    bin_max = (R - L) * 0.05  #max is 5%  of width
    bin_min = (R - L) * 0.001 #min is 0.1% of width
    Xstd = random.uniform(bin_min, bin_max)
    Ystd = Xstd * random.random()
  if (binorm_rho == True):
    Rho = random.uniform(-1.0, 1.0)
  #
  #generate the points
  #
  pnts = PM.binormal(n, Xcent, Ycent, Xstd, Ystd, Rho)
  #
  outPnts.append(pnts)
#
#optional shapefile creation
if outFC != "#":
  fieldsToAdd = [["Group", "LONG", "9", "#"],
                 ["X", "DOUBLE", 16, 7],
                 ["Y", "DOUBLE", 16, 7]]
  py_gp.createPointFile (outFC, shapeClass, "#", outPnts, fieldsToAdd, arcpy)
  arcpy.AddMessage("\n" + "You can join the original table to " \
                + "this shapefile table if you want other attributes." + "\n")
#
#optional csv file creation or output to screen
if outCSV != "#":
  PM.to_CSV(outCSV, outPnts)