本文整理匯總了Python中arcpy.CheckExtension方法的典型用法代碼示例。如果您正苦於以下問題:Python arcpy.CheckExtension方法的具體用法?Python arcpy.CheckExtension怎麽用?Python arcpy.CheckExtension使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類arcpy
的用法示例。
在下文中一共展示了arcpy.CheckExtension方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testint_to_float
# 需要導入模塊: import arcpy [as 別名]
# 或者: from arcpy import CheckExtension [as 別名]
def testint_to_float(self):
_dir = os.path.join(self.testingfolder, r'testing_files\rasters')
ndvi = os.path.join(_dir, 'dh_july_ndvi')
ob = round(arcpy.Raster(ndvi).maximum, 5)
int_rst = os.path.join(_dir, 'ndvi_int')
est = os.path.join(_dir, 'ndvi_tst')
if arcpy.CheckExtension('Spatial') == 'Available':
arcpy.CheckOutExtension('Spatial')
arcpy.sa.Int(arcpy.sa.Times(ndvi, 1000000)).save(int_rst)
arcpy.CheckInExtension('Spatial')
ap.int_to_float(int_rst, est, 6)
self.assertEqual(ob, round(arcpy.Raster(est).maximum, 5))
for rast in [int_rst, est]:
try:
arcpy.Delete_management(rast)
except:pass
pass
示例2: testfill_no_data
# 需要導入模塊: import arcpy [as 別名]
# 或者: from arcpy import CheckExtension [as 別名]
def testfill_no_data(self):
_dir = os.path.join(self.testingfolder, r'testing_files\rasters')
ndvi = os.path.join(_dir, 'dh_july_ndvi')
est = os.path.join(_dir, 'ndvi_fill')
null = os.path.join(_dir, 'null_rst')
if arcpy.CheckExtension('Spatial') == 'Available':
ap.fill_no_data(ndvi, est, 10, 10)
arcpy.CheckOutExtension('Spatial')
arcpy.sa.IsNull(est).save(null)
self.assertEqual(arcpy.Raster(null).maximum, 0)
arcpy.CheckInExtension('Spatial')
for rast in [est, null]:
try:
arcpy.Delete_management(rast)
except:pass
pass
示例3: CheckOutNALicense
# 需要導入模塊: import arcpy [as 別名]
# 或者: from arcpy import CheckExtension [as 別名]
def CheckOutNALicense():
if arcpy.CheckExtension("Network") == "Available":
arcpy.CheckOutExtension("Network")
else:
arcpy.AddError("You must have a Network Analyst license to use this tool.")
raise CustomError