本文整理汇总了Python中Main.writeGrid方法的典型用法代码示例。如果您正苦于以下问题:Python Main.writeGrid方法的具体用法?Python Main.writeGrid怎么用?Python Main.writeGrid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Main
的用法示例。
在下文中一共展示了Main.writeGrid方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: sf
# 需要导入模块: import Main [as 别名]
# 或者: from Main import writeGrid [as 别名]
def sf(self):
self.console.append("*********************")
self.console.append("---------------------")
self.console.append("$$$$$$$ 开始执行 $$$$$$$")
self.console.append("---------------------")
self.console.append("*********************")
# ---------- 生成网格
if not self.isReadHelp:
QtWidgets.QMessageBox.information(self.label, "文件未读取", "请先读取Help.csv")
tmpButton = self.help_button()
if tmpButton < 0:
return tmpButton
aa = self.read_para()
Main.generateGrid(gloV.lngKm, gloV.latKm, (gloV.LAT_MIN + gloV.LAT_MAX) / 2)
if aa < 0:
return aa
# ---------- 宠物店 宠物医院 抽取
readSaveCommunity = Community.run()
if readSaveCommunity == 'NO_SAVE.':
tmpButton = self.community_button()
if tmpButton < 0:
return tmpButton
if readSaveCommunity == 'NO_DATA.':
self.console.append("*********** 没有本城市 社区 数据点 **********")
return -1
readSaveShopHospital = ShopHospital.run()
if readSaveShopHospital == 'NO_SAVE.':
tmpButton = self.help_button()
if tmpButton < 0:
return tmpButton
if readSaveShopHospital == 'NO_DATA.':
self.console.append("*********** 没有本城市 ShopHospital 数据点 **********")
return -1
# ---------------------------------------------Compute--------------------------------------------------
# ---------- 数据缺失率统计 与 基本统计量
gloV.communitySummary = Main.compute_summary('<社区>', gloV.communityVariableNameStr,
gloV.communityVariableName, len(gloV.communityData), gloV.communityValid, gloV.communityDataType, "w+")
gloV.shopSummary = Main.compute_summary('<宠物店>', gloV.shopVariableNameStr,
gloV.shopVariableName, len(gloV.shopData), gloV.shopValid, gloV.shopDataType, "a")
gloV.hospitalSummary = Main.compute_summary('<宠物医院>', gloV.hospitalVariableNameStr,
gloV.hospitalVariableName, len(gloV.hospitalData), gloV.hospitalValid, gloV.hospitalDataType, "a")
self.print_summary('<社区>', gloV.communityVariableName, gloV.communitySummary)
self.print_summary('<宠物店>', gloV.shopVariableName, gloV.shopSummary)
self.print_summary('<宠物医院>', gloV.hospitalVariableName, gloV.hospitalSummary)
# ---------- 基于Grid的计算: 得到gridCommunity, gridDemand, gridCompete, gridValue
Main.computeGrid()
# -------------------------------------------Write----------------------------------------------------
shopHospitalOutput = Main.merge_output(gloV.shopOutput, 'Shop', gloV.hospitalOutput, '医院')
allOutput = Main.merge_output(gloV.communityOutput, '社区', shopHospitalOutput, 'Shop或医院')
filePointName = "Output-Point.csv"
filePoint = open(filePointName, 'w+', encoding='gb2312')
print('\n开始输出散点图数据:')
for i in allOutput:
for j in i:
try:
filePoint.writelines(j)
except Exception:
print('Point输出编码失败:--- ' + str(j))
filePoint.writelines(',')
filePoint.writelines('\n')
filePoint.close()
self.console.append("----------<Output-Point.csv> 输出完毕!")
print('\n<Output-Point.csv> 输出完毕!')
fileGridName = "Output-Grid.csv"
Main.writeGrid(fileGridName)
self.console.append("----------<Output-Grid.csv> 输出完毕!")
self.console.append("---------- 程序完成! ----------")
# DemoDia.accept()
self.helpButton.setEnabled(False)
self.computeButton.setEnabled(False)
return 0