简体   繁体   English

如何从光谱python库中的env文件中读取波长信息?

[英]How to read wavelength information from envi file in spectral python libraray?

I am working on hyperspectral imagery which is in envi format.我正在研究 vi 格式的高光谱图像。 I have successfully read it using spectral python library.我已经使用光谱 python 库成功读取了它。 Now , I want to get each band (wavelength center).现在,我想得到每个波段(波长中心)。 Kindly suggest method for this task.请建议此任务的方法。

If you open the ENVI image with the spectral module, the wavelengths (band centers) are in the bands.centers attribute of the opened image.如果使用光谱模块打开 ENVI 图像,波长(波段中心)在打开图像的bands.centers属性中。

>>> import spectral as spy
>>> img = spy.open_image('EO1H0150332002114111KZ.L1R.hdr')
>>> print(img.bands.centers[:5])
[355.59, 365.76, 375.94, 386.11, 396.29]

You can also get the raw header metadata from the metadata attribute of the opened image.您还可以从打开的图像的metadata属性中获取原始标题元metadata

>>> print(img.metadata.keys())
dict_keys(['description', 'samples', 'lines', 'bands', 'header offset', 'file type', 'data type', 'interleave', 'sensor type', 'byte order', 'band names', 'read procedures', 'wavelength', 'fwhm', 'subset procedure'])
>>> print(img.metadata['wavelength'][:5])
['355.59', '365.76', '375.94', '386.11', '396.29']

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Python:如何读取 .hdr 文件附带的高光谱卫星数据 - Python: How to read hyperspectral satellite data that comes with a .hdr file 如何读取 PNG 并将 tiff 文件中的数据添加到其中并将其另存为另一个 tiff? - How to read PNG and add data from a tiff file to it and save it as another tiff? 如何将 NetCDF 文件“NDVI NOAA AVHRR”读取为 R 中的栅格? - How to read NetCDF file "NDVI NOAA AVHRR" as raster in R? 使用Python的交互式卫星地图 - Interactive Satellite Map using Python ``堆叠''数组时的Python MemoryError - Python MemoryError when 'stacking' arrays Sentinel3 OLCI (chl) Python 上 netcdf 文件的平均值 - Sentinel3 OLCI (chl) Average of netcdf files on Python 如何使用 python 获取 eumetsat 图像像素的纬度和经度? - How to get latitude and longitude for a pixel of a eumetsat image using python? 读取 GeoTIFF 文件的子集/子区域而不必先读取整个文件? - Reading subset / subarea of GeoTIFF file without having to read whole file first? 来自OpenCV的图像+轮廓旋转w / warpAffine后重叠的轮廓未对齐 - Overlayed contours not aligning after image+contours rotation w/warpAffine from OpenCV 有没有办法从 QGIS 中的谷歌地图底图制作光栅图像? 我的研究区域需要 RGB 卫星图像 - Is there a way to make a raster image from the Google Maps Basemap in QGIS? I need an RGB satellite image for my study area
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM