HyTools: Hyperspectral image processing library
Project description
HyTools
HyTools is a python library for processing airborne and spaceborne imaging spectroscopy data. At it's core it consists of functions for reading and writing ENVI formatted images and reading NEON AOP HDF files along with a series of image processing functions including spectral resampling, topographic, BRDF and glint correction, spectral transforms, masking and more. We have also created a series of command line tools which combine these functions and provide a streamlined workflow for processing images.
For examples see the HyTools basics ipython notebook here. For FlexBRDF correction see the tutorial here. An alternative of FlexBRDF correction without using Ray can be checked out here. NetCDF (EMIT and AVIRIS-NG) and Geographic Lookup Table (GLT) support are added in the latest version here.
Installation
To install with pip run:
pip install hy-tools
or
python -m pip install git+https://github.com/EnSpec/hytools.git
or clone
git clone https://github.com/EnSpec/hytools.git
and install with setuptools
python setup.py install
Basic usage
import hytools as ht
#Create a HyTools container object
hy_obj = ht.HyTools()
#Read and load ENVI file metadata
hy_obj.read_file('./envi_file')
#Calculate NDVI, retrieves closest wavelength to input wavelength
ir = hy_obj.get_wave(900)
red = hy_obj.get_wave(660)
ndvi = (ir-red)/(ir+red)
#or
# Calculate normalized difference index, NDVI by default
ndvi = hy_obj.ndi()
#Other options for retrieving data
band = hy_obj.get_band(10)
column = hy_obj.get_column(1)
line = hy_obj.get_line(234)
chunk = hy_obj.get_chunk(0,100,0,100)
pixels = hy_obj.get_pixels([102,434],[324,345])
# Create a writer object to write to new file
writer = ht.io.WriteENVI('output_envi',hy_obj.get_header())
#Create an iterator object to cycle though image
iterator = hy_obj.iterate(by = 'line')
# Cycle line by line, read from original data
while not iterator.complete:
#Read next line
line = iterator.read_next()
#Do some calculations.......
radiance = line * gain + offset
#Write line to file
writer.write_line(radiance,iterator.current_line)
writer.close()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file hy_tools-1.6.0.tar.gz.
File metadata
- Download URL: hy_tools-1.6.0.tar.gz
- Upload date:
- Size: 48.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a82c4415240ea95c3b641b57bad479d1fe95a2ffb8fd6cd432b9c532e3fead29
|
|
| MD5 |
0a035bd6ea9ae0b4a01af44da87dc10b
|
|
| BLAKE2b-256 |
32e318f93ccc46f53d981958721558392f2e433511c3396dd68e8b856ae3dd33
|
File details
Details for the file hy_tools-1.6.0-py3-none-any.whl.
File metadata
- Download URL: hy_tools-1.6.0-py3-none-any.whl
- Upload date:
- Size: 75.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b256ce666d9e4d10fdc8dc899cbddb365ef515396b50998fe1a0a3a87560a464
|
|
| MD5 |
00667b8ba9d41857d3527b28565e11ef
|
|
| BLAKE2b-256 |
65bef87ba7c88cbbdb85f6db86b7d69ce6c2547274c863bec070cb7802ac8349
|