python工作台_运行FME工作台的Python脚本

importosimporttime# Mainpath and Working Folder:#path_main = r"E:\XML_Data"path_main=r"E:\XML_Data"teil=str("01")# variablespath_in=path_main+r"\data_in\03_Places\teil_"+teil# "Source folder of XML files"path_in_tile10=path_main+r"\data_in\01_Tiling\10x10.shp"# "Source folder of Grid shapefile"path_in_commu=path_main+r"\data_in\02_Communities\Communities.shp"# "Source folder of Communities shapefile"path_out=path_main+r"\data_out\teil_"+teil# "Output folder of shapefiles that resulted from XML files (tile_01 folder)"path_log=path_main+r"\data_out\log_"+teil# "Output folder of log files for each run(log_01 folder)"path_fme=r"%FME_EXE_2015%"# "C:\Program Files\FME2015\fme.exe"path_fme_workbench=path_main+r"\process\PY_FME2015.fmw"# "path of FME workbench"datalists=os.listdir(path_in)count=0# Schleife, in which each file is processed individually in FMEfordataindatalists:ifdata.find(".xml")!=-1:count+=1print("Run-No."+str(count)+": with data "+data)os.system(path_fme+" "+path_fme_workbench+" "+"--SourceDataset_XML"+" "+path_in+"\\"+data+" "+"--SourceDataset_SHAPE"+" "+path_in_tile10+" "+"--SourceDataset_SHAPE_COMU"+" "+path_in_commu+" "+"--DestDataset_SHAPE"+" "+path_out+" "+"LOG_FILENAME"+" "+path_log+"\\"+data+".log")print("Data processed: "+data)shape=str(data[19:28])+"_POPINT_CENTR_UTM32N.shp"print("ResultsFileName: "+shape)if"Translation was SUCCESSFUL"inopen(path_log+"\\"+data+".log").read():# Translation was successful and SHP file exists:ifos.path.isfile(path_out+"\\"+shape):write_log=open(path_out+"\\"+"result_xml.log","a")write_log.write(time.asctime(time.localtime())+" "+shape+"\n")write_log.close()print("Everything ok")#Translation was successful, but SHP file does not exist:else:write_log=open(path_out+"\\"+"error_xml.log","a")write_log.write(time.asctime(time.localtime())+" Data: "+shape+" unavailable.\n")write_log.close()# Translation was not successful:else:write_log=open(path_out+"\\"+"error_xml.log","a")write_log.write(time.asctime(time.localtime())+" Translation "+Data+" not successful.\n")write_log.close()print("Number of calculated files: "+str(count))

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值