当前位置: 首页>>代码示例>>Python>>正文


Python FileIO.logMsg方法代码示例

本文整理汇总了Python中FileIO.logMsg方法的典型用法代码示例。如果您正苦于以下问题:Python FileIO.logMsg方法的具体用法?Python FileIO.logMsg怎么用?Python FileIO.logMsg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileIO的用法示例。


在下文中一共展示了FileIO.logMsg方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: import FileIO [as 别名]
# 或者: from FileIO import logMsg [as 别名]
def main(ripFilePath):
#------------------------------------------------------------
# Begin main file execution
#------------------------------------------------------------ 

	# Timing events: start
	start_time0 = datetime.datetime.now()		
	
	# If .rip file does not exist
	if not os.path.exists(ripFilePath):
		print("Cannot find or open runtime inputs file(%s)"%(ripFilePath))
		sys.exit(-1)
	
	# --------------------------------------------------
	# Get user defined program input
	# --------------------------------------------------
			
	# create a RipMgr instance, via parser itself
	r = mgrParseStanzaInputs(ripFilePath)   
	sessionLbl = r.kwdGetValue('Session_label')
	# This properly names log file
	sessionLbl = sessionLbl.strip(' ')
	logSessionPath = sessionLbl + ".log"
	try:
		logfHndl =open(logSessionPath,'w')
	except (IOError,OSError) as eMsg:
		print("Error (%s) opening session logfile(%s)"%(eMsg,logSessionPath))
		sys.exit(-1)
	
	msgVerbose = True	
	FileIO.logMsg(logfHndl,"\n%s Release %s Version %s\n"%(appName,appRele,appVers),msgVerbose)
	FileIO.logMsg(logfHndl,"Author(s): %s"%(authorNames)+'\n',msgVerbose)
	FileIO.logMsg(logfHndl,"Session runtime inputs from: (%s)"%(ripFilePath)+'\n\n',msgVerbose)   
	FileIO.logMsg(logfHndl,"Log output directed to     : (%s)"%(logSessionPath),msgVerbose)
	#---------------------------------------------------------------------------
	# Start main     
	#---------------------------------------------------------------------------
	
	gridfile = r.kwdGetValue('Grid_Filename')
	xyfilename = r.kwdGetValue('XY_Filename')
	resans = r.kwdGetValue('Use_Resistance')
	directionans = r.kwdGetValue('Use_Direction')
	dirtype = r.kwdGetValue('Type_Direction')
	barrfile = r.kwdGetValue('Barrier_or_U_Filename')
	elevfile = r.kwdGetValue('Direction_or_V_Filename')
	minmaxres = r.kwdGetValue('Speed_To_Resistance_Scale')
	EDthresholdans = r.kwdGetValue('Use_ED_threshold')
	nbhd_dist      = float(r.kwdGetValue('ED_Distance'))
	edge_dist      = float(r.kwdGetValue('Edge_Distance'))
	edge_type = r.kwdGetValue('Edge_Type')
	num_of_pro     = int(r.kwdGetValue('Number_of_Processes'))
	outputPathadd  = r.kwdGetValue('Save_Path_Output')
	outputPaths    = r.kwdGetValue('Save_IndividualPaths_Output')
	outputGraphMetrics = r.kwdGetValue('Save_GraphMetrics_Output')
	KernelFunction = r.kwdGetValue('KDE_Function')
	BufferGridSize = r.kwdGetValue('KDE_GridSize')
	outputBuffer   = r.kwdGetValue('Save_KDE_Output')
	LevelNumber    = int(r.kwdGetValue('Number_of_Categories'))
	outputLevels   = r.kwdGetValue('Save_Category_Output')
	CDmatrixans    = r.kwdGetValue('Save_CDmatrix_Output') 
	transform_func = r.kwdGetValue('Transform_function')	
	const_kernal_vol = r.kwdGetValue('Const_kernal_vol')
	vol_constant = int(r.kwdGetValue('Kernel_volume'))

	# -----------------------------------------
	# Some error checking with mutliple options
	# -----------------------------------------
	# For the different directional models
	if directionans:
		tempdirtype = dirtype.split(';')
		if len(tempdirtype) > 1: # This is the hiking application
			if not resans:
				print('Resistant kernel directionality specified, use resistance not conductance.')
				sys.exit(-1)
			# Get parameter values
			dirtype_A = float(tempdirtype[1])
			dirtype_B = float(tempdirtype[2])
		dirtype = tempdirtype[0]
		# Get scale values for wind and hiking
		if dirtype == 'Hiking' or dirtype == 'Wind':
			if len(minmaxres.split(';')) != 2:
				print('Minimum and maximum scaling values needed for speed to resistance calculation.')
				sys.exit(-1)
			else:
				minres = float(minmaxres.split(';')[0])
				maxres = float(minmaxres.split(';')[1])
		
	# For symmetric models
	if not directionans:
		# Only resistance right now
		if not resans:
			print('Conductance option is not functioning currently with symmetric models. Use resistance.')
			sys.exit(-1)
	
	# ------------------------
	# No direction
	# ------------------------
	# Just resistance surface
	if not directionans:
				
#.........这里部分代码省略.........
开发者ID:ComputationalEcologyLab,项目名称:UNICOR,代码行数:103,代码来源:UNICOR.py


注:本文中的FileIO.logMsg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。