0
이것은 사소한 것처럼 보일 수 있지만 오류를 추적하는 것처럼 보일 수 있으며 프로그래밍이 아니더라도 Python을 처음 접했습니다. 인터넷에서 조금 읽으면서, 내 문제는 .dat ENVI 이미지 파일이 "설명 객체"로 읽히지 않는다고 생각합니다. 그런데 그것을 어떻게 읽을 수 있을까요? 헤더 정보를 읽는 데 필요한 솔루션이 있습니까? 실제로 나 자신을 알아 냈 있도록Python Arcpy.describe ENVI.dat 읽기 문제
import arcpy #make sure you run the python associated with ArcGIS
import os
filepath = 'filepath'
filename = 'filename'
band_names = range(1,225)
# Path creation
in_folder = filepath + os.sep + 'ENVI'
out_folder = filepath + os.sep + 'GeoTIFF' # preferably an empty folder
# input multiband raster
in_ENVI = in_folder + filename '.dat'
in_raster = raster(in_ENVI)
index = 0
# get raster information specific to each band
desc = arcpy.Describe(in_raster)
################### THIS IS WHERE I GET THE ERROR ##################
Runtime error
Traceback (most recent call last):
File "<string>", line 23, in <module>
NameError: name 'raster' is not defined
################### SCRIPT TERMINATED ##############################
for band in desc.children:
print band
bandName = band.name
band_path = os.path.join(in_raster, bandName)
dest_path = os.path.join(out_folder, filename '_' + band_names(index) + '.tif')
arcpy.CopyRaster_management(band_path, dest_path, "", "", "", "NONE", "NONE", "")
index = index + 1