Coder Social home page Coder Social logo

hytools-sandbox's Introduction

HyTools

HyTools is a python library for working with imaging spectroscopy data, with a focus on terrestrial scenes. At it's core it consists of a series of functions for reading and writing ENVI-formatted images in addition to opening NEON-formatted AOP HDF files. Built on top of these functions are a series of higher level processing tools for data analysis which include spectral resampling, topographic correction and BRDF correction. Other features are currently under development and include mask generation and MNF transformation.

We have also created a series of command line tools which string together the processing functions and provide a more streamlined workflow for processing images.

Dependencies

  • numpy
  • h5py
  • gdal

Basic usage

import hytools as ht

#Read an ENVI file
hyObj = ht.openENVI('envi_file.bin')
#Map image data to numpy memmap object
hyObj.load_data()

#Calculate NDVI, retrieves closest wavelength to input lambda in nm
ir = hyObj.get_wave(900)
red = hyObj.get_wave(660)
ndvi = (ir-red)/(ir+red)

#Other options for retrieving data
band = hyObj.get_band(10)
column = hyObj.get_column(1)
line = hyObj.get_line(234)
chunk = hyObj.get_chunk(x1,x2,y1,y2)

# Create a writer object to write to new file
writer = ht.file_io.writeENVI('output_envi.bin',hyObj.header_dict)

#Create an iterator object to cycle though image
iterator = hyObj.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()  

Examples

BRDF Correction

The BRDF correction module consists of a series of tools for removing brightness gradients caused by variation in solar and viewing geometry. The module uses the combination of the Ross and Li kernels to model the volumetric, geometric and isometric scattering surfaces and applies a multiplicative correction to remove brightness gradients.

Before and after BRDF correction

Topographic Correction

The topographic correction module uses the Sun-Canopy-Sensor (SCS+C) method developed by Soenen et al. 2005 to remove shadows caused by variation in topography.

Topographic correction

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.